static-linking

statically linked shared object? Or a corrupt file?

一个人想着一个人 提交于 2019-12-05 08:15:47
I have a library that I got from a proprietary source and I'm trying to link against it but I'm getting the following error libxxx.so: file not recognized: File format not recognized collect2: ld returned 1 exit status and indeed $ ldd ./libxxx.so statically linked what does that exactly mean? Never saw a statically linked .so in my life. It might be worth noting that the last version of the same software included the same .so for which ldd shows the "normal" output and that works fine. $ file ./libxxx.so ./libxxx.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), stripped but nm

Bytestring linking in ghc

我只是一个虾纸丫 提交于 2019-12-05 06:30:36
Consider the following simple code: import Crypto.Hash.SHA1 (hashlazy) import qualified Data.ByteString as BS main = return () I installed cabal install --global bytestring and then I obtain (on a newly installed Ubuntu 12.04 machine using ghc 7.4.1): GHCi runtime linker: fatal error: I found a duplicate definition for symbol fps_minimum whilst processing object file /usr/local/lib/bytestring-0.10.0.1/ghc-7.4.1/HSbytestring-0.10.0.1.o This could be caused by: * Loading two different object files which export the same symbol * Specifying the same object file twice on the GHCi command line * An

Static ZLIB (1.2.8) linking on Visual Studio 2012

試著忘記壹切 提交于 2019-12-05 05:37:38
I can't, for the love of God, to static link the ZLIB libs. I have been struggling for a couple hours now with no success. Well, I have followed this tutorial and successfuly compiled both zlibstat.lib and zlibwapi.lib for 32 bits. After setting up my project to use the ZLIB folder with the libraries (Linker > General > Additional Library Directories) and setting zlibwapi.lib (only) as an dependency (Linker > Input > Additional Dependencies) I got it to work , however, that was a dynamic link (I need to distribute my application with the ZLIB dll). I usually use dynamic linking on Debug and

Static libpng link with visual studio 2010

跟風遠走 提交于 2019-12-05 03:57:11
问题 I'm trying to add PNG support to my application and thus I want to include libpng. I know it needs zlib and thus I downloaded that as well. I went into the png folder/projects/vstudio and I opened the solution. I compiled it and it went just fine. I added some headers from it into my application and I copied the lib files. My program is a dll written in c++ which is later used from C#. When I run it in C# it complains about not finding my dll (tough if I remove the png part it works fine). I

How to link to D Libraries in a D program

一世执手 提交于 2019-12-05 03:42:42
I´m new to the D Programming Language and have a very simple problem. I want to compile a D Script Library once and then use it in my other D projects. In C I linked to the .lib files and created headers for them, but in D I don´t find things like that (are there even some sort of headers in D?) I use D-IDE as my IDE and DMD2 as my compiler. there are .di (D interface) files which can be used as header these can be generated from your sources with the -H compiler switch however the libraries I've seen will just have the source files to import you can use the -I switch to specify where the

Boost library static linking on Xcode 4

一世执手 提交于 2019-12-04 23:42:00
问题 I am using the Boost library on OS X using Xcode. Boost was installed on my system using macports. I have successfully built my app by adding the 3 boost libraries I need (for example, libboost_thread-mt.a) to that Targets 'Link Binary With Libraries' list. However I need to link these libraries statically so that the app will run on other computers without the boost library needing to be installed. How do I do this exactly? Through my numerous google searches I'm finding I might need to add

Libtorch/Pytorch Dilemma when combined static library into one STATIC library

房东的猫 提交于 2019-12-04 21:19:27
I have around 26 static libraries such as liba.a, libb.a, libc.a, ..., libz.a . There are two catches here: 1) circular dependencies between for example liba.a and libb.a ; 2) some lib*.a has static global registration code which is unreferenced, but shall NOT be stripped away. Thanks to stackoverflow, I managed to solve above two problems with the ld option -Wl,--whole-archive -la -lb -lc -ld -le ...(omitted)... -lz -Wl,--no-whole-archive -lpthread -lm -ldl -lrt -fopenmp , and the executable binary works! It is also explained in ld linker question: the --whole-archive option Now I need to

Static linking with libwinpthread

两盒软妹~` 提交于 2019-12-04 20:31:57
问题 I try to build program with static linked toolchain libraries. I pass: LDFLAGS="-Wl,-Bstatic -lwinpthread -Wl,-Bdynamic -static-libgcc -static-libstdc++" but program linked with shared libwinpthread-1.dll . What I doing wrong? Only way when I got static linked libwinpthreads is pass -static to LDFLAGS . But it break build programs with plugin system. I use mingw-w64 + GCC-4.7.2 from the MinGW-builds project: http://sourceforge.net/projects/mingwbuilds/ 回答1: Try this: -static-libgcc -static

Statically and dynamically linking the same library

限于喜欢 提交于 2019-12-04 19:42:36
I have a program that's statically linking to a library ( libA.2.0.a ) and also dynamically links to another library ( libB.so ). libB.so also dynamically links to an older version of libA ( libA.1.0.so ). Is this configuration possible? And if so, how does the system know to use the symbols from libA.2.0.a for my program and the symbols from libA.1.0.so for libB.so ? Yes, this configuration is possible. In answer to your question as to how the system knows how to use the symbols, remember that all of the links happen at build time. After it's been built, it isn't a question of "symbols", just

How to compile c program so that it doesn't depend on any library?

无人久伴 提交于 2019-12-04 14:41:34
It seems even a hello world program depends on several libraries: libc.so.6 => /lib64/libc.so.6 (0x00000034f4000000) /lib64/ld-linux-x86-64.so.2 (0x00000034f3c00000) How can I static link all stuff ? user786653 Link with -static . "On systems that support dynamic linking, this prevents linking with the shared libraries." Edit: Yes this will increase the size of your executable. You can go two routes, either do what Marco van de Voort recommends ( -nostdlib , bake your own standard library or find a minimal one). Another route is to try and get GCC to remove as much as it can. gcc -Wl,--gc