-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest API (3.12) for macOS build issues #79
Comments
The Mac API installer has a few issues. I'm in the middle of sorting it out and I'll post here when it's released. It's a universal library so there are extra steps needed to get the libraries visible which I've been working on today. |
Looks like the Mac API installer for version 3.12 is fixed now: https://groups.io/g/SDRPlayUsers/message/9046 Franco |
Hi Franco, yes, finished testing it with Steve at about 4am this morning, grabbed a few hours kip, being forced to go Christmas shopping lol and then later I'll sort out API 3.12 for the other platforms - any problems I'm sure you'll all let me know! This version of the API installer should tidy up the mess caused by the previous one so you should just be able to run it. |
Thank you for all your work! For some reason I still need the symlink wherever I want to use SoapySDR.
This is macOS Sonoma. Also, are the docs for 3.12 somewhere? The install program has a link of https://www.sdrplay.com/docs/SDRplay_API_Specification_v3.12.pdf but that's a 404. On your website the API docs link to https://www.sdrplay.com/docs/SDRplay_API_Specification_v3.09.pdf. |
Hi, I'm still editing the 3.12 spec so it will be up asap - there's not much different to the 3.09 so you're good with that one for now. Regarding the library, all of the API libraries go into /usr/local/lib and that should be on your library search path. It looks like on your system it's looking in /Users/xxx/Library/Mobile Documents/com
the API was found and used without a problem. Hope that helps. Andy |
/Users/xxx/Library/Mobile Documents/com Those are my same build steps and I do get the libs in /usr/local/lib $ ls -l /usr/local/lib/libsdrplay_api*
|
@lagomorph - I do not have a Mac, but I think these two commands might be useful in troubleshooting your problem:
(the first one has uppercase '-L', the second one instead has lowercase '-l'). Franco |
@fventuri Thanks for the suggestion. I was using otool -L earlier to make sure the name of the library in the API didn't have the x86_64 in it anymore (which it doesn't) but looking closer at it I see that the dynamic lib for the API doesn't include the path to /usr/local/lib. I added the path with So bottom line it's fixed for me. Maybe it would be better if the path was explicit in libsdrPlaySupport.so since it's known where it should be. |
@lagomorph - glad to hear it is fixed for you. I did some quick research on your issue and I found this interesting page in the CMake Wiki: https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling If I understand correctly, the problem you are experiencing is very similar to the one described there in the 'Common questions' section, so I just created a new branch called Please give it a try, and let me know how it goes. Franco |
@fventuri unfortunately it didn't seem to change anything. I still get a libsdrplay_api.so.3.12 with no path. I also tried all the other examples in the "Always full RPATH" section but I couldn't find any combination that set the path in the library. They do mention in the Caveats section: "Since install-side RPATH tweaking is an operation that is done by target-specific installation handling, any target that should have its install RPATH changed (e.g. to CMAKE_INSTALL_RPATH) needs to end up in the installation via an install(TARGETS ...) signature and not via directory-based "copying" (otherwise the project's cmake_install.cmake file will end up without any RPATH lines)." I'm not sure if that applies. |
@lagomorph - I am not really sure why RPATH is not working there. Please try rebuilding it with
The last few lines should show you exactly how the SoapySDRPlay module gets linked.
In my case the path to the local shared libraries is I wonder if on your Mac you see something similar or not. Franco |
Yes, I see something similar. There are two different -Wl arguments though. I wonder if that has anything to do with it.
|
@lagomorph Your |
I've had complaints over the years regardless of where I install the library, whether it's usr or local or opt or lib or lib64 - this always seems to upset someone. So I decided the best way was to install the library somewhere and then link to wherever people want it linked to - then you just need to make sure that wherever it's linked to is in LD_LIBRARY_PATH - surely that's all that needs doing? I had no problems building SoapySDRPlay out of the box so I'm not sure why other applications are having build issues? I don't think rewriting the library with a different install path and hence breaking its signing/notarizing status is a good idea, but each to their own. |
I definitely understand the decision to choose one place, and am not advocating otherwise. If you're running Sonoma 14.2 and Xcode 15 try this little test program:
I have been struggling for several days to understand this. My best guess is that dyld is no longer looking at |
I'm building on MacOS 13.4.1 (Apple M1) and Xcode is version 14.3.1 - I don't want to mess with that because this is the SDRconnect build engine. I've just built and run that code without any warnings or errors, so is this something that's come into a later MacOS or Xcode version? |
Yes, on Apple M2 when I moved from MacOS 13.something to 14.1. I'd been happily using sdrplay_api for several applications on earlier MacOS. Don't mess with SDRconnect :-) I will continue looking for clues. |
I just logged into a colleague's Mac... MacOS 14.1.2 (Apple Silicon) with Xcode 15.1... I see the library not found error at runtime, but setting DYLD_LIBRARY_PATH fixed the problem... $ DYLD_LIBRARY_PATH=/usr/local/lib ./sdrplay_api_version I guess I could have also... but I didn't try that. Does that work for you? I'm not sure why DYLD_LIBRARY_PATH is handled differently between the version I'm on and the latest? Andy. |
In the good old days under Linux you would run "sudo ldconfig" and it would re-catalog the paths that needed to be searched for libraries, but I don't think MacOS has an equivalent of that? |
Yes, DYLD environment variables will hide it, but that seems hackey and is blocked by the default Hardened Runtime. The best I can tell, the standard way to build a movable library is to use the linker option |
@ahooper - a couple of weeks ago @lagomorph tried with various RPATH settings on his Mac (see his comment here: #79 (comment)), but I don't think he was successful. I do not have a Mac that I can use here, so I can't really help you much, but if you do find a good cmake configuration that addresses this problem on the newer version of MacOS (without affecting older versions), I'll be happy to add it to the Franco |
Yes, I wasn't able to get RPATH settings to have any effect. Something like:
works but that seems hacky. |
Here is a revision of @lagomorph's suggestion, to be independent of libsdrplay_api version:
This could be eliminated if @SDRplay could change the build of the library to add the
dyld no longer has a fallback library search path to
|
@ahooper - thanks for your suggestion. If you were to build your
(instead of Franco |
No, the library path built into the binary is the one explicitly set in the .so library:
|
@lagomorph @ahooper - since I don't have a Mac here, today I spent some time using GitHub CI that can run on MacOS Sonoma workers. After a few tests with @ahopper simple test program (see here: https://github.com/fventuri/mac-test/actions), I figured out the following:
Franco |
API 3.12 puts include files in /usr/local/inc. I had to add /usr/local/inc to FindLibSDRplay.cmake to get cmake to find the API files.
In addition, the library file that gets built (libsdrPlaySupport.so) has a shared library libsdrplay_api_x86_64.so.3.12 that doesn't match the API's libsdrplay_api.so.3.12.0. This causes a runtime error:
Module found: /usr/local/lib/SoapySDR/modules0.8/libsdrPlaySupport.so
dlopen() failed: dlopen(/usr/local/lib/SoapySDR/modules0.8/libsdrPlaySupport.so, 0x0001): Library not loaded: libsdrplay_api_x86_64.so.3.12
Referenced from: /usr/local/lib/SoapySDR/modules0.8/libsdrPlaySupport.so
Reason: tried: 'libsdrplay_api_x86_64.so.3.12' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibsdrplay_api_x86_64.so.3.12' (no such file), 'libsdrplay_api_x86_64.so.3.12' (no such file), '/Users/xxx/Documents/Development/git/SoapySDRPlay3/build/libsdrplay_api_x86_64.so.3.12' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/xxx/Documents/Development/git/SoapySDRPlay3/build/libsdrplay_api_x86_64.so.3.12' (no such file), '/Users/xxx/Documents/Development/git/SoapySDRPlay3/build/libsdrplay_api_x86_64.so.3.12' (no such file)
I don't have a workaround for this other than creating a symlink everywhere I need to use SoapySDRPlay.
ln -s /Library/SDRplayAPI/3.12.0/lib/libsdrplay_api.so.3.12.0 libsdrplay_api_x86_64.so.3.12
Any ideas where this comes from?
The text was updated successfully, but these errors were encountered: