rpath

Cmake not setting RPATH when adding link_library with -L

会有一股神秘感。 提交于 2019-12-05 00:19:03
问题 When setting link libraries in the following manner target_link_libraries (SOME_TARGET -L/somedir -lfoo) cmake doesn't handle RPATHs. Is using '-L' and '-l' not best practice, or actually plain wrong? When creating my own Find*.cmake I usually use find_library() but the find script I got doesn't do this and resorts to the above form using '-L' and '-l'. The documentation doesn't really explain how RPATHs are gathered, also the documentation isn't really clear how it handles "-l" and "-L" the

Using -rpath and $ORIGIN with libtool-based projects?

守給你的承諾、 提交于 2019-12-04 11:30:59
I am trying to incorporate a libtool-based package into a project of my own, perhaps in a non-standard way. Here is my goal: Build external project: ./configure --prefix=$HOME/blah --etcetera && make && make install Build my own project which depends upon the external project's shared libraries and executables at runtime: gcc -I$HOME/blah/include -L$HOME/blah/lib -o $HOME/blah/bin/program Package everything into a single "localized" tarball... that is, while I have everything in $HOME/blah on the build host I want the ability to extract the tarball to any arbitrary directory (on some other

Cmake not setting RPATH when adding link_library with -L

假如想象 提交于 2019-12-04 11:15:44
When setting link libraries in the following manner target_link_libraries (SOME_TARGET -L/somedir -lfoo) cmake doesn't handle RPATHs. Is using '-L' and '-l' not best practice, or actually plain wrong? When creating my own Find*.cmake I usually use find_library() but the find script I got doesn't do this and resorts to the above form using '-L' and '-l'. The documentation doesn't really explain how RPATHs are gathered, also the documentation isn't really clear how it handles "-l" and "-L" the only pointer you get is "Item names starting with -, but not -l or -framework, are treated as linker

@rpath for a dynamic library embedded in a framework

北城余情 提交于 2019-12-03 12:33:56
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/Mammal .) I get an error message at runtime: Dyld Error Message: Library not loaded: @rpath/dog.dylib

Linking is jacked up.. what is -rpath? MacOS X

情到浓时终转凉″ 提交于 2019-12-01 18:20:32
So, I'm building a project, and it uses functions from a compiled library (.dylib or .so). I have the headers and the library files (this is all part of QtRoot, btw) in appropriate locations, but when I try to build my project in Xcode, I get a debugger error: dyld: Library not loaded: @rpath/libRIO.so Referenced from: /Users/paulthompson/Documents/Programming/Build Products/Debug/MacHeliosSim.app/Contents/MacOS/MacHeliosSim Reason: image not found sharedlibrary apply-load-rules all Data Formatters temporarily unavailable, will re-try after a 'continue'. (Cannot call into the loader at present

Linking is jacked up.. what is -rpath? MacOS X

北慕城南 提交于 2019-12-01 18:13:20
问题 So, I'm building a project, and it uses functions from a compiled library (.dylib or .so). I have the headers and the library files (this is all part of QtRoot, btw) in appropriate locations, but when I try to build my project in Xcode, I get a debugger error: dyld: Library not loaded: @rpath/libRIO.so Referenced from: /Users/paulthompson/Documents/Programming/Build Products/Debug/MacHeliosSim.app/Contents/MacOS/MacHeliosSim Reason: image not found sharedlibrary apply-load-rules all Data

How to specify RPATH in a makefile?

淺唱寂寞╮ 提交于 2019-11-30 11:06:37
问题 I'm trying to specify rpath in my binary. My makefile looks like this- CC=gcc CFLAGS=-Wall LDFLAGS= -rpath='../libs/' main: main.c gcc -o main main.c clean: rm -f main main.o But when I query rpath using command readelf -a ./main | grep rpath I get nothing I've tried specifying rpath as LDFLAGS= "-rpath=../libs/" but even that doesn't seem to work. Can someone please post an example on how should I specify rpath in a makefile? GCC and ld versions are- gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

shared library locations for matlab mex files:

家住魔仙堡 提交于 2019-11-30 08:56:46
I am trying to write a matlab mex function which uses libhdf5; My Linux install provides libhdf5-1.8 shared libraries and headers. However, my version of Matlab, r2007b, provides a libhdf5.so from the 1.6 release. (Matlab .mat files bootstrap hdf5, evidently). When I compile the mex, it segfaults in Matlab. If I downgrade my version of libhdf5 to 1.6 (not a long-term option), the code compiles and runs fine. question: how do I solve this problem? how do I tell the mex compilation process to link against /usr/lib64/libhdf5.so.6 instead of /opt/matlab/bin/glnxa64/libhdf5.so.0 ? When I try to do

Building a simple (hello-world-esque) example of using ld's option -rpath with $ORIGIN

[亡魂溺海] 提交于 2019-11-30 06:46:46
问题 Note: Full working example now below. Original question follows: I'm having problems using ld's -rpath parameter with $ORIGIN . As I couldn't find a complete example, I thought I'd try to write one myself, so that I and others can use it later. Once I get it working I'll tidy it up. I asked about this before, but I think my post was a bit confusing. The example project builds one shared library and one executable that links to said library. It's very small (3 files, 22 lines incl buildscript)

How to get RPATH with $ORIGIN to work on Code::Blocks GCC?

帅比萌擦擦* 提交于 2019-11-30 01:54:40
I'm trying to link an RPATH containing the special string $ORIGIN into an executable built using GCC with the Code::Blocks IDE. I've specified -Wl,-R$ORIGIN in the linker options for the project, but the command line output to GCC is wrong (stripped for clarity): g++ -Wl,-R What is the correct way to specify this argument for Code::Blocks? Whoever decided to make the token $ORIGIN is an evil bastard who deserves a special place in programmer hell. Since '$' is a special character for bash and other scripting languages like make, it screws everything up unless carefully escaped. Even worse,