I am porting a large C++ library (libcoro.so) and example application (coro-example.cpp) from Windows to RedHat Linux 7.4. I have very little development experience on Linux, so this is probably a ‘newbie’ question. I have libcoro and the example app compiling, linking, and running on my RHEL 7.4 VM. However, the gcc linker fails to link the app on the
Tag: linker
g++ undefined reference error when linking to third party shared libraries
I’m trying to link a c++ program that uses several shared libraries from 3rd parties. Mainly, these libraries come from a github project called MBSim and I downloaded the latest daily build with all its binaries, libraries and headers, which I installed on /usr/local/mbsim-env. The most important libraries called are libmbsim, libopenmbvcppinterface, libfmatvec and libboost_filesystem (the last one comes with
g++ can’t link curl lib files
I’m having some issues with getting g++ to link the curl lib files. I’m using Visual Studio 2017 with the linux dev plugin and Ubuntu Server 17.04. curl-config –libs gave an output of -Lcurl which I tried adding to the linker options in Project settings > Linker > Command Line > Additional options. I also added the –cflags output to
Can I get symbol names from one .so and make another .so see it?
I’ve built zlib and libpng separately (what are these libs doesn’t matter), so I’ve got libz.so and libpng.so now. With dlopen() and dlsym() I get function pointers from libpng.so and use them, but the problem is that, since libpng depends on zlib, I get linker errors when libpng function calls some zlib function inside itself. So my quiestion is: Is
ELF, Build-ID, is there a utility to recompute it?
I came across this useful feature in ELF binaries — Build ID. “It … is (normally) the SHA1 hash over all code sections in the ELF image.” One can read it with GNU utility: And I wonder if there is an easy way to recompute Build ID yourself? To check if it isn’t corrupted etc. Answer So, I’ve got an
CMake linking glfw3 lib error
i’m working with CLion, and I’m writing a program using the glfw3 lib.(http://www.glfw.org/docs/latest/) I installed and did everything correctly for the lib i have the .a and .h files in: I’m trying to use the library now, but i’m getting the linker error: undefined reference to ‘glViewport’ etc. etc. all the functions i’m using I added the lib path to
ld cannot recognize the options
I’am reading this Tuto, and I’am trying to link the application using this command: ld test.o –o test.bin, the linker doesn’t recognize the -o option : Using ld -help the option -o exist but i don’t understand why I’am getting this problem. This is the linker version. Answer My good eyes and my bitter experience tell me that you must
How can gcc/clang assume a string constant’s address is 32-bit?
If I compile this program: for x86-64, the asm output uses movl $.LC0, %edi / call puts. (See full asm output / compile options on godbolt.) My question is: How can GCC know that the the string’s address can fit in a 32bit immediate operand? Why doesn’t it need to use movabs $.LC0, %rdi (i.e. a mov r64, imm64, not
Linking error “undefined reference” about boost static library during compiling
I am trying to compile my C++ project on Linux x64 with boost libraries 1.57. This project is compiled with scons and I successfully compiled it on my Arch Linux, but this time failed on a Ubuntu machine. I added -lboost_coroutine flag for linking but the error “undefined reference” still existed. I noticed that the attributes.hpp is exactly one of
What are the recommended GNU linker options to specify $ORIGIN in RPATH?
Assume my platform is vanilla (non-embedded) x86-64 Linux using GNU build toolchain (GCC, etc.). To specify $ORIGIN in RPATH, I know about the linker option: -Wl,-rpath,’$$ORIGIN’. Today, I discovered another option: -Wl,-z,origin. Should I always include -Wl,-z,origin when using -Wl,-rpath,’$$ORIGIN’? Official GNU ld docs, say: Marks the object may contain $ORIGIN. Related, but different: https://stackoverflow.com/questions/33853271/what-are-the-recommended-gnu-linker-options-to-specify-rpath Answer I know about the