Page 1 of 1

Issue building on Mac 10.15 - libmadplugin.dylib 0 bytes?

Posted: Thu Jan 14, 2021 2:19 am
by MKUltraMkII
I have followed the instructions to build on mac, but I seem to be running into an issue.

I'm on macOS 10.15.7

I've installed:
Xcode
Qt5.5.1
Dependencies/Ports

I've cloned QLC source, (and checked out tag QLC+_4.12.3)

And I've followed the command line steps for building.

But `make install` seems to run into a problem:

Code: Select all

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: input file: libmadplugin.dylib is not a Mach-O file


If anyone can offer any input or suggestions, I'd greatly appreciate it.
If there is any further info I can provide, please let me know. Thanks!


Full terminal output of `make install` is below:

Code: Select all

jhays-mbp:qlcplus jhays$ make install
cd hotplugmonitor/ && ( test -e Makefile || /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake /Users/jhays/Dev/qlcplus/hotplugmonitor/hotplugmonitor.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile install
cd src/ && ( test -e Makefile || /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake /Users/jhays/Dev/qlcplus/hotplugmonitor/src/src.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile install
make[2]: Nothing to be done for `install'.
cd test/ && ( test -e Makefile || /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake /Users/jhays/Dev/qlcplus/hotplugmonitor/test/test.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile install
make[2]: Nothing to be done for `install'.
cd engine/ && ( test -e Makefile || /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake /Users/jhays/Dev/qlcplus/engine/engine.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile install
cd audio/ && ( test -e Makefile || /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake /Users/jhays/Dev/qlcplus/engine/audio/audio.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile install
cd plugins/ && ( test -e Makefile || /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake /Users/jhays/Dev/qlcplus/engine/audio/plugins/plugins.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile install
cd mad/ && ( test -e Makefile || /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake /Users/jhays/Dev/qlcplus/engine/audio/plugins/mad/mad.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile install
install_name_tool -change /opt/local/lib/libmad.0.dylib @executable_path/../Frameworks/libmad.0.dylib libmadplugin.dylib
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/install_name_tool: input file: libmadplugin.dylib is not a Mach-O file
make[4]: *** [install_nametool] Error 1
make[3]: *** [sub-mad-install_subtargets-ordered] Error 2
make[2]: *** [sub-plugins-install_subtargets-ordered] Error 2
make[1]: *** [sub-audio-install_subtargets-ordered] Error 2
make: *** [sub-engine-install_subtargets-ordered] Error 2
jhays-mbp:qlcplus jhays$ 

Re: Issue building on mac - libmadplugin.dylib?

Posted: Thu Jan 14, 2021 2:12 pm
by MKUltraMkII
Here is some other relevant info:


First I run qmake:

Code: Select all

jhays-mbp:qlcplus jhays$ /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake
Project MESSAGE: Building QLC+ 4 QtWidget UI
Info: creating stash file /Users/jhays/Dev/qlcplus/.qmake.stash
Then I run make, and it fails:

Code: Select all

jhays-mbp:qlcplus jhays$ make
cd hotplugmonitor/ && ( test -e Makefile || /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake /Users/jhays/Dev/qlcplus/hotplugmonitor/hotplugmonitor.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile 
cd src/ && ( test -e Makefile || /Users/jhays/Qt5.5.1/5.5/clang_64/bin/qmake /Users/jhays/Dev/qlcplus/hotplugmonitor/src/src.pro -o Makefile ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -Werror -O2 -fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.7 -Wall -W -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I../../../../Qt5.5.1/5.5/clang_64/lib/QtGui.framework/Headers -I../../../../Qt5.5.1/5.5/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/AGL.framework/Headers -I../../../../Qt5.5.1/5.5/clang_64/mkspecs/macx-clang -F/Users/jhays/Qt5.5.1/5.5/clang_64/lib -o hpmprivate-iokit.o hpmprivate-iokit.cpp
clang: error: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Werror,-Wstdlibcxx-not-found]
make[2]: *** [hpmprivate-iokit.o] Error 1
make[1]: *** [sub-src-make_first-ordered] Error 2
make: *** [sub-hotplugmonitor-make_first-ordered] Error 2

By the suggestion in the output, I then try

Code: Select all

make -stdlib=libc++
. This produces a lot of output and seems to do something... its very long so I'm attaching an excerpt of just the beginning and end.
make_log.txt
(3.53 KiB) Downloaded 146 times
But something about this seems to have not worked correctly. Notice these files in the "mad" and "snd" directories, including libmadplugin.dylib, have a size of 0 bytes.
Screen Shot 2021-01-14 at 8.08.47 AM.png

Just to try something, I manually copied /opt/local/lib/libmad.0.dylib to qlc's engine/audio/plugins/mad and renamed it to libmadplugin.dylib. Then ran make install again. I think it fixed that issue... but then ran into the next issue, same problem with another 0 byte dylib inside the snd folder.

Any ideas what's going wrong here? Thank you.

Re: Issue building on mac - libmadplugin.dylib 0 bytes?

Posted: Fri Jan 15, 2021 2:22 pm
by MKUltraMkII
I think I might just having a problem compiling C++ on macOS 10.15 ?

I've now updated Qt to 5.12.10 to see if that helps. I think it did to some degree-- make proceeds now without the issue of finding c++ headers.

But it ends up failing with this:

Code: Select all

Project ERROR: Unknown module(s) in QT: script

Code: Select all

/Users/jhays/Qt5.12.10/5.12.10/clang_64/bin/moc -DQT_NO_DEBUG_OUTPUT -DHAS_FFTW3 -DQT_NO_DEBUG -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB --include /Users/jhays/Dev/qlcplus/engine/audio/src/moc_predefs.h -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/mkspecs/macx-clang -I/Users/jhays/Dev/qlcplus/engine/audio/src -I/Users/jhays/Dev/qlcplus/engine/src -I/Users/jhays/Dev/qlcplus/plugins/interfaces -I/opt/local/include -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib/QtMultimedia.framework/Headers -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib/QtGui.framework/Headers -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib/QtNetwork.framework/Headers -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib/QtCore.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -F/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib audiocapture_qt.h -o moc_audiocapture_qt.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -Werror -O2 -fPIC -std=gnu++11  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.12 -Wall -W -DQT_NO_DEBUG_OUTPUT -DHAS_FFTW3 -DQT_NO_DEBUG -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I../../src -I../../../plugins/interfaces -I/opt/local/include -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib/QtMultimedia.framework/Headers -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib/QtGui.framework/Headers -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib/QtNetwork.framework/Headers -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/AGL.framework/Headers -I/Users/jhays/Qt5.12.10/5.12.10/clang_64/mkspecs/macx-clang -F/Users/jhays/Qt5.12.10/5.12.10/clang_64/lib -o moc_audiocapture_qt.o moc_audiocapture_qt.cpp
rm -f libqlcplusaudio.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar cq libqlcplusaudio.a audio.o audiodecoder.o audiorenderer.o audioparameters.o audiocapture.o audioplugincache.o audiorenderer_qt.o audiocapture_qt.o moc_audio.o moc_audiodecoder.o moc_audiorenderer.o moc_audiocapture.o moc_audioplugincache.o moc_audiorenderer_qt.o moc_audiocapture_qt.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib -s libqlcplusaudio.a
cd src/ && ( test -e Makefile || /Users/jhays/Qt5.12.10/5.12.10/clang_64/bin/qmake -o Makefile /Users/jhays/Dev/qlcplus/engine/src/src.pro ) && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile 
Project ERROR: Unknown module(s) in QT: script

I do think I'm getting closer to success... but I'm still not sure what I'm running into.

Re: Issue building on mac - libmadplugin.dylib 0 bytes?

Posted: Fri Jan 15, 2021 2:49 pm
by lighthacker2020
I have no help to offer, but am interested in seeing how this turns out. I tried building from source on MacOS without any luck, gave up after an hour (In all fairness, I don't do much development targeted for Macs outside of some Python, Ruby, and Go). Have a Linux VM on the system that builds just fine, so I used that instead.

Posted: Fri Jan 15, 2021 4:02 pm
by MKUltraMkII
lighthacker2020 wrote: Fri Jan 15, 2021 2:49 pm I have no help to offer, but am interested in seeing how this turns out. I tried building from source on MacOS without any luck, gave up after an hour (In all fairness, I don't do much development targeted for Macs outside of some Python, Ruby, and Go). Have a Linux VM on the system that builds just fine, so I used that instead.
I'll keep updating this thread if I find any progress.

I'm now attempting to install the latest Qt5 (5.15.2) again. I had tried this initially but ran into a problem, and I then moved to trying Qt5.5.1 as that's what the QLC+ install instructions had been using. But ultimately I think that older Qt wasn't going to work with my macOS 10.15.


Since qt5.12.10 did get a little further, I'm now going to revisit trying with the latest Qt to see if I can make any more progress there.

Based on some forum thread I found elsewhere about c++ build problems on macOS, I tried installing a slightly older Xcode (10.2) and using xcode-select to use that version. That' didn't resolve it for me, either.

So my current plan is to go back to attempting with the latest Qt and latest Xcode and see where I get.

Re: Issue building on Mac 10.15 - libmadplugin.dylib 0 bytes?

Posted: Sat Jan 16, 2021 4:48 pm
by MKUltraMkII
I was finally able to produce a build on macOS 10.15! Took a few nights of tinkering to figure it out. I'll do my best to remember how I worked through it, but it was kind of tedious. Basically each time an error showed up during `make` or `make install`, I'd just have to look at the terminal output really closely and try to understand what went wrong, and address each issue one at a time until it finally worked.

I'm using macOS 10.15, Xcode 12.3, and Qt5.15.2. I built QLC+ from source at the "QLC+_4.12.3" tag.

My intentions were to make a small code addition to the 4.12.3 build. More about that is discussed here: https://www.qlcplus.org/forum/posting.p ... 33&t=14754

I used `brew install qt5` to install Qt. I couldn't figure out the offline installer for 5.15.2, I tried building it from source, but ran into issues. Ultimately using homebrew to install made it super easy, however, it installs it to /usr/local/Cellar/qt/5.15.2, which I suspect may have caused some trouble, but I was able to work through it.

With everything installed, I followed the QLC+ macOS build instructions https://github.com/mcallegari/qlcplus/w ... -build-Qt5
I installed port and used the commands suggested to install dependencies, but I'm not sure that worked correctly- I definitely ran into issues with some dependencies and had to try installing them via port again later. Particularly libftdi - the instructions say to install libftdi0 via port, but I'm pretty sure I ended up needing to install libftdi1, and I ended up using homebrew to install it instead.

I specified my Qt directory with

Code: Select all

export QTDIR=/usr/local/Cellar/qt/5.15.2/bin
Then from within the qlcplus directory, I ran

Code: Select all

/usr/local/Cellar/qt/5.15.2/bin/qmake
Then I ran `make`. This initially runs into problems- I can't remember which occurred first, there were issues in maybe a handful of files that had deprecation warnings that would cause make to error out and stop. I can't remember exactly which files.. but each time I'd run into this, I'd identify which file it was that was last attempted to be compiled in the log output before the deprecation warning/errors occurred, then I'd search the qlcplus project directory for that file to figure out which Makefile it was referenced in. Then I'd open that Makefile, towards the top it would have a line that starts with "CXXFLAGS". I'd find the end of that line and append

Code: Select all

-Wno-deprecated-declarations
to it. Then I'd run `make` again, let it go until it hit the next spot with deprecation warnings, then I'd do that same process again and again. Ultimately did that maybe 7+ times, to Makefiles for rgbtext, E1.31, osc, ola, qlcplus, macos... probably a couple more, I didn't document it as I did it. Maybe there is an easier way to handle this by specifying "-Wno-deprecated-declarations" at a higher level or something where it would apply to everything, instead of one by one.... I'm not certain. I am software developer, but I don't work in c++ and I'm not super familiar with Makefiles and this type of build process, so maybe my approach here is a little kludgey.

But, eventually, I made it though `make` without any further issues.

Then on to `make install` where there were further issues. Particularly issues where usage of `install_name_tool` would fail because it couldn't find a file it was trying to use. When that happens, I'd have to figure out which file it was bombing on and figure out why. libftdi1.2.dylib was troublesome... I think at first maybe I didn't install that correctly. I tried `sudo port install libftdi1`, but I think I ended up in a situation where I had libftdi1.2.5.0.dylib and not 1.2. I think I installed with `brew install libtdi1`, which puts it in the homebrew cellar folder rather than something like /opt/local/lib . In the end I had kind of a mess between those two directories, and something created symlinks from libftdi1.2.dylib pointing to libftdi1.2.5.0.dylib, but install_name_tool did not like that.

So, I ended up modifying qlcplus/platforms/macOS/Makefile, the 2nd line below "install_LIBFTDI" so that it would point to the libftdi1.2.5.0.dylib that I had in the cellar dir:

Code: Select all

$(QINSTALL) /usr/local/Cellar/libftdi/1.5/lib/libftdi1.2.5.0.dylib $(INSTALL_ROOT)/Users/jhays/QLC+.app/Contents/Frameworks/libftdi1.2.dylib
I think I finally got past that issue..there were more, but at this point its was pretty late and my memory is foggy..

Now the QLC+.app is appearing in my user dir after make install, but the process was still erroring out, still usually due to `install_name_tool` not being able to find something.

Next was QtCore.framework... and then a bunch of other Qt frameworks. Each time, the directory it should appear in inside QLC+.app/Contents/Frameworks would get created, but the framework just wasn't getting copied there, and make install would bomb. So I'd go locate the framework in /usr/local/Cellar/qt/5.15.2/lib/, copy the .framework, paste it inside the QLC+.app/Contents/Frameworks (in whatever respective directory in there that each framework belonged in. Then I'd run make install again, it would get past that and bomb at the next Qt___.framework. So I copied each one as needed, and a couple other files for the same issue. I'm suspecting this was because Qt was installed to the homebrew Cellar and for some reason the build process couldn't find frameworks it was looking for, despite the fact that I specified the QTDIR at the beginning of this process.

And then finally, make install produced a QLC+.app in my user directory that I could successfully open and run.

One other note- although the build is working, the final line in the terminal output says this:

Code: Select all

lrelease, lrelease-qt4 and lrelease-qt5 are not present in this system ! Aborting.
I'm not sure if this is any concern... but the build was produced and the app does run, so maybe it isn't an issue?

I then made a minor tweak to a cpp file, ran make and then make install again, ran the app, and my change was reflected. Success!

To any other poor souls that go down this path of trying to build on macOS 10.15... best advice I can give is to read the terminal output closely whenever it bombs. Figure out why it is bombing and try to address it step by step.. eventually it is possible to build QLC+ 4.12.3 on macOS 10.15.

Re: Issue building on Mac 10.15 - libmadplugin.dylib 0 bytes?

Posted: Sun Jan 17, 2021 10:39 am
by mcallegari
Build instructions suggest to use MacPorts and official Qt5 releases (from the Qt company)
Instead you used Homebrew.
That's why you spent so much on building QLC+

Re: Issue building on Mac 10.15 - libmadplugin.dylib 0 bytes?

Posted: Sun Jan 17, 2021 1:43 pm
by MKUltraMkII
My initial attempts had used official Qt installers, but still ran into issues. I tried 5.5.1 and 5.12 I think.. understandably, I believe the latest Qt is necessary for it to work on macOS 10.15
But for some reason I had trouble figuring out where to get the Qt installer with the latest version, it wasn’t as simple as the earlier versions. I was able to get it as source..but had trouble building that.
Using homebrew ended up being the easiest way for me to install Qt 5.15.x, but I understand that was the reason for some of the difficulties I faced.