qno / conan-rtaudio

A conan recipe for RtAudio.
1 stars 1 forks source link

Wrong library location in application executable #5

Closed izzyreal closed 5 years ago

izzyreal commented 5 years ago

On MacOS I have the issue that the executable, when inspecting with a hex editor, contains /Users/vsts/.conan/data/RtAudio/master/qno/testing/package/f51350faf9be5480f35c35c17122e2cb6bfb617f/lib/librtaudio.6.dylib

I have never heard of user vsts, nor should the application try to find that library in a user directory. image

qno commented 5 years ago

Hi,

I think this is maybe some sort of RPATH information and added during CI build on Azure. vsts is the user of the MacoOS VM. So if you strip after compiling libs and binaries this information will just be removed. So if I look at an executable linked against this lib on my Linux, it shows the RPATH is pointing to the local conan cache. Could you take a look with readelf -d YOUR_BINARY | less (if this is available on a Mac)? You should see then something like this:

 0x000000000000000f (RPATH)              Library rpath: [/home/silvio/.conan/data/OSDialog/master/qno/testing/package/3ae6769b6d7a0bea12b51d821c046d5f4d7c7298/lib:/home/silvio/.conan/data/SpeexDSP/1.2rc3/qno/testing/package/3ae6769b6d7a0bea12b51d821c046d5f4d7c7298/lib:/home/silvio/.conan/data/RtAudio/5.1.0/qno/testing/package/3ae6769b6d7a0bea12b51d821c046d5f4d7c7298/lib:/home/silvio/.conan/data/RtMidi/4.0.0/test/test/package/3ae6769b6d7a0bea12b51d821c046d5f4d7c7298/lib:/home/silvio/.conan/data/Pffft/default/qno/testing/package/3ae6769b6d7a0bea12b51d821c046d5f4d7c7298/lib:/home/silvio/.conan/data/jansson/2.11/bincrafters/stable/package/72e3b2c6621594280ea9039918441fc92a9496ce/lib:/home/silvio/.conan/data/libcurl/7.61.1/bincrafters/stable/package/1de234fbf78c69709a34bde78271cc0e05c5ff62/lib:/home/silvio/.conan/data/libzip/1.5.1/bincrafters/stable/package/a8437e7e93e4fa917ebc4ad4f7b65cdfd0db84db/lib:/home/silvio/.conan/data/OpenSSL/1.0.2r/conan/stable/package/edd739da78d61e9baceceb22f58958d56e2ea73e/lib:/home/silvio/.conan/data/NanoVG/master/qno/testing/package/f6a3a15f8e21f4ef1766187bb55ab7a9e33717de/lib:/home/silvio/.conan/data/bzip2/1.0.6/conan/stable/package/d3439b0c3c2b7de760051db5f9a1fd45aaec4afb/lib:/home/silvio/.conan/data/zlib/1.2.11/conan/stable/package/2f7b82355ea4bfc093a8e85003164e724ce5930c/lib:/home/silvio/.conan/data/glew/2.1.0/bincrafters/stable/package/d0c8a4d4ce6118db4d0224c979197f2b5827c0e7/lib:/home/silvio/.conan/data/glfw/3.3/bincrafters/stable/package/2f7b82355ea4bfc093a8e85003164e724ce5930c/lib]

I also don't know how you built this, I do with CMake and there you have to add

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

in the CMakeLists.txt, so everything will be adjusted by conan.

╭─silvio@playground ~/Rack/build ‹v1*›
╰─$ cmake -G Ninja ..
-- Current conanbuildinfo.cmake directory: /home/silvio/Rack/build
-- Conan: Compiler GCC>=5, checking major version 6
-- Conan: Checking correct version: 6
-- Conan: Using cmake global configuration
-- Library rtaudio found /home/silvio/.conan/data/RtAudio/5.1.0/qno/testing/package/3ae6769b6d7a0bea12b51d821c046d5f4d7c7298/lib/librtaudio.so
-- Library rtaudio found /home/silvio/.conan/data/RtAudio/5.1.0/qno/testing/package/3ae6769b6d7a0bea12b51d821c046d5f4d7c7298/lib/librtaudio.so
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Configuring done
...

But be warned, I have no Mac system and I don't know if everything is working correct. I've just guessed and look into other recipes on how to do the Mac stuff. And that is why it is in testing channel ;-)

izzyreal commented 5 years ago

Unfortunately I don't have readelf.

qno commented 5 years ago

https://stackoverflow.com/questions/3286675/readelf-like-tool-for-mac-os-x

All I can do is pointing to this - https://docs.conan.io/en/latest/howtos/manage_shared_libraries/rpaths.html

Maybe this is helping you to understand the MacOs problem. I also looked again into other recipes for special MacOs handling, but there is none. Or just try to link against the static libary.

izzyreal commented 5 years ago

I think linking against the static library should be default.

qno commented 5 years ago

Hmm ... maybe I screwed up something with the default_options - so I tried to fix this.

Try again if the CI job has finished - https://dev.azure.com/qnohot/qnohot/_build/results?buildId=357

And make sure you use the updated package - RtAudio/5.1.0@qno/testing

qno commented 5 years ago

OK - so this still doesn't work, so let me fix something different ...

qno commented 5 years ago

Now static and shared lib builds are working correct. So please try again.

izzyreal commented 5 years ago

Nice one. I've moved to portaudio in the meantime, but I'll try to compile with rtaudio in the near future and let you know.

izzyreal commented 5 years ago

It works now :) I'll go back to your package, because the current portaudio package is having problems with WASAPI (though the package creator is working on a fix).