static-linking

Cython: Compile a Standalone Static Executable

无人久伴 提交于 2019-12-04 14:01:22
问题 I'm trying to compile an executable (ELF file) that does not use a dynamic loader. I used Cython to compile Python to C: cython3 -3 test.py --embed Then gcc test.c -otest $(pkg-config --libs --cflags python3) to compile C generated file. Now I'd like to compile test.c in a static executable. Usually I use -static flag, but here it return collect2: error: ld returned 1 exit status . How can I do? EDIT 1: Not the full messge becouse body is limited to 30000 chars a long list of warnings and

Linking with static library not equivalent to linking with its objects

核能气质少年 提交于 2019-12-04 12:58:44
Problem: The firmware image generated when linking with a static library is different to the firmware image generated when linking with the objects directly extracted from the static library. Both firmware images link without error and load successfully onto the microcontroller. The latter binary (linked with objects) executes successfully and as expected, while the former (linked to the static library) does not. The only warnings during compilation are unused-but-set-variable in the manufacturer-supplied HAL, which due to various macro definitions are not necessary for the compiled

CMake failing to statically link SDL2

◇◆丶佛笑我妖孽 提交于 2019-12-04 10:12:42
I'm trying to build a simple SDL2 game with CMake and MSYS Makefiles. I want to statically link SDL2 so I can distribute a single executable without having to include the SDL2.dll. Here's my CMakeLists.txt file: project(racer-sdl) cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_EXE_LINKER_FLAGS "-static") include(FindPkgConfig) pkg_search_module(SDL2 sdl2) if (SDL2_FOUND) message(STATUS "Using SDL2") add_definitions(-DUSE_SDL2) include_directories(${SDL2_INCLUDE_DIRS}) link_directories(${SDL2_LIBRARY_DIRS}) link_libraries(${SDL2_LIBRARIES})

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

萝らか妹 提交于 2019-12-04 08:59:09
问题 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

Linking static libraries with c++/cmake

回眸只為那壹抹淺笑 提交于 2019-12-04 05:56:42
问题 I try to link libraries in my program using firebreath framework. So I add this code in projectDef.cmake. include_directories(/usr/include/giblib) include_directories(/usr/include/X11) add_library(giblib_ptm STATIC IMPORTED) set_property(TARGET giblib_ptm PROPERTY IMPORTED_LOCATION /usr/lib/libgiblib.a) add_library(X11_ptm STATIC IMPORTED) set_property(TARGET X11_ptm PROPERTY IMPORTED_LOCATION /usr/lib/i386-linux-gnu/libX11.a) add_library(Imlib_ptm STATIC IMPORTED) set_property(TARGET Imlib

g++ including boost library

给你一囗甜甜゛ 提交于 2019-12-04 05:23:37
i builded my boost library with bjam, and then moved all the .a files into c:\Server\libs\boost_1_46_0\lib if i want to compile my program there is some error: the compile command g++ -Ic:\Server\libs\boost_1_46_0\ -Lc:\Server\libs\boost_1_46_0\lib\ -lboost_thread-mgw45-mt-1_46 -o try1 try1.cpp the errors C:\Users\FEHERG~1\AppData\Local\Temp\ccB46To7.o:try1.cpp:(.text+0xe9): undefined reference to `_imp___ZN5boost6thread4joinEv' C:\Users\FEHERG~1\AppData\Local\Temp\ccB46To7.o:try1.cpp:(.text+0x120): undefine d reference to `_imp___ZN5boost6threadD1Ev' C:\Users\FEHERG~1\AppData\Local\Temp

Segmentation fault in std::thread::id's std::operator==

被刻印的时光 ゝ 提交于 2019-12-04 04:58:40
I have encountered an issue which I am not sure how to resolve. I believe it's an issue in GCC and/or libstdc++. I am running Ubuntu 14.04 LTS with GCC 4.8.2-19ubuntu1, libstdc++3.4.19 (I believe? How do you find what version of libstdc++ library is installed on your linux machine? ), and boost 1.55. Here's the code: // http://www.boost.org/doc/libs/1_54_0/libs/log/doc/html/log/tutorial.html // with a slight modification to ensure we're testing with threads too // g++ -g -O0 --std=c++11 staticlinktest.cpp -lboost_log_setup -lboost_log -lboost_system -lboost_filesystem -lboost_thread -lpthread

Statically linking against library built with different version of C Runtime Library, ok or bad?

≯℡__Kan透↙ 提交于 2019-12-04 02:58:01
Consider this scenario: An application links to 3rd party library A. A is built using MSVC 2008 and is statically linking (ie. built with /MT) to the C Runtime Library v9.0. The application is built using MSVC 2005 and is statically linking to A and (using /MT) to the C Runtime Library v8.0. I can see trouble with this - for instance if types are changed in the headers between runtime library versions. Is care taken to keep the runtime library headers compatible between versions, or should one always make sure all statically linked libraries are linking to the same version of the runtime

Linking against boost barfs with 'undefined reference to `boost::system::get_system_category()'

我的梦境 提交于 2019-12-04 02:13:18
I'm having trouble statically linking an app which uses the boost 1.35 libraries. I'm using a linux debian Lenny box, with G++ 4.3.2. Linking without -static works without a hitch. Specifically, g++ -Wall -Wextra -pedantic -ggdb3 -O0 -static -l boost_thread-mt -lboost_system-mt -lboost_program_options-mt -lssl -lpthread -l crypto main.o comandos.o utils.o tunnel.o opciones.o decode.o sysutils.o -o sapp main.o: In function `__static_initialization_and_destruction_0': /usr/include/boost/system/error_code.hpp:204:undefined reference to `boost::system::get_system_category()' /usr/include/boost

Static libpng link with visual studio 2010

主宰稳场 提交于 2019-12-03 21:04:48
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've had this problem before and it usually means a dll dependency is wrong. Now... libpng compiled both