Missing (XCode-related?) symbols when building on MacOS

I’m trying to build Blender for the first time on MacOS, and am encountering some errors when linking:

Consolidate compiler generated dependencies of target blender
[100%] Building C object source/creator/CMakeFiles/blender.dir/buildinfo.c.o
[100%] Linking CXX executable ../../bin/Blender.app/Contents/MacOS/Blender
Undefined symbols for architecture x86_64:
  "_GCControllerDidConnectNotification", referenced from:
      _IOS_JoystickInit in libSDL2.a(SDL_mfijoystick.m.o)
      _IOS_JoystickQuit in libSDL2.a(SDL_mfijoystick.m.o)
  "_GCControllerDidDisconnectNotification", referenced from:
      _IOS_JoystickInit in libSDL2.a(SDL_mfijoystick.m.o)
      _IOS_JoystickQuit in libSDL2.a(SDL_mfijoystick.m.o)
  "_OBJC_CLASS_$_GCController", referenced from:
      objc-class-ref in libSDL2.a(SDL_mfijoystick.m.o)
  "_WebPConfigInitInternal", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpOutput::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpenImageIO_v2_3::ImageSpec const&, OpenImageIO_v2_3::ImageOutput::OpenMode) in libOpenImageIO.a(webpoutput.cpp.o)
  "_WebPDecodeRGBAInto", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::read_current_subimage() in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPDecodeRGBInto", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::read_current_subimage() in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPDemuxDelete", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpenImageIO_v2_3::ImageSpec&) in libOpenImageIO.a(webpinput.cpp.o)
      OpenImageIO_v2_3::webp_pvt::WebpInput::close() in libOpenImageIO.a(webpinput.cpp.o)
      OpenImageIO_v2_3::webp_pvt::WebpInput::~WebpInput() in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPDemuxGetChunk", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpenImageIO_v2_3::ImageSpec&) in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPDemuxGetFrame", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::seek_subimage(int, int) in libOpenImageIO.a(webpinput.cpp.o)
      OpenImageIO_v2_3::webp_pvt::WebpInput::read_subimage(int, bool) in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPDemuxGetI", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpenImageIO_v2_3::ImageSpec&) in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPDemuxInternal", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpenImageIO_v2_3::ImageSpec&) in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPDemuxReleaseChunkIterator", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpenImageIO_v2_3::ImageSpec&) in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPDemuxReleaseIterator", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpenImageIO_v2_3::ImageSpec&) in libOpenImageIO.a(webpinput.cpp.o)
      OpenImageIO_v2_3::webp_pvt::WebpInput::close() in libOpenImageIO.a(webpinput.cpp.o)
      OpenImageIO_v2_3::webp_pvt::WebpInput::~WebpInput() in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPEncode", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpOutput::write_scanline(int, int, OpenImageIO_v2_3::TypeDesc, void const*, long long) in libOpenImageIO.a(webpoutput.cpp.o)
  "_WebPGetDecoderVersion", referenced from:
      OpenImageIO_v2_3::webp_imageio_library_version() in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPGetInfo", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpInput::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpenImageIO_v2_3::ImageSpec&) in libOpenImageIO.a(webpinput.cpp.o)
  "_WebPPictureFree", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpOutput::close() in libOpenImageIO.a(webpoutput.cpp.o)
  "_WebPPictureImportRGB", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpOutput::write_scanline(int, int, OpenImageIO_v2_3::TypeDesc, void const*, long long) in libOpenImageIO.a(webpoutput.cpp.o)
  "_WebPPictureImportRGBA", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpOutput::write_scanline(int, int, OpenImageIO_v2_3::TypeDesc, void const*, long long) in libOpenImageIO.a(webpoutput.cpp.o)
  "_WebPPictureInitInternal", referenced from:
      OpenImageIO_v2_3::webp_pvt::WebpOutput::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, OpenImageIO_v2_3::ImageSpec const&, OpenImageIO_v2_3::ImageOutput::OpenMode) in libOpenImageIO.a(webpoutput.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [bin/Blender.app/Contents/MacOS/Blender] Error 1
make[2]: *** [source/creator/CMakeFiles/blender.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2

What did I forget to do here?
The only thing I can think of as potentially unusual is that I ran make update, then checked out v3.1.2 before calling make.
Calling xcode-select --install shows that XCode is already installed.

You’re building the 3.1 code with the 3.2 libraries. Try running make update after checking out v3.1.2, to make it switch to the 3.1 libraries.

1 Like

I was able to build after doing something similar.

make update doesn’t work with a detached head, so I branched at v3.1.2, deleted the build directory, then ran both make update and make with the new branch.