Docker plugin toolchain error - missing libc++?

I’ve setup up the Rack plugin toolchain (GitHub - VCVRack/rack-plugin-toolchain) in a fresh Ububtu 20.04LTS install, and I’m getting an error when trying to build a plugin (Befaco in this case). Here is the command I run:

make -j8 docker-plugin-build PLUGIN_DIR=~/Documents/Rack-SDK-1.1.6/Rack-SDK/plugins/Befaco

and the error line (full log further down):

osxcross: error: cannot find libc++ headers

I can manually build the Befaco plugin successfully, both with the SDK and a fresh build of Rack itself, so I believe I have all the required packages installed.

The make docker-build is also successful from what I can tell.

I’m quite new to this Docker stuff so if anyone has any suggestions on how to debug this, any thoughts would be greatly appreciated. Thanks!

The two following logs are:

  1. building a plugin using the toolchain, where the libc++ error comes up
  2. the docker build log (when running a second time, which seems to show all steps were successful)

Log 1)

mboule@palomaru:~/VCVRack/rack-plugin-toolchain$ make -j8 docker-plugin-build PLUGIN_DIR=~/Documents/Rack-SDK-1.1.6/Rack-SDK/plugins/Befaco
mkdir -p plugin-build
docker run --rm --interactive --tty --volume=/home/mboule/Documents/Rack-SDK-1.1.6/Rack-SDK/plugins/Befaco:/home/build/plugin-src --volume=/home/mboule/VCVRack/rack-plugin-toolchain/plugin-build:/home/build/rack-plugin-toolchain/plugin-build --env PLUGIN_DIR=/home/build/plugin-src rack-plugin-toolchain:1 /bin/bash -c "make plugin-build -j8 --jobserver-auth=3,4"
make: warning: -j8 forced in submake: resetting jobserver mode.
make plugin-build-mac
make[1]: Entering directory '/home/build/rack-plugin-toolchain'
cd /home/build/plugin-src && make clean
make[2]: Entering directory '/home/build/plugin-src'
rm -rfv build plugin.dylib dist
removed directory 'build/src'
removed directory 'build'
make[2]: Leaving directory '/home/build/plugin-src'
cd /home/build/plugin-src && make cleandep
make[2]: Entering directory '/home/build/plugin-src'
rm -rfv dep
removed directory 'dep'
make[2]: Leaving directory '/home/build/plugin-src'
cd /home/build/plugin-src && make dep
make[2]: Entering directory '/home/build/plugin-src'
make[2]: Nothing to be done for 'dep'.
make[2]: Leaving directory '/home/build/plugin-src'
cd /home/build/plugin-src && make dist
make[2]: Entering directory '/home/build/plugin-src'
x86_64-apple-darwin17-clang++-libc++ -std=c++11 -stdlib=libc++  -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK/include -I/home/build/rack-plugin-toolchain/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_MAC -mmacosx-version-min=10.7  -c -o build/src/SpringReverb.cpp.o src/SpringReverb.cpp
x86_64-apple-darwin17-clang++-libc++ -std=c++11 -stdlib=libc++  -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK/include -I/home/build/rack-plugin-toolchain/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_MAC -mmacosx-version-min=10.7  -c -o build/src/EvenVCO.cpp.o src/EvenVCO.cpp
x86_64-apple-darwin17-clang++-libc++ -std=c++11 -stdlib=libc++  -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK/include -I/home/build/rack-plugin-toolchain/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_MAC -mmacosx-version-min=10.7  -c -o build/src/SlewLimiter.cpp.o src/SlewLimiter.cpp
x86_64-apple-darwin17-clang++-libc++ -std=c++11 -stdlib=libc++  -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK/include -I/home/build/rack-plugin-toolchain/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_MAC -mmacosx-version-min=10.7  -c -o build/src/ABC.cpp.o src/ABC.cpp
x86_64-apple-darwin17-clang++-libc++ -std=c++11 -stdlib=libc++  -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK/include -I/home/build/rack-plugin-toolchain/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_MAC -mmacosx-version-min=10.7  -c -o build/src/plugin.cpp.o src/plugin.cpp
osxcross: error: cannot find libc++ headers
osxcross: error: while detecting target90
mosxcross: error: cannot find libc++ headers
osxcross: error: 86_64-apple-darwin17-clang++-libc++ -std=c++11 -stdlib=libc++  -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK/include -I/home/build/rack-plugin-toolchain/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_MAC -mmacosx-version-min=10.7  -c -o build/src/Mixer.cpp.o src/Mixer.cpp
39mwhile detecting target
osxcross: error: make[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK/ build/src/SpringReverb.cpp.o] Error 1
cannot find libc++make[2]: *** Waiting for unfinished jobs....
osxcross: error: while detecting target
make[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK/ build/src/EvenVCO.cpp.o] Error 1
osxcross: errormake[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK/ build/src/SlewLimiter.cpp.o] Error 1
: cannot find libc++ headers
osxcross: error: while detecting target
86_64-apple-darwin17-clang++-libc++ -std=c++11 -stdlib=libc++  -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK/include -I/home/build/rack-plugin-toolchain/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_MAC -mmacosx-version-min=10.7  -c -o build/src/DualAtenuverter.cpp.o src/DualAtenuverter.cpp
90mosxcross: error: cannot find libc++ headers
osxcross: error: while detecting target
make[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK/ build/src/ABC.cpp.o] Error 1
x86_64-apple-darwin17-clang++-libc++ -std=c++11 -stdlib=libc++  -fPIC -I/home/build/rack-plugin-toolchain/Rack-SDK/include -I/home/build/rack-plugin-toolchain/Rack-SDK/dep/include -MMD -MP -g -O3 -march=nocona -funsafe-math-optimizations -Wall -Wextra -Wno-unused-parameter -DARCH_MAC -mmacosx-version-min=10.7  -c -o build/src/Rampage.cpp.o src/Rampage.cpp
make[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK/ build/src/plugin.cpp.o] Error 1
osxcross: error: cannot find libc++ headers
osxcross: error: while detecting target
make[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK/ build/src/Mixer.cpp.o] Error 1
osxcross: error: cannot find libc++ headers
osxcross: error: while detecting target
osxcross: error: cannot find libc++ headers
osxcross: error: while detecting target
make[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK/ build/src/DualAtenuverter.cpp.o] Error 1
make[2]: *** [/home/build/rack-plugin-toolchain/Rack-SDK/ build/src/Rampage.cpp.o] Error 1
make[2]: Leaving directory '/home/build/plugin-src'
make[1]: *** [Makefile:122: plugin-build-mac] Error 2
make[1]: Leaving directory '/home/build/rack-plugin-toolchain'
make: *** [Makefile:129: plugin-build] Error 2
make: *** [Makefile:214: docker-plugin-build] Error 2

Log 2)

mboule@palomaru:~/VCVRack/rack-plugin-toolchain$ make docker-build
docker build --tag rack-plugin-toolchain:1 .
Sending build context to Docker daemon  26.69MB
Step 1/20 : FROM ubuntu:20.04
 ---> f63181f19b2f
Step 2/20 : ENV LANG C.UTF-8
 ---> Using cache
 ---> d49774e7e752
Step 3/20 : RUN groupadd -g 1000 build
 ---> Using cache
 ---> 786bb1e05016
Step 4/20 : RUN useradd --create-home --uid 1000 --gid 1000 --shell /bin/bash build
 ---> Using cache
 ---> ceee39cfc48c
Step 5/20 : ENV DEBIAN_FRONTEND=noninteractive
 ---> Using cache
 ---> b3b17891833a
Step 6/20 : RUN apt-get update && apt-get install -y --no-install-recommends make
 ---> Using cache
 ---> ad137f67c7f2
Step 7/20 : USER build
 ---> Using cache
 ---> 0a7976114a56
Step 8/20 : RUN mkdir -p /home/build/rack-plugin-toolchain
 ---> Using cache
 ---> 014b7c456c45
Step 9/20 : WORKDIR /home/build/rack-plugin-toolchain
 ---> Using cache
 ---> 8f45ca887cf5
Step 10/20 : COPY Makefile /home/build/rack-plugin-toolchain/
 ---> Using cache
 ---> b70ecf1e6f64
Step 11/20 : USER root
 ---> Using cache
 ---> d7a1440e3113
Step 12/20 : RUN make dep-ubuntu
 ---> Using cache
 ---> 8541561e16c5
Step 13/20 : RUN rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> 4bf79b67a839
Step 14/20 : USER build
 ---> Using cache
 ---> 9926af782d07
Step 15/20 : COPY MacOSX10.13.sdk.tar.* /home/build/rack-plugin-toolchain/
 ---> Using cache
 ---> 28a0fa903508
Step 16/20 : RUN make toolchain-mac
 ---> Using cache
 ---> 292b02beb392
Step 17/20 : RUN make toolchain-win
 ---> Using cache
 ---> 4916f316fe4a
Step 18/20 : RUN make toolchain-lin
 ---> Using cache
 ---> f65cf5f83e2c
Step 19/20 : RUN make rack-sdk
 ---> Using cache
 ---> 033be23ad3b1
Step 20/20 : RUN rm MacOSX10.13.sdk.tar.*
 ---> Using cache
 ---> 99e850576010
Successfully built 99e850576010
Successfully tagged rack-plugin-toolchain:1
1 Like

do you have the macos sdk installed correctly? linux and win the toolchain doesn’t require anything. But Apple…

I ended up setting up only the windows toolchain, since my issue was that the library version of four of my plugins started crashing once they moved to the new build system.

I think so, in step 16/20 (see log 2 above), it looks like is was able to make the mac toolchain properly. I put that mac sdk file in the specified location before running make docker-build and it looks like it worked, from the looks of things. It’s when I go to build the plugin that it fails, unless there is something wrong with the mac sdk I obtained.

Is it possible your own makefile does something itself with libraries that conflicts? I have to say that the crashes I got with the toolchain really looked to me like library runtimes that didn’t match the headers. Which a) may not be true, and b) probably has nothing to do with your issue.

My makefiles do nothing special though, but just in case, that’s why I tried to build Befaco, since I figured that it’s makefile would be ok.

1 Like

good point. Obviously many plugins in the library must have been build with the toolchain. I don’t know if Befaco has been updated since the change, though. You might look in the library and find something open source that has been updated “recently”.

1 Like

I don’t have any specific advice, but in terms of general, docker advice, I’d try clearing my build cache with docker system prune and then building the container again.

Docker will cache the build layers as a performance enhancement, but sometimes things can become a bit confused. Your build log implies that this could be an issue.

1 Like

It does not work if you don’t have the official macOS SDK. That’s the issue.

1 Like

MacOSX10.15.sdk.tar.xz is about 46 megs on my machine. That’s not the officially supported version, but if the licensing allows it I’m sure you could find someone who could share it. It’s not too big.

[SOLVED] Thanks to everyone for the tips and help. Here’s what I ended up doing, in case it can be of use to others. It requires an account at , but no Mac is actually required, you just need to download the appropriate Xcode from there (Xcode does not need to be installed, and I did all this in Ubuntu).

In a general sense, to know which version of Xcode to download to get a given MacOSX SDK, see the list here: Xcode - Wikipedia (in the list we see that MacOSX SDK 10.13 comes with Xcode 9.0.1)

So once we have our Xcode_9.0.1.xip, then we can follow the procedure as outlined at GitHub - VCVRack/rack-plugin-toolchain which in short consists in cloning GitHub - tpoechtrager/osxcross: Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android (Termux) then using one of it’s scripts to make osxcross build/extract the SDK from the Xcode xip file. After that, we have MacOSX10.13.sdk.tar.xz and we can continue with the toolchain building. I went with the Docker approach, and it successfully built Befaco :slight_smile: so that’s a good sign I think!