Search code examples
macosvlc

VLC compile on mac can't find MacOSX.sdk


Following the VLC macOSCompile wiki page. Using the single command build instructions. I'm running 10.14.6 with Xcode 11.3.1 commandline tools, developer signed, etc.

Important note -- my MacOSX.sdk file is located here: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk

All is good through build to create makefile, completes bootstrap and runs make. Then I get the following error -- how do I point VLC to the location where my MacOSX.sdk file is located?

IOW how do I set vlc's "contrib environment"?

Please note in the code snip below, that contrib sets the MacOSX.sdk file pointer to the WRONG location - how do I fix?

Do I need to edit something in the vlc source? Thanks. errors:

Setting base environment
Using VLC root dir /Users/GR99/temp/VLC/vlc and triplet x86_64-apple-darwin18
[build] Checking for python3 ...
Python 3.8.1
[build] Building in "/Users/GR99/temp/VLC/vlc/build"
[build] Building building tools
You are ready to build VLC and its contribs
Setting symbol environment
Setting contrib environment with minimum macOS version 10.11 and SDK /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
[build] Building contribs
Packages licensing...    GPL version 3
Creating makefile...
Bootstrap completed.
Run "make" to start compilation.

....

make: Nothing to be done for `fetch'.
make: `.gettext' is up to date.
# Framework
cd breakpad/src/client/mac/ && xcodebuild MACOSX_DEPLOYMENT_TARGET=10.11 -sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk WARNING_CFLAGS=-Werror=partial-availability OTHER_CFLAGS=-fno-stack-check -arch x86_64 CLANG_CXX_LIBRARY=libc++
# Build Sparkle and change the @rpath
cd sparkle && xcodebuild MACOSX_DEPLOYMENT_TARGET=10.11 -sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk WARNING_CFLAGS=-Werror=partial-availability OTHER_CFLAGS=-fno-stack-check -arch x86_64
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" cannot be located.
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" cannot be located.
make: *** [.sparkle] Error 64
make: *** [.breakpad] Error 64
make: Target `all' not remade because of errors.
# Framework
cd breakpad/src/client/mac/ && xcodebuild MACOSX_DEPLOYMENT_TARGET=10.11 -sdk /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk WARNING_CFLAGS=-Werror=partial-availability OTHER_CFLAGS=-fno-stack-check -arch x86_64 CLANG_CXX_LIBRARY=libc++
xcodebuild: error: SDK "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" cannot be located.
make: *** [.breakpad] Error 64

Solution

  • cf: ../extras/package/macosx/build.sh -h
    It says:

    usage: extras/package/macosx/build.sh [options]
    
    Build vlc in the current directory
    
    OPTIONS:
       -h            Show some help
       -q            Be quiet
       -j            Force number of cores to be used
       -r            Rebuild everything (tools, contribs, vlc)
       -c            Recompile contribs from sources
       -p            Build packages for all artifacts
       -i <n|u>      Create an installable package (n: nightly, u: unsigned stripped release archive)
       -k <sdk>      Use the specified sdk (default: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk)
       -a <arch>     Use the specified arch (default: x86_64)
       -C            Use the specified VLC build dir
       -b <url>      Enable breakpad support and send crash reports to this URL
       -d            Disable debug mode (on by default)
    

    Your build command should also include the location of your SDK using the -k option:

    ../extras/package/macosx/build.sh -c -k /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk

    The script uses xcrun --show-sdk-path to set the SDK otherwise. xcrun uses the environment variable $SDKROOT.

    Note: You might want to install and use the versioned SDK, for example in your question the output shows that it is targeting minimum El Capitan, /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk The versioned SDKs are available in old Xcodes, and on github.

    Setting up the "contrib environment" is all handled by the "single command".