static-linking

How to generate statically linked executables?

耗尽温柔 提交于 2019-12-20 09:33:31
问题 I am trying to create a static executable with Rust. I am not trying to statically link a particular library, I am trying to create a executable which does not use dynamic linking at all . I have the following (otherwise working) test: $ cat hello.rs fn main() { print!("Hello, world!\n"); } $ rustc hello.rs -o hello $ file hello hello: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, [etc] Note the dynamically linked,

Boost autolinks libraries which are not built by Boost, but the intended ones are built

断了今生、忘了曾经 提交于 2019-12-20 02:15:46
问题 I am developing a Math application which can be extended by writing python scripts. I am using Qt 4.6.3 (built as static library, debug and release versions) and Boost 1.43.0 (built as static library, runtime-link also set to static, multi-threaded version, debug and release). Everything is built with MSVC++2008. Boost built the following libraries: libboost_python-vc90-mt-s-1_43.lib libboost_python-vc90-mt-s.lib libboost_python-vc90-mt-sgd-1_43.lib libboost_python-vc90-mt-sgd.lib My project

Static linking to lib and still requesting DLL

旧时模样 提交于 2019-12-19 21:46:52
问题 Using visual studio 2008, I have an .H and a .LIB file of a library. I wrote a program and referenced the LIB via the project properties. It compiles fine, but when it runs, it asks for the DLL to be installed. If the DLL is in the same dir as the EXE it works but, if I have the LIB , doesn't it already mean the functions are statically linked to my program? 回答1: Not all lib files are static libraries. Some are import libraries, and chances are, that's what you linked with. If your lib file

Rewriting symbols in static iOS libraries

偶尔善良 提交于 2019-12-19 10:07:03
问题 I am working on an iOS app which links several static libraries. The challenge is, those linked libraries define same method names with different implementations. Oddly, I don't get any duplicate symbol definition errors; but, to no surprise, I end up with access to only one implementation of the method. To be more clear, say I have libA and libB and they both define a global C method called func1() When I link both libA and libB, and make a call to func1(), it resolves to either libA's or

How to force use of static library over shared?

假装没事ソ 提交于 2019-12-18 19:06:26
问题 In my SConscript I have the following line: Program("xtest", Split("main.cpp"), LIBS="mylib fltk Xft Xinerama Xext X11 m") How do I get scons to use mylib.a instead of mylib.so, while linking dynamically with the other libraries? EDIT: Looking to use as few platform specific hacks as possible. 回答1: Passing the full filepath wrapped in a File node will force static linking. For example: lib = File('/usr/lib/libfoo.a') Program('bar', 'main.c', LIBS = [lib]) Will produce the following linker

C++ linking problems, seems like I can't link against standard C++ stuff

谁说我不能喝 提交于 2019-12-18 18:47:09
问题 I am trying to use a library I've compiled myself in an iOS app. The library is the Tesseract OCR lib. It seems like compiling that (and its dependencies) have gone ok. However, when I try to link against this lib in my app project, the app fails to link. The link errors surprise me; it seems like there are problems with the Tesseract stuff finding pretty standard C++ stuff. Any suggestions about what I might be doing wrong would be most helpful. Here is a snippet of the kind of link errors I

Trying to build static CGO executable with oracle libraries on Linux/Ubuntu

一世执手 提交于 2019-12-18 17:29:58
问题 I have already searched for some days, tried several suggestions but none helped. At the moment I just want to create a small Go snippet which connects to an Oracle Database. While everything works by using normal go build and invoking the resulting dynamic linked application, I am stuck when I try to run the static compiler. I already have build other projects statically (even with CGO) without problems, but here gcc is not finding the oracle library. Maybe someone has a hint? Error during

Static linking of Glibc

£可爱£侵袭症+ 提交于 2019-12-18 15:32:14
问题 How can i compile my app linking statically glibc library, but only the code needed for my app? (Not all lib) Now my compile command: g++ -o newserver test.cpp ... -lboost_system -lboost_thread -std=c++0x Thanks! 回答1: That's what -static does (as described in another answer): unneeded modules won't get linked into your program. But your expectations on the amount of stuff which is needed (in a sense that we can't convince linker to the contrary) may be too optimistic. If you trying to do it

VS2010 static linking issue

谁说胖子不能爱 提交于 2019-12-18 13:09:52
问题 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.

Is there a way to determine which version of Visual Studio was used to compile a static library?

≡放荡痞女 提交于 2019-12-18 10:27:49
问题 I have a collection of static libraries (.lib) files one of which may have been built with a different version of Visual Studio. This is causing the code generation of a project that links against all of them to fail. Is there any way to determine which version of Visual Studio was used to compile a static library? 回答1: For release libraries, it's unlikely that you could determine the version. For debug libraries, you can use dumpbin: dumpbin /rawdata:1 library.lib The assembly manifest