static-linking

Linking partially static and partially dynamic in GCC

霸气de小男生 提交于 2019-12-22 10:19:02
问题 I'm trying to compile a very simple (as simple as hello world) C program using both dynamic and static linking with GCC. I want to know how to do this in general, so my minimal test example is simply trying to link libc as static and libm dynamically. I've come across at least the following other questions regarding the same topic: GCC: static linking only some libraries Static link of shared library function in gcc Some of the answers therein suggest things such as using -Wl,-Bstatic and -Wl

Linking with static library not equivalent to linking with its objects

孤人 提交于 2019-12-21 20:36:05
问题 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

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

允我心安 提交于 2019-12-21 10:42:20
问题 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

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

安稳与你 提交于 2019-12-21 09:19:00
问题 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

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

时光总嘲笑我的痴心妄想 提交于 2019-12-21 09:18:15
问题 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

PyInstaller; “could not find or load the Qt platform plugin ”windows"

谁说胖子不能爱 提交于 2019-12-21 04:49:06
问题 My PyInstaller spec: # -*- mode: python -*- block_cipher = None a = Analysis(['test.py'], pathex=['C:\\Users\\admin\\compile'], binaries=[('C:\\Python361\\Lib\\site-packages\\PyQt5\\Qt\\plugins\\platforms\\qwindows.dll', 'qwindows.dll')], datas=[], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles,

Size of a library and the executable

隐身守侯 提交于 2019-12-21 04:09:04
问题 I have a static library *.lib created using MSVC on windows. The size of library is say 70KB. Then I have an application which links this library. But now the size of the final executable (*.exe) is 29KB, less than the library. What i want to know is : Since the library is statically linked, I was thinking it should add directly to the executable size and the final exe size should be more than that? Does windows exe format also do some compression of the binary data? How is it for linux

Compiling C++ into portable linux binaries

青春壹個敷衍的年華 提交于 2019-12-21 03:53:14
问题 Ok, this question is about portable as in no dependencies (i.e. "I can put the binaries in a USB key and bring it with me everywhere, e-mail them to friends etc"). I have heard of static linking but I'm confused to what are exactly the consequences of it; what can and what can't be static linked (i.e. what about Qt, OpenGL, libstdc++?) and to which degree the binary will be "portable" afterwards. I've also heard of LSB (Linux Standard Base) but I don't know exactly what it is or if it can

Trying to statically link Boost

删除回忆录丶 提交于 2019-12-20 10:33:41
问题 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

linking to a static 0MQ library in VS

眉间皱痕 提交于 2019-12-20 09:38:39
问题 This may be a Visual Studio question more than anything else... I'm trying to build a 0MQ C++ example using VS10 and ZeroMQ 2.2.0. I downloaded the windows sources and tried to follow these instructions in order to build 0MQ statically. Specifically: Switched to Release For all 7 projects in the solution: set General\Configuration Type to Static library (.lib) set C/C++\Code Generation\Runtime Library to Multi-threaded (/MT) added ZMQ_STATIC to C/C++\Preprocessor\Preprocessor Definitions