-
Notifications
You must be signed in to change notification settings - Fork 757
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
Libsndfile: have cmake prefer homebrew install over bundled version #1870
Conversation
is travis not running on this ? because its not a source code file change ? |
@@ -46,7 +46,7 @@ Prerequisites: | |||
`xcode-select --install` | |||
- **homebrew** is recommended to install required libraries | |||
See http://brew.sh for installation instructions. | |||
- **git, cmake, readline, and qt5**, installed via homebrew: | |||
- **git, cmake, sndfile, readline, and qt5**, installed via homebrew: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❯ brew search sndfile
libsndfile ✔
What do you mean not "very robust" ? Just that it might not find the brew installed version (due to quirky homebrew installs etc.) ? Any downsides to discuss ? thanks |
Yes, it would not find non standard homebrew, or any other libsndfile install, except for that single location in /usr/local/lib|include. Original findModules try to cover several places where libraries might be found. This just looks in 1 place and if it doesn't find it, it falls back to the bundled binary. I am not aware of another downside, but maybe somebody else is... Well, there is also this static/shared question: the old libsndfile is linked statically... Sam suggested dynamic and I also used to use that. I am not sure why back then static was chosen. I think an advantage of dynamic is that they seem to bring in libvorbis and libflac automatically. But to which degree SC can make use of it, I don't know (but it looks good to have four additional sndfile related dylibs in the MacOS folder: libFLAC, libOgg, libvorbis and libvorbisenc ;)) |
as for static/dynamic linking: dynamic linking is recommended, as libsndfile links to other libs. cmake's fixup_bundle should copy the dylibs to the bundle |
there is one point to consider: are homebrew builds relocatable? especially: is a binary installed via homebrew on 10.11 guaranteed to work on 10.8? |
@tim: what would an adaption include? Add Ogg as format just the way the others are added and remove that version check, that is not necessary any more? Btw. raw is missing, that's on purpose, right? |
Btw, the release builds are the travis builds, aren't they? They're built with 10.9, if I am not mistaken. Wouldn't that reduce the risk dramatically? |
as to relocation, this seems to be the way to go:
Homebrew/legacy-homebrew#31483 (copied useful comment from #1783): It seems homebrew supplies libraries that to some degree are optimized for the OSX version and the system architecture of the host system. As long as you build for yourself, that's good. But if you build for a release, it's a different story. It's planned to use the Travis build for release, right? One has to make sure libsndfile is built in a way that works on all OSs and architectures targeted by the release. |
* Normally, homebrew installations of readline are detected automatically, and building with | ||
readline is only required if you plan to use SuperCollider from the terminal. To link to a | ||
* Normally, homebrew installations of libsndfile are detected automatically. To link to a | ||
non-standard version of libsndfile, you can use. This is also necessary if for some |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"you can use." ... ?
I think this sentence is supposed to be "you can use:" and then follow with the options and then the next sentence.
yes, we use travis build for release. so I'm not 100% sure, but I think this is ready for merge. except for that "you can use:" issue of the docs I just noticed and commented about. |
I'll correct that typo. Give me a few hours. I am currently getting a 10.8 build system on a virtual machine ready and I'll try to confirm the open questions empirically. |
Haha, conflicting with my own commit. Will fix that when doing the typo, in an hour or so. |
So, the reservation turned out as valid:
But! Let's have clear that this not really about this pull request, but about deployment of homebrew libs in a release build. If libsndfile is not available on Travis, things will be as before. If you build locally with homebrew libsndfile, this problem will not occur. As I see it, there are two alternatives:
Best |
Sorry, it still conflicts, but the merge is simple. If required I can do it if the PR is to be committed. Have to go now for a while... |
|
It does so already. So it could actually change the libs to be more generic? Is there a way to tell it that it should do some special treatment to the libsndfile libs? Would be nice if a custom libsndfile compile could be avoided. |
When trying out @crucialfelix' move of scsynth to the Resources folder, I realized something that is relevant for this PR, although I consider it more a bug that has been there before, and that should be solved regardless of whether this PR is commited or not: integrating a the homebrew libsndfile by adding the sndfile locations via the sndfile findModule, or by passing them in via the cmake command-line arguments -DSNDFILE_LIBRARY/INCLUDE_DIR causes the libs (libsndfile, libogg and a few more) to be copied to the bundle/MacOS folder. It "looks" ;) as if they were used there (and maybe they are by sclang?). And yet, if I uninstall the homebrew install of libsndfile on my system, the server cannot be booted any more. So it looks as if the server uses the library in the homebrew install location rather than the one bundled with SC. Note that this is the case both when scsynth is located in bundle/Resources, and when it is located in bundle/MacOS. So it's not the question whether scsynth and libsndfile are in the same folder... This also means that the portability test I did by running an 10.9 built SC using homebrew libsndfile on a 10.8 machine is meaningless. The server can't boot on any machine, where libsndfile is not installed in the system... |
I think I found the reason why scsynth doesn't used the "installed" sndfile dylib:
is both in sc-ide and lang CMakeLists.txt, but not in the server file. Likely because everything is (used to be) statically linked in scsynth. So provided I am right, what is the better fix? Add something corresponding for the server (and supernova?) or link the latest libsndfile statically too? |
We are still undecided, right ? You need to look at this more ? No stress right now, we have time. |
Yes, this absolutely needs more work (I just translated Sam's PR here) I'd like to concentrate on Windows right now, but I'll try to come back here in a week or so if nobody else does. |
I think this is okay now, but if people are worried, I can switch it to the master branch. Turned out what was needed, is that DiskIO_UGens get's told where to look for libsndfile, so I added all sc-plugins to the plugins slot in I also found that supernova wants a pointer to libsndfile in /usr/local/opt/libsndfile rather than just /usr/local, not sure why, but I fulfilled its wish, alongside with raising the priority of the path from PATHS to HINTS to avoid finding libsndfile if it resides in the environment PATH As to portability: first of all all this has no effect, if libsndfile isn't installed, then the old static library will be used. Second: it dawned (denglish) on me that libsndfile is no different from Qt and readline, so I guess no special treatment should be needed. I actually have a bit of doubts as to the effect of this. In theory also the old 1.0.18 version should already support ogg and flac. But I guess Sam made the original pull request for a reason. I verified that ogg and flac files can be opened and played. And flac files can also be written in a recording. Writing ogg doesn't work for me, not sure why and if it should... What could still be done is remove all those references to the libsndfile version like On a sidenote: I wonder how sc3-plugins handle the fftw dependency. Likely so far only people who have fftw installed used it. What if that was provided as an independent package, wouldn't fftw have to be bundled and fixup_bundle be run there as well? |
Confirmed working nicely.
|
@crucialfelix, note that the release will not contain the libsndfile/flac/vorbis dylib. This would require the travis build to install libsndfile. I am fine with any choice, let me know. Adjusting travis should be trivial. |
That's just the libsndfile that I installed with homebrew. I'm posting proof for other interested people that it does indeed build with the homebrew - as advertised. Also we can see "fixing up" which I think is correcting the dynamic linking paths (after having copied them). Am I right about that part ? |
Though I get what you mean now—we could make the release build support FLAC and ogg which would be nice. |
Your scrennshot from above (thanks for testing!) doesn't show whether it's the executables fixup or the plugins fixup. But that doesn't matter really, that's not the risky part of the commit, it should reproduce nicely on all systems. |
Actually that should be easy by creating a pull request with the travis change and have it build. I'd just have to find out what the download link for that build would be... I'll try... |
Ooops, while observing the travis build I just discovered that current build target is set to 10.9. Probably an accident that happened to Scott C. when he froze the Qt version? I guess I should change that? |
"deployment_target", sorry |
The travis build does the fixup with the plugins too, but it's a bit different from what I expected:
It shouldn't be a problem, as all libs are from the same homebrew install, but it's a bit untidy. I'd like to inspect the bundle. I'll rebuild with deployment target set to 10.7. We want that anyways. |
This is not very robust, but it uses the bundled libsndfile as fallback. Readme adjusted.