Bug 251589

Summary: audio/musescore: fails to link, add USES=localbase
Product: Ports & Packages Reporter: Greg V <greg>
Component: Individual Port(s)Assignee: Adriaan de Groot <adridg>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (adridg)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description Greg V 2020-12-04 23:51:52 UTC
MuseScore is doing bad things in cmake — if not APPLE, MINGW or MSVC, we literally just get hardcoded `-logg -lvorbis -lsndfile` etc. :(

https://github.com/musescore/MuseScore/blob/e7982880fd98648d26c109dc703d158f76798eab/CMakeLists.txt#L509-L513 <<<<<<<<<< here

I have no idea what passes -L/usr/local/lib with the official unmodified ports repo, but nothing does for me and it fails:

FAILED: main/mscore
: && /usr/local/llvm11/bin/clang++ -O2 -pipe -march=haswell -fstack-protector-strong -fPIE -fPIC -fno-strict-aliasing  -Wno-inconsistent-missing-override -fPIE -fPIC -std=gnu++11 -fPIC -DNDEBUG -DQT_NO_DEBUG -DQT_NO_DEBUG_OUTPUT -fstack-protector-strong -pie -Wl,-z,relro -Wl,-z,now main/CMakeFiles/mscore.dir/mscore_autogen/mocs_compilation.cpp.o main/CMakeFiles/mscore.dir/main.cpp.o main/CMakeFiles/mscore.dir/modulessetup.cpp.o -o main/mscore  -Wl,-rpath,/usr/local/lib:/usr/local/lib/qt5  mscore/libmscoreapp.a  global/libglobal.a  -lrt  audio/libaudio.a  importexport/libimportexport.a  mscore/libmscoreapp.a  audio/libaudio.a  importexport/libimportexport.a  -lvorbisfile  awl/libawl.a  thirdparty/singleapp/src/libqtsingleapp.a  effects/libeffects.a  libmscore/liblibmscore.a  thirdparty/qzip/libqzip.a  telemetry/libtelemetry.a  global/libglobal.a  thirdparty/google_analytics/libgoogle_analytics.a  /usr/local/lib/libfreetype.so  -lvorbis  -logg  thirdparty/ofqf/libofqf.a  -lz  -lpthread  -lfreetype  /usr/local/lib/libpulse.so  -lrt  audiofile/libaudiofile.a  -lsndfile  /usr/local/lib/qt5/libQt5Test.so.5.15.0  /usr/local/lib/qt5/libQt5QuickControls2.so.5.15.0  /usr/local/lib/qt5/libQt5QuickTemplates2.so.5.15.0  /usr/local/lib/qt5/libQt5QuickWidgets.so.5.15.0  /usr/local/lib/qt5/libQt5Xml.so.5.15.0  /usr/local/lib/qt5/libQt5XmlPatterns.so.5.15.0  /usr/local/lib/qt5/libQt5Svg.so.5.15.0  /usr/local/lib/qt5/libQt5Concurrent.so.5.15.0  /usr/local/lib/qt5/libQt5OpenGL.so.5.15.0  /usr/local/lib/qt5/libQt5Help.so.5.15.0  /usr/local/lib/qt5/libQt5Sql.so.5.15.0  /usr/local/lib/qt5/libQt5WebEngine.so.5.15.0  /usr/local/lib/qt5/libQt5WebEngineWidgets.so.5.15.0  /usr/local/lib/qt5/libQt5PrintSupport.so.5.15.0  /usr/local/lib/qt5/libQt5Widgets.so.5.15.0  /usr/local/lib/qt5/libQt5WebEngineCore.so.5.15.0  /usr/local/lib/qt5/libQt5Quick.so.5.15.0  /usr/local/lib/qt5/libQt5Gui.so.5.15.0  /usr/local/lib/qt5/libQt5QmlModels.so.5.15.0  /usr/local/lib/qt5/libQt5WebChannel.so.5.15.0  /usr/local/lib/qt5/libQt5Qml.so.5.15.0  /usr/local/lib/qt5/libQt5Network.so.5.15.0  /usr/local/lib/qt5/libQt5Positioning.so.5.15.0  /usr/local/lib/qt5/libQt5Core.so.5.15.0  importexport/beatroot/libbeatroot.a  importexport/rtf2html/librtf2html.a  -Wl,-rpath-link,/usr/local/lib && :
ld: error: unable to find library -lvorbisfile
ld: error: unable to find library -lvorbis
ld: error: unable to find library -logg
ld: error: unable to find library -lfreetype
ld: error: unable to find library -lsndfile

At least for now, USES=localbase should be added.
Comment 1 Adriaan de Groot freebsd_committer 2021-01-06 09:36:43 UTC
Their approach to CMake is certainly .. bespoke. As in, such a mess that I don't see a meaningful way to patch in a normal CMake find-module for vorbis.

It looks like the PORTAUDIO option (default) somehow adds it, because in my local poudriere builds I have 

```
-lvorbis  -logg  thirdparty/ofqf/libofqf.a  -lz  -lpthread  -lfreetype  -lrt  
-L/usr/local/lib -lportaudio  
audiofile/libaudiofile.a  -lsndfile
```

comparing with your link command, I have the middle of those three lines "extra". So, yeah, USES=localbase it is.
Comment 2 commit-hook freebsd_committer 2021-01-06 09:48:15 UTC
A commit references this bug:

Author: adridg
Date: Wed Jan  6 09:48:13 UTC 2021
New revision: 560490
URL: https://svnweb.freebsd.org/changeset/ports/560490

Log:
  Add USES=localbase to audio/musescore

  It is possible to set port OPTIONS so that nothing "else" picks up
  LOCALBASE, and Musescore itself just links to -lvorbis without
  doing any CMake footwork for it, so we need to add it explicitly.

  PR:		251589
  Reported by:	greg@unrelenting.technology

Changes:
  head/audio/musescore/Makefile