linker

What does Boost mean by “header-only libraries” and “automatic linking”?

情到浓时终转凉″ 提交于 2019-12-30 02:51:21
问题 On the Boost library documentation page, there are two categories named " Header Only Libraries " and " Automatic Linking ". I suppose "Header Only Libraries" means you don't have to link against Boost libraries in order to use them, and "Automatic Linking" means you have to link. But when I use Boost.Timer , I have to link a static or dynamic library named timer ( libboost_timer.a and libboost_timer.so.1.48.0 and various soft links to these under Linux library path), which is apparently the

Is there any way to change the SONAME of a binary directly?

荒凉一梦 提交于 2019-12-30 02:10:40
问题 My program depends on libcurl.so.3 , but in RHEL6 there is no symbolic link libcurl.so.3 ⇾ libcurl.so.4 (my program can run smoothly when I create this link). However, there is symbolic link libcurl.so ⇾ libcurl.so.4 . I would like to modify the SONAME embedded in libcurl.so.3.0.0.0 file from libcurl.so.3 to libcurl.so so that I could run my program on RHEL 6 without creating a symbolic link. My solution could not be optimal but I think learning how to modify the binary directly is valuable.

Is there any way to change the SONAME of a binary directly?

烂漫一生 提交于 2019-12-30 02:10:25
问题 My program depends on libcurl.so.3 , but in RHEL6 there is no symbolic link libcurl.so.3 ⇾ libcurl.so.4 (my program can run smoothly when I create this link). However, there is symbolic link libcurl.so ⇾ libcurl.so.4 . I would like to modify the SONAME embedded in libcurl.so.3.0.0.0 file from libcurl.so.3 to libcurl.so so that I could run my program on RHEL 6 without creating a symbolic link. My solution could not be optimal but I think learning how to modify the binary directly is valuable.

gcc shared library failed linking to glibc

六眼飞鱼酱① 提交于 2019-12-30 01:23:05
问题 I'm writing a simple C shared library using Eclipse CDT under Linux 64bit. The code has one reference to the rand() function in the <stdlib.h> It compiles fine but when linking it reports the following error from the linker: gcc -shared -o "libalg.so" ./sort.o /usr/bin/ld: ./sort.o: relocation R_X86_64_PC32 against undefined symbol `rand@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value sort.o is the object file compiled

handling dependencies for iOS Framework project

吃可爱长大的小学妹 提交于 2019-12-30 00:07:11
问题 I've created iOS Framework project using this method: https://github.com/jverkoey/iOS-Framework Works pretty neat but I'm a little confused on how to include libraries/frameworks that are needed by my framework to work and, in particular, how to do it so that in case 3rd party client app that uses my framework can include these libs as well without conflicts. Let's say my framework code needs these two things: FacebookSDK.framework libFlurry.a The first one is an iOS Framework. When I add it

How to statically-link a complex program

夙愿已清 提交于 2019-12-29 14:16:14
问题 In Linux, downloaded a program source and want it to be statically linked. Have a huge Makefile there, I ./configure make to compile. prehpes it's a bit too general to ask, but how can I make the binary statically linked? EDIT: the reason for this is wanting to make sure the binary will have no dependencies (or at least as few as possible), making it possible to run on any Linux based computer, even one without Internet connection, and non-updated Linux. 回答1: Most autoconf generated configure

Multiple Defined Symbols C++ error

久未见 提交于 2019-12-29 06:22:10
问题 I thought ifndef something #define something body #endif solved this error, so I'm not sure why this is happening. //Library.h #ifndef __LIBRARY__ #define __LIBRARY__ #include <iostream> #include <string> #include <cstring> #include <cmath> #include <cstdio> #include <cstdarg> #include <vector> #include <ctime> #include <cmath> #include <cstdlib> //file includes #include "Globals.h" using namespace std; #endif //__LIBRARY__ -- //globals.h //global variables #ifndef __GLOBAL__ #define __GLOBAL

What is the difference between .LIB and .OBJ files? (Visual Studio C++)

坚强是说给别人听的谎言 提交于 2019-12-29 04:30:09
问题 I know .OBJ is the result of compiling a unit of compilation and .LIB is a static library that can be created from several .OBJ, but this difference seems to be only in the number of units of compilation. Is there any other difference? Is it the same or different file format? I have come to this question when wondering if the same static variable defined in two (or more) .LIBs is merged or not during linking into the final executable. For .OBJs the variables are merged. But is it the same in

What does a compiled C++ class look like?

柔情痞子 提交于 2019-12-29 04:23:14
问题 With some background in assemble instructions and C programs, I can visualize how a compiled function would look like, but it's funny I have never so carefully thought about how a compiled C++ class would look like. bash$ cat class.cpp #include<iostream> class Base { int i; float f; }; bash$ g++ -c class.cpp I ran: bash$objdump -d class.o bash$readelf -a class.o but what I get is hard for me to understand. Could somebody please explain me or suggest some good starting points. 回答1: The classes

Does a function with instructions before the entry-point label cause problems for anything (linking)?

偶尔善良 提交于 2019-12-29 01:48:27
问题 This is really a linker / object-file question, but tagging with assembly since compilers never do this. (Although maybe they could!) Consider this function, where I want to handle one special case with a block of code that's in the same I-cache line as the function entry-point. To avoid jumping over it in the usual fast-path, is it safe (wrt. linking / shared libraries / other tools I haven't thought of) to put the code for it ahead of the function's global symbol? I know this is silly /