rpath

What are the recommended GNU linker options to specify $ORIGIN in RPATH?

♀尐吖头ヾ 提交于 2021-01-27 12:10:36
问题 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

Cmake: How to set rpath to ${ORIGIN} with cmake

跟風遠走 提交于 2020-02-06 07:30:24
问题 According to this SO question, Linux executable can't find shared library in same folder passing -Wl,-rpath,${ORIGIN} is the way to get a Linux executable to search for .so s in the same directory as the executable. We're using cmake, so I'm adding a line of the form target_link_options(Executable PRIVATE -Wl,-rpath=${ORIGIN}) to CMakeLists.txt. The problem with that is that cmake tries to interpret the nine character sequence ${ORIGIN} as a variable, and replaces it with nothing. So far, I

CMake, RPATH, $ORIGIN and @loader_path

本小妞迷上赌 提交于 2020-02-05 07:37:25
问题 In my CMake project I build a bunch of libraries that are loaded at runtime as plugins. I therefore need to set various RPATHs so that these libraries can be found by the dynamic loading mechanism. I also need the whole thing to be relocatable, because it is part of a Python extension module and so gets copied around by various tools during the build process. It seems that the proper way to do this is to set the RPATH in a relative fashion by using the special $ORIGIN variable on Linux, and

@rpath for a dynamic library embedded in a framework

喜欢而已 提交于 2020-01-22 14:27:05
问题 I have an app, call it Animal.app . Inside its Contents/Frameworks folder is a framework, say Mammal.framework . And inside the Versions/A/Frameworks folder of the framework, I have dog.dylib . The install name of dog.dylib is @rpath/dog.dylib. For the "Runpath Search Paths" setting of the framework, I have specified @loader_path/../Frameworks . (My reasoning for that last setting is that the "loader" of the dylib would be the binary of the framework, at the path Mammal.framework/Versions/A

Compiling Python 2.6.6 and need for external packages wxPython, setuptools, etc… in Ubuntu

耗尽温柔 提交于 2020-01-20 07:13:41
问题 I compiled Python 2.6.6 with google-perf tools (tcmalloc) library to eliminate some of the memory issues I was having with the default 2.6.5. After getting 2.6.6 going it seems to not work becuase I think having issues with the default 2.6.5 install in Ubuntu. Will none of the binaries installed from the software channel like wxPython and setuptools work properly with 2.6.6. Do these need to be recompiled? Any other suggestions to get it working smoothly. Can I still set 2.6.5 as default

Compiling Python 2.6.6 and need for external packages wxPython, setuptools, etc… in Ubuntu

独自空忆成欢 提交于 2020-01-20 07:13:26
问题 I compiled Python 2.6.6 with google-perf tools (tcmalloc) library to eliminate some of the memory issues I was having with the default 2.6.5. After getting 2.6.6 going it seems to not work becuase I think having issues with the default 2.6.5 install in Ubuntu. Will none of the binaries installed from the software channel like wxPython and setuptools work properly with 2.6.6. Do these need to be recompiled? Any other suggestions to get it working smoothly. Can I still set 2.6.5 as default

“Illegal instruction” when run precompiled program on other machine

三世轮回 提交于 2020-01-07 08:42:35
问题 I have to build my program on CentOS 7 and deploy on other Linux machine. The program required newer version glibc , and some library which was not (and will not be) installed on target machine. So I decided to ship the executable with dynamic library. I used patchelf to patch interpreter and rpath . I tested the executable on my machine and it work (also checked with ldd to make sure new rpath is used). But when I copy to other machine with libs, the program is failed to run. Only this line

MacOSX: which dynamic libraries linked by binary?

你说的曾经没有我的故事 提交于 2019-12-30 08:23:37
问题 I have not been able to figure out why my binary is not loading. It is a dylib loaded by MATLAB (MEX-file), and links to quite a few dylibs in different locations. MATLAB tells me it cannot load the MEX-file, but I cannot figure out which of its dependencies it cannot find. Does anybody have any suggestions for how to debug something like this? On Linux, ldd is the perfect tool to debug this problem. People keep saying that otool -L is the MacOS equivalent to the Linux ldd , but this is not

Setting RPATH order in QMake

倾然丶 夕夏残阳落幕 提交于 2019-12-30 03:11:15
问题 I have a Linux Qt program. I'd like it to preferentially use the (dynamic) Qt libraries in the executable's directory if they exist, otherwise use the system's Qt libs. RPATH to the rescue. I add this line to the qmake 's .pro file: QMAKE_LFLAGS += '-Wl,-rpath,\'\$$ORIGIN\'' and looking at the resulting executable with readelf I see: 0x000000000000000f (RPATH) Library rpath: [$ORIGIN:/usr/local/Trolltech/Qt-5.2.0/lib] 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN:/usr/local/Trolltech

Build OpenSSL with RPATH?

主宰稳场 提交于 2019-12-27 12:11:31
问题 I have Ubuntu 14.04. It came with openssl 1.0.1f. I want to install another openssl version (1.0.2) and I want to compile it by myself. I configure it as follows: LDFLAGS='-Wl,--export-dynamic -L/home/myhome/programs/openssl/i/lib -L/home/myhome/programs/zlib/i/lib' CPPFLAGS='-I/home/myhome/programs/openssl/i/include -I/home/myhome/programs/zlib/i/include' ./config --prefix=/home/myhome/programs/openssl/i \ zlib-dynamic shared --with-zlib-lib=/home/myhome/programs/zlib/i/lib \ --with-zlib