libsdl-org / SDL

Simple Directmedia Layer
https://libsdl.org
zlib License
8.58k stars 1.61k forks source link

Issue compiling with OSXx64 "lipo: can't figure out the architecture type of:..." #9756

Open jrgleason opened 1 month ago

jrgleason commented 1 month ago

I have a 2015 Macbook using x64 Intel processor. I am trying to follow the steps here but when I run

cmake --build . I get

jackiegleason in ~/Code/gaming/SDL-3/build on branch main > cmake --build .
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
-- Could NOT find LibUSB (missing: LibUSB_LIBRARY LibUSB_INCLUDE_PATH) (found version "LibUSB_VERSION-NOTFOUND")
-- 
-- SDL3 was configured with the following options:
-- 
-- Platform: Darwin-21.6.0
-- 64-bit:   TRUE
-- Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Revision: SDL-prerelease-3.1.2-109-g323bab930
-- Vendor:   
-- 
-- Subsystems:
--   Audio:    ON
--   Video:    ON
--   Render:   ON
--   Camera:   ON
--   Joystick: ON
--   Haptic:   ON
--   Hidapi:   ON
--   Power:    ON
--   Sensor:   ON
--   Dialog:   ON
-- 
-- Options:
--   SDL_ALSA                    (Wanted: OFF): OFF
--   SDL_ALSA_SHARED             (Wanted: OFF): OFF
--   SDL_ALTIVEC                 (Wanted: OFF): OFF
--   SDL_ARMNEON                 (Wanted: ON): OFF
--   SDL_ARMNEON_BLITTERS        (Wanted: OFF): OFF
--   SDL_ARMSIMD                 (Wanted: OFF): OFF
--   SDL_ASAN                    (Wanted: OFF): OFF
--   SDL_ASSEMBLY                (Wanted: ON): ON
--   SDL_ASSERTIONS              (Wanted: auto): auto
--   SDL_AVX                     (Wanted: ON): OFF
--   SDL_AVX2                    (Wanted: ON): OFF
--   SDL_AVX512F                 (Wanted: ON): OFF
--   SDL_BACKGROUNDING_SIGNAL    (Wanted: OFF): OFF
--   SDL_CCACHE                  (Wanted: OFF): OFF
--   SDL_CLANG_TIDY              (Wanted: OFF): OFF
--   SDL_CLOCK_GETTIME           (Wanted: OFF): OFF
--   SDL_COCOA                   (Wanted: ON): ON
--   SDL_DBUS                    (Wanted: OFF): OFF
--   SDL_DIRECTX                 (Wanted: OFF): OFF
--   SDL_DISABLE_INSTALL         (Wanted: OFF): OFF
--   SDL_DISABLE_UNINSTALL       (Wanted: OFF): OFF
--   SDL_DISKAUDIO               (Wanted: ON): ON
--   SDL_DUMMYAUDIO              (Wanted: ON): ON
--   SDL_DUMMYCAMERA             (Wanted: ON): ON
--   SDL_DUMMYVIDEO              (Wanted: ON): ON
--   SDL_FOREGROUNDING_SIGNAL    (Wanted: OFF): OFF
--   SDL_GCC_ATOMICS             (Wanted: ON): ON
--   SDL_HIDAPI                  (Wanted: ON): ON
--   SDL_HIDAPI_JOYSTICK         (Wanted: ON): ON
--   SDL_HIDAPI_LIBUSB           (Wanted: ON): OFF
--   SDL_HIDAPI_LIBUSB_SHARED    (Wanted: ON): OFF
--   SDL_IBUS                    (Wanted: OFF): OFF
--   SDL_INSTALL_TESTS           (Wanted: OFF): OFF
--   SDL_JACK                    (Wanted: OFF): OFF
--   SDL_JACK_SHARED             (Wanted: OFF): OFF
--   SDL_KMSDRM                  (Wanted: OFF): OFF
--   SDL_KMSDRM_SHARED           (Wanted: OFF): OFF
--   SDL_LASX                    (Wanted: OFF): OFF
--   SDL_LIBC                    (Wanted: ON): ON
--   SDL_LIBICONV                (Wanted: OFF): OFF
--   SDL_LIBUDEV                 (Wanted: ON): OFF
--   SDL_LSX                     (Wanted: OFF): OFF
--   SDL_METAL                   (Wanted: ON): ON
--   SDL_MMX                     (Wanted: ON): OFF
--   SDL_OFFSCREEN               (Wanted: ON): ON
--   SDL_OPENGL                  (Wanted: ON): ON
--   SDL_OPENGLES                (Wanted: ON): ON
--   SDL_OSS                     (Wanted: OFF): OFF
--   SDL_PIPEWIRE                (Wanted: OFF): OFF
--   SDL_PIPEWIRE_SHARED         (Wanted: OFF): OFF
--   SDL_PTHREADS                (Wanted: ON): ON
--   SDL_PTHREADS_SEM            (Wanted: ON): ON
--   SDL_PULSEAUDIO              (Wanted: OFF): OFF
--   SDL_PULSEAUDIO_SHARED       (Wanted: OFF): OFF
--   SDL_RENDER_D3D              (Wanted: ON): OFF
--   SDL_RENDER_METAL            (Wanted: ON): ON
--   SDL_RENDER_VULKAN           (Wanted: ON): ON
--   SDL_ROCKCHIP                (Wanted: OFF): OFF
--   SDL_RPATH                   (Wanted: ON): ON
--   SDL_RPI                     (Wanted: OFF): OFF
--   SDL_SNDIO                   (Wanted: OFF): OFF
--   SDL_SNDIO_SHARED            (Wanted: OFF): OFF
--   SDL_SSE                     (Wanted: ON): OFF
--   SDL_SSE2                    (Wanted: ON): OFF
--   SDL_SSE3                    (Wanted: ON): OFF
--   SDL_SSE4_1                  (Wanted: ON): OFF
--   SDL_SSE4_2                  (Wanted: ON): OFF
--   SDL_STATIC_PIC              (Wanted: OFF): OFF
--   SDL_SYSTEM_ICONV            (Wanted: OFF): OFF
--   SDL_TESTS                   (Wanted: OFF): OFF
--   SDL_TESTS_LINK_SHARED       (Wanted: ON): OFF
--   SDL_VIRTUAL_JOYSTICK        (Wanted: ON): ON
--   SDL_VIVANTE                 (Wanted: OFF): OFF
--   SDL_VULKAN                  (Wanted: ON): ON
--   SDL_WASAPI                  (Wanted: OFF): OFF
--   SDL_WAYLAND                 (Wanted: OFF): OFF
--   SDL_WAYLAND_LIBDECOR        (Wanted: OFF): OFF
--   SDL_WAYLAND_LIBDECOR_SHARED (Wanted: OFF): OFF
--   SDL_WAYLAND_SHARED          (Wanted: OFF): OFF
--   SDL_X11                     (Wanted: OFF): OFF
--   SDL_X11_SHARED              (Wanted: OFF): OFF
--   SDL_X11_XCURSOR             (Wanted: OFF): OFF
--   SDL_X11_XDBE                (Wanted: OFF): OFF
--   SDL_X11_XFIXES              (Wanted: OFF): OFF
--   SDL_X11_XINPUT              (Wanted: OFF): OFF
--   SDL_X11_XRANDR              (Wanted: OFF): OFF
--   SDL_X11_XSCRNSAVER          (Wanted: OFF): OFF
--   SDL_X11_XSHAPE              (Wanted: OFF): OFF
--   SDL_XINPUT                  (Wanted: OFF): OFF
-- 
--  Build Shared Library: ON
--  Build Static Library: OFF
--  Build libraries as Apple Framework: OFF
-- 
-- If something was not detected, although the libraries
-- were installed, then make sure you have set the
-- CMAKE_C_FLAGS and CMAKE_PREFIX_PATH CMake variables correctly.
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jackiegleason/Code/gaming/SDL-3/build
[  6%] Built target SDL3_test
Scanning dependencies of target SDL3-shared
[  6%] Building C object CMakeFiles/SDL3-shared.dir/cmake_pch.h.pch
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't figure out the architecture type of: /var/folders/3d/5f6dvvs573zg3ydvxbd0b0h40000gn/T/cmake_pch-3920b4/cmake_pch-arm64.o
clang: error: lipo command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/SDL3-shared.dir/cmake_pch.h.pch] Error 1
make[1]: *** [CMakeFiles/SDL3-shared.dir/all] Error 2
make: *** [all] Error 2

What am I doing wrong? Is there something else I need to do that I am missing?

I see there is some talk about multi-arch needing to have a slightly different CMake file

madebr commented 1 month ago

I don't know why, but perhaps the precompiled headers are causing issues for you.

Can you try configuring with -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON?