static-linking

Difference between linking OpenMP with -fopenmp and -lgomp

只谈情不闲聊 提交于 2019-12-03 06:41:25
I've been struggling a weird problem the last few days. We create some libraries using GCC 4.8 which link some of their dependencies statically - eg. log4cplus or boost. For these libraries we have created Python bindings using boost-python. Every time such a library used TLS (like log4cplus does in it's static initialization or stdlibc++ does when throwing an exception - not only during initialization phase) the whole thing crashed in a segfault - and every time the address of the thread local variable has been 0. I tried everything like recompiling, ensuring -fPIC is used, ensuring -tls

How do I tell cmake I want my project to link libraries statically?

女生的网名这么多〃 提交于 2019-12-03 06:38:43
问题 I'm trying to build an OpenCV-based project using CMake, running on Linux. So far my CMakeLists.txt files looks something like FIND_PACKAGE (OpenCV REQUIRED) ... TARGET_LINK_LIBRARIES (my-executable ${OpenCV_LIBS}) but this results in dynamically linked libraries. How do I link with static libraries? 回答1: You build static OpenCV libraries by just setting the BUILD_SHARED_LIBS flag to false in CMake. Then all you need to do to build your own application with those static libraries is to add a

CMake: Linking statically against libgcc and libstdc++ into a shared library

喜夏-厌秋 提交于 2019-12-03 06:08:08
Problem: I am having difficulties linking glibcc/glibc++ into a shared library using CMake and GCC4.9 on my Ubuntu 16.04 installation. Additional conditions: Loading the shared library gives a problem om the Red Hat production environment(where I copy it to), I believe because it uses a different libstc++ version(error: GLIBCXX_3_4_20 not found). I do not have sudo rights and cannot upgrade the machine. As I derived from this blog, this post , I tried linking static linking against libgcc and libgc++ using: set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static") and againg using

How to insert a LC_LOAD_DYLIB command into a Mach-O binary or join a static library to an existing binary (IOS)

落爺英雄遲暮 提交于 2019-12-03 05:11:56
问题 This is the first time I am asking on stackoverflow and I am desperate. My task is to load a dylib or join a static lib to an already existing executable for an IOS device. I will be using the static void __attribute__((constructor)) initialize(void) to start the swizzling. This executable is for in house enterprise appstore so i do not need to go thru the apple appstore (since they will reject it). The reason for this is to take an existing IPA from a customer and their signing keys and add

Why would it be impossible to fully statically link an application?

感情迁移 提交于 2019-12-03 05:07:01
问题 I'm trying to compile a statically linked binary with GCC and I'm getting warning messages like: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking I don't even know what getwnam_r does, but I assume it's getting called from inside some higher level API. I receive a similar message for gethostbyname . Why would it not be possible to just statically link these functions in like every other function? 回答1

Linking a Static C Library in Xcode 7?

一笑奈何 提交于 2019-12-03 03:47:38
I'm currently trying to link a static C library I've created to a fresh Xcode project. To link it, I followed the following instructions: 1) Navigate to Build Phases 2) Expand Link Binaries With Library 3) Added an "other" library, and then specified the .a file in question. Unfortunately, the project won't compile and throws the following error: ld: library not found for -ltxht I'm not sure exactly what to make of this. The library seems to appear okay in the project as a project file, and I can't find any indication that there is anything wrong with that. I've tried setting it's location to

openCV 243 using static libs error LNK2019

早过忘川 提交于 2019-12-03 03:21:49
I'm trying to use openCV243 static libs in 64bit vs10 console application. My OS is win7 64 bit. I've included following libs: #pragma comment(lib,"../final_test/libs/staticlib/opencv_core243.lib") #pragma comment(lib,"../final_test/libs/staticlib/opencv_highgui243.lib") #pragma comment(lib,"../final_test/libs/staticlib/opencv_imgproc243.lib") #pragma comment(lib,"../final_test/libs/staticlib/opencv_video243d.lib") #pragma comment(lib,"../final_test/libs/staticlib/opencv_flann243.lib") #pragma comment(lib,"../final_test/libs/staticlib/opencv_features2d243.lib") #pragma comment(lib,"../final

MinGW creating dll.a files ? What type of library files are those?

江枫思渺然 提交于 2019-12-03 02:43:38
I am fairly familiar with Windows and Linux libraries compilation but as for today when I have seen MinGW on my Windows machine threw out dll.a and .a files after OpenCV compilation I have started to seriously start thinking. These are my \lib output from OpenCV compilation : 2012-12-21 23:35 1 338 420 libopencv_core243.dll.a 2012-12-21 23:33 224 994 libopencv_core_pch_dephelp.a 2012-12-21 23:38 830 820 libopencv_features2d243.dll.a And my \bin output : 2012-12-21 23:40 356 178 libopencv_perf_core.dll.a 2012-12-21 23:45 362 702 libopencv_perf_features2d.dll.a 2012-12-21 23:35 4 086 052

Linking library without a header file?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 23:48:35
I'm attempting to link a static library in C++ using Visual Studio 2010. Trouble is, the library (and accompanying header ) have a lot of MFC objects in them. I would like to call one of the library's functions without recompiling my project to include MFC, or recompiling the library to not use MFC. This codeproject article seems to imply that this is possible if I define the function to be external in my project (using the "extern" keyword). However, I've had no luck. No matter what I try, I get an unresolved external symbol error. Is the article correct? And if not, is such linkage possible

Trying to statically link Boost

早过忘川 提交于 2019-12-02 23:13:04
I am working in Linux, Eclipse CDT, g++, with Boost library. Having existing program which uses Boost thread, I try to link it statically instead of dynamically. /usr/local/lib directory contains the following files: libbost_thread.a libbost_thread.so libbost_thread.1.41.0 Dynamic linking works: g++ -o"MyProgram" ./main.o -lboost_thread Static linking: g++ -static -o"MyProgram" ./main.o -lboost_thread produces huge number of messages like: undefined reference to `pthread_mutex_init' How can I link statically to the Boost library? For pthread_mutex_init, you want to compile/link with -pthread