static-linking

Is it possible to statically link against a shared object?

痴心易碎 提交于 2019-11-30 09:15:13
问题 My question is not the same as this question. I'm working on a project with a standalone binary that has no dynamic/external linkage, and runs in a *nix environment. I'm attempting to move to a newer toolset to build with, but some of the static libraries that are available with the older toolset aren't available now -- for example, the crt libraries that provided _start aren't provided in this toolset. I've been digging through the files provided with the vendor's toolset and found some

How can an autotools user specify a combination of static & dynamic linking?

牧云@^-^@ 提交于 2019-11-30 09:04:27
I'm building a program with autoconf, automake, and libtool. My work requires that I statically link (most) libraries. This hasn't been a problem in the past because I could statically link everything with -all-static . Now it's a problem because I have to use a library which is only dynamic; it was given to us by a thirdparty, and we don't have the source. Of course, -all-static now causes the build to fail. Is it possible to tell libtool to statically link everything, except for this one library? Is it possible to have libtool do any combination of static and dynamic linking, or is it all or

gcc - A static library with undefined symbols?

僤鯓⒐⒋嵵緔 提交于 2019-11-30 08:59:19
I'm trying to build a project using a static library, so that the binary can be used even if the library isn't installed. However, I get lots of errors about undefined symbols when I try to do so. Looking at the library, I see it has tons of undefined symbols, even though it's a .a static lib: nm - u /usr/local/lib/libthis.a .... U EVP_DigestFinal_ex U EVP_DigestInit_ex U EVP_DigestUpdate U EVP_MD_CTX_cleanup U EVP_MD_CTX_init Those seem to be from openssl; others seem to be from libbzip2; etc. Questions: 1. Why does the static ( .a ) lib have dependencies on shared objects (e.g. libopenssl)

VS2010 static linking issue

点点圈 提交于 2019-11-30 08:57:42
my company has recently upgraded from VS2005 to VS2010. We have a huge project which uses a lot of modules which are being linked statically into the exe. But there seem to be some issues with linking in VS2010. To explain our problem, we've built a minimal example project which is composed as shown on this graphic: There is an application using one function from library A. Library A calls one function of each library B and library C. Those two libraries call a function provided by library D. For Exe 1 under Framework and References we set everything to false except for Link Library

Static link libstdc++ using clang

南笙酒味 提交于 2019-11-30 08:53:17
When I use GCC, I can build program on my Ubuntu 15.04 using this: -static-libgcc -static-libstdc++ And compiled binary can run on "stock" Ubuntu 14.04 without any external packages, only standard updates. Is there possibility do build with this static linking to library with clang ? Most common answers: using test ubuntu rep ( ppa:ubuntu-toolchain-r/test ) update server recompile on target server don't use GCC is not suitable for me. Just can I do this with clang for run it on Ubuntu 14.04.3 LTS? clang is compatible with gcc on this matter. Basically for hello-world program that uses iostream

Cannot compile a simple Qt program in MT mode as opposed to MD in Visual Studio 2010

醉酒当歌 提交于 2019-11-30 07:01:53
I'm trying to compile using MTd in Visual Studio 2010 instead of MDd (so that the dll's are packaged in and i won't need to distribute them with my exe), but I keep getting "fatal error LNK1169: one or more multiply defined symbols found" during compilation. MDd compiles fine but does not work without MSVCP100.dll on other computers. I'm using a static build of Qt and I'm trying to build the default Qt program that comes with the VS add-in. Is there another way to force the linker to compile statically? All I'm trying to do is distribute a Qt program as an exe without dll's. Here is the build

How to static link Linux software that uses ./configure?

不想你离开。 提交于 2019-11-30 06:37:57
I would like to compile NRPE static, so I can copy the compiled binary to an OmniOS server, where I don't want gcc to be installed on. I would prefer to install NRPE with SSl support from a repository, but such doesn't seam to exist, so I would like to compile it myself. However the ./configure script doesn't contain a static option it seams ~/nrpe-2.15# ./configure --help | grep static ~/nrpe-2.15# ./configure --help | grep share --datadir=DIR read-only architecture-independent data [PREFIX/share] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] Question How do I

How do I include only used symbols when statically linking with gcc?

只谈情不闲聊 提交于 2019-11-30 06:21:53
问题 I'm deploying a small program compiled with gcc, 4.3.2-1.1 (Debian). This program will be deployed on virtual machine templates ranging from Debain 5 to bleeding edge Fedora, Ubuntu, Slackware, Arch and others. The program depends on some symbols from Xen's libraries which are only available in an unstable tree. Hence, installing Xen's libraries via respective package managers on the virtual machine templates would not solve my immediate issue. Until I package my own version of these

How to use pkg-config to link a library statically

99封情书 提交于 2019-11-30 04:37:17
问题 I'd like to link libpng found by pkg-config statically. pkg-config --libs --static libpng outputs -L/usr/local/Cellar/libpng/1.6.15/lib -lpng16 -lz I have both libpng16.a libpng16.dylib in that directory, and if I use these flags the library gets linked dynamically. How can I tell either pkg-config or the linker (preferably in some portable-ish way) that I really want it linked statically? I've tried adding -static before pkg-config's flags, but that makes clang's ld try and fail to link

C - Compile with dependencies included

自作多情 提交于 2019-11-30 04:11:09
问题 I have some code which I want to run on a machine which I do not have root access to. That machine does not have some of the libraries needed to run this code. Is there any way to include all dependencies when I compile? I realize the resultant file may be quite large. 回答1: What you're looking for is static compiling. Performing static compilation includes all of the libraries into the executable itself, so you don't have to worry as much about dependency chains on a specific system,