static-libraries

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

六月ゝ 毕业季﹏ 提交于 2019-12-23 05:16:01
问题 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

Link a program to a static library, linking itself to another library

99封情书 提交于 2019-12-23 03:31:58
问题 I'm trying to create a program (C++) that can read multiple file formats, on Windows (VS2015). In order to do that, I created a solution with a Project for MyProgram (which is the main program), and a project for MyLibrary (which contains several parser for different file formats). In MyProgram I create some parser objects based on the program input. Everything was working well. However, I tried to create a new file format parser (NiftiParser) that uses an external library, nifticlib, that I

Variable dissapears in binary which is available in static lib

拥有回忆 提交于 2019-12-23 03:27:30
问题 I have the problem mentioned. I create an object inside a static lib, it is there when I run nm on the static lib, but when i link the lib to a binary and run nm it has disappeared. I know this problem has been asked before, but I could not find any answers. It is important for me to be able to retain that variable in the binary because we are trying to implement version checks for static libs in a binary. Please help. Thank you. Example code follows: test.h #ifndef TEST_H #define TEST_H

Including external C library with Xcode

不羁岁月 提交于 2019-12-23 03:25:11
问题 I have a built C static library (the Antlr 3 C library). It is installed properly and works (i.e., I can run gcc -o parser lexer.c parser.c -lantlr3c just fine). In Xcode, however, I get an error. I've added -lantlr3c in the "other linker flags" build setting. ld: library not found for -lantlr3c Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1 Several other questions I've found here (1, 2, 3, 4) generally have answers targeting Xcode

configure.in: AM_DISABLE_SHARED doesn't change my Makefile

别来无恙 提交于 2019-12-23 01:10:50
问题 I'm extremely new to using Makefiles and autoconf. I'm using the Camellia image library and trying to statically link my code against their libraries. When I run "make" on the Camellia image library, I get libCamellia.a, .so, .la, and .so.0.0.0 files inside my /usr/local/lib directory. This is the command I use to compile my code with their libraries: gcc -L/usr/local/lib -lCamellia -o myprogram myprogram.c This works fine, but when I try to statically link, this is what I get: gcc -static -L

Why does including -fPIC to compile a static library cause a segmentation fault at run time?

匆匆过客 提交于 2019-12-22 18:35:07
问题 I'm compiling C++ static library with g++ and using the -fPIC option. I must use the -fPIC option because eventually this library will be linked with other static libraries to form a dynamic library. When I test the static library locally, it works completely fine when I don't include the -fPIC option. But as soon as I compile the library with -fPIC, I receive a segmentation fault error at run-time when calling one of the functions. What reasons could including -fPIC to compile a static

Why does including -fPIC to compile a static library cause a segmentation fault at run time?

半腔热情 提交于 2019-12-22 18:34:22
问题 I'm compiling C++ static library with g++ and using the -fPIC option. I must use the -fPIC option because eventually this library will be linked with other static libraries to form a dynamic library. When I test the static library locally, it works completely fine when I don't include the -fPIC option. But as soon as I compile the library with -fPIC, I receive a segmentation fault error at run-time when calling one of the functions. What reasons could including -fPIC to compile a static

Create a fully static Libcurl library

对着背影说爱祢 提交于 2019-12-22 10:58:32
问题 First I'll explain the big picture : I am creating an application where I separated most of the features in different libraries. One of them contains some classes that use curl. I actually use Ubuntu 64 bit to develop and test it, but my production environment is a NAS with an ARM processor. I intend to, later, also make it for windows. Where I am now : My application is running on linux and the ARM-based NAS. However, I don't link with curl, I use curl from command-line internally to do what

How to debug linker errors? Getting undefined reference errors when statically linking ICU

纵然是瞬间 提交于 2019-12-22 10:46:58
问题 I've built the static libraries for ICU 49 and 50 but when linking with either one of them I still get 667 linker errors like the ones below. How can I approach debugging this and figuring out what the problem is? The ICU support list has offered no help at all. clang++ -ccc-gcc-name g++ -Wl,-E -o velocity main.o city.o auto_lua.o obj_builder.o index.o obj.o str.o db.o datetime.o msg_parser.o task_scheduler.o gc.o global_settings.o transaction.o schema.o skip_node.o util.o thread_context.o

Obtaining older SDKROOT behavior in XCode

左心房为你撑大大i 提交于 2019-12-22 10:44:58
问题 I'm trying to setup a library for simulator or device building and everywhere I see explains that SDKROOT should expand to a /Developer/Platform/<>/SDKs/<>/, where <> is filled in by your project settings. Many links on the internet explain that SDKROOT will expand to a path, but the newer versions of XCode, SDKROOT expands to "iphoneos2.2.1" - which isn't nearly as helpful (for this task). Clearly enough if you look at apples documentation, the behavior changed: http://developer.apple.com