Skip to content

Conversation

@MacThings
Copy link

Added macOS build instructions to README.

Added macOS build instructions to README.
Copy link
Member

@Flamefire Flamefire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the information and your tests!

I'd like to focus on making it possible to build it on macOS out of the box like on any other system. We do have Intel macOS builds and I guess @Flow86 could add builds and downloads for arm64 too. That would require ensuring it works at all for which your insights will be helpful.

So I added a couple questions with the aim to know why non-default CMake options can are required and how those issues can be resolved in code instead.

README.md Outdated
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_PREFIX_PATH="/opt/homebrew" \
-DENABLE_TESTS=OFF \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This likely doesn't has any effect. Which issue does this solve?

README.md Outdated
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_PREFIX_PATH="/opt/homebrew" \
-DENABLE_TESTS=OFF \
-DCMAKE_CXX_FLAGS="-std=c++17 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is better done by -DCMAKE_CXX_STANDARD=17, but why do it anyway? The CMake files already ensure this is done. Have you tried without that?

README.md Outdated
Comment on lines 112 to 116
-Wno-error=missing-noreturn \
-Wno-error=deprecated-copy \
-Wno-error=unused-parameter \
-Wno-error=undef \
-Wno-error=cast-qual" ..
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need that? If so we should fix it in the code so they are not required.

Can you use -DRTTR_ENABLE_WERROR=OFF and post the list of those warnings please?

README.md Outdated
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't it work without that? We have code that should ensure it works out of the box

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMAKE_OSX_ARCHITECTURES may not contain arm64 by default

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default it is empty. In that case we detect the supported architectures including arm64: https://github.com/Return-To-The-Roots/libutil/blob/7198609c21eae58c31cee5e88c76dc3eddea603f/cmake/DetectOsXArchs.cmake#L61

We then use CMAKE_SYSTEM_PROCESSOR to select that or all available archs. That is set to uname -m by CMake.

So my question is what exactly fails in the current workflow such that we can improve it for everyone.

@Flow86
Copy link
Member

Flow86 commented Oct 19, 2025

We do have Intel macOS builds and I guess @Flow86 could add builds and downloads for arm64 too.

I can't, I think there were some issues cross compiling some of the dependencies and/or getting the arm64 build to work

@MacThings
Copy link
Author

MacThings commented Nov 2, 2025

I pulled the repo again and now I get this error if I try to compile:

luigi@M4:~/Documents/GitHub/s25client/build$ cmake -DCMAKE_BUILD_TYPE=Release ..
-- Using CMake 4.1.2
CMake Error at CMakeLists.txt:27 (include):
  include could not find requested file:

    EnableCCache


CMake Error at CMakeLists.txt:75 (include):
  include could not find requested file:

    EnsureOutOfSourceBuild


-- Configuring for native compiling to Darwin-25.0.0 on arm64
-- Using platform config cmake/darwin.cmake
CMake Error at cmake/darwin.cmake:6 (include):
  include could not find requested file:

    DetectOsXArchs
Call Stack (most recent call first):
  CMakeLists.txt:104 (include)


CMake Error at cmake/darwin.cmake:7 (detect_osx_archs):
  Unknown CMake command "detect_osx_archs".
Call Stack (most recent call first):
  CMakeLists.txt:104 (include)


-- Configuring incomplete, errors occurred!

ccache is installed. macOS 26.

@Flamefire
Copy link
Member

You need a recursive clone or init and update the submodules

@MacThings
Copy link
Author

MacThings commented Nov 2, 2025

Ok I did recurse. Now building starts but stopps here (9%):

ld: symbol(s) not found for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [Contents/MacOS/Test_samplerate_cpp] Error 1
make[1]: *** [tests/libsamplerate_cpp/CMakeFiles/Test_samplerate_cpp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
In file included from /Users/luigi/Documents/GitHub/s25client/external/libutil/libs/common/src/Serializer.cpp:5:
In file included from /Users/luigi/Documents/GitHub/s25client/external/libutil/libs/common/include/s25util/Serializer.h:8:
In file included from /usr/local/include/boost/container/vector.hpp:32:
In file included from /usr/local/include/boost/container/detail/advanced_insert_int.hpp:42:
/usr/local/include/boost/move/detail/launder.hpp:47:24: error: cast from 'const volatile void *' to 'unsigned char *' drops const and volatile qualifiers [-Werror,-Wcast-qual]
   47 |    return (launder)((T)p);
      |                        ^


@Flamefire
Copy link
Member

This is this issue: boostorg/move#61

I'm wondering why warning inside system libs are triggered though. /usr/local/include should be exempt from warnings.

@MacThings
Copy link
Author

MacThings commented Nov 2, 2025

Got it!

	cmake .. \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_PREFIX_PATH="/opt/homebrew" \
		-DCMAKE_IGNORE_PATH="/usr/local" \
		-DCMAKE_CXX_FLAGS="-std=c++17 \
		-Wno-error=missing-noreturn \
		-Wno-error=deprecated-copy \
		-Wno-error=unused-parameter \
		-Wno-error=undef \
		-Wno-error=cast-qual" ..
	make -j$(sysctl -n hw.ncpu)
  • with -std=c++17 it compiles 10 times faster
  • adding -DCMAKE_IGNORE_PATH="/usr/local" (because in build process it accessed /usr/local which was wrong because /opt/homebrew is provided for arm64
  • Wno-error excludes seems to be essential. If I deleted one of these lines compiling fails''

If anyone of your team has a M device could test my build:

https://www.slsoft.de/s25client/

@Flamefire
Copy link
Member

Wno-error excludes seems to be essential. If I deleted one of them compiling fails''

Can you use -DRTTR_ENABLE_WERROR=OFF and post the list of those warnings please?

with -std=c++17 it compiles 10 times faster

I can't see how: We already compile RTTR with C++17 so I don't see what difference this makes especially not 10x. Any idea?

adding -DCMAKE_IGNORE_PATH="/usr/local" (because in build process it accessed /usr/local which was wrong because /opt/homebrew is provided for arm64

Can you explain that? What is accessed exactly?

@MacThings
Copy link
Author

MacThings commented Nov 2, 2025

Without

-DCMAKE_PREFIX_PATH="/opt/homebrew"
I get

[  5%] Generating gen/languages/rttr-ko.mo
/opt/homebrew/bin/msgmerge: ld: warning: ignoring file '/usr/local/lib/libboost_unit_test_framework.dylib': found architecture 'x86_64', required architecture 'arm64'

by the way now I don't need to exclude /usr/local explicit for some reason ... strange.

Ok without C++17 Parameter it compiles now as the same speed. Don't know what was the problem before that it was kinda slow.

If i put only

-DRTTR_ENABLE_WERROR=OFF

it drops this error and stopps (it accessed /usr/local which is wrong?):

In file included from /usr/local/include/boost/container/detail/advanced_insert_int.hpp:42:
/usr/local/include/boost/move/detail/launder.hpp:47:24: error: cast from 'const volatile void *' to 'unsigned char *' drops const and volatile qualifiers [-Werror,-Wcast-qual]
   47 |    return (launder)((T)p);
      |                        ^

@MacThings
Copy link
Author

Here the complete log
compile.log

@Flamefire
Copy link
Member

Ok so all warnings are from inside Boost in /usr/local. However it finds a homebrew Boost:

-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.89.0/BoostConfig.cmake

This shouldn't happen but could explain the warnings. Do the paths in the config files under /opt/homebrew/lib/cmake/Boost-1.89.0 somehow refer to /usr/local?

I also can't see where the -Werror is added if not by -DRTTR_ENABLE_WERROR=ON

How exactly is your s25 alias defined? Does it really set -DRTTR_ENABLE_WERROR=OFF?

But most important is the Boost-location thing. If you run with make VERBOSE=1 V=1 you should see the compiler invocation. Is the include path to Boost passed correctly or is it followed by some include path to /usr/local?

@Flow86
Copy link
Member

Flow86 commented Nov 2, 2025

with -std=c++17 it compiles 10 times faster

if you set CMAKE_CXX_FLAGS manually, its removing all predefined optimizations

@MacThings
Copy link
Author

MacThings commented Nov 2, 2025

All in

/opt/homebrew/lib/cmake

points to ../../Cellar. Ok so far.

drwxr-xr-x   4 luigi  admin   128B 14 Aug. 03:41 ./
drwxr-xr-x  48 luigi  admin   1,5K 14 Aug. 03:41 ../
-r--r--r--   1 luigi  admin   9,4K 14 Aug. 03:41 BoostConfig.cmake
-r--r--r--   1 luigi  admin   304B 14 Aug. 03:41 BoostConfigVersion.cmake
luigi@M4:/opt/homebrew/Cellar/boost/1.89.0/lib/cmake/Boost-1.89.0$ 

Here I added logs from all scenarios. The given cmake parameters are at the top.

compile1.log
compile4.log
compile3.log
compile2.log

And by the way .... with

cmake .. \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_PREFIX_PATH="/opt/homebrew" \
	-DRTTR_ENABLE_WERROR=OFF ..

it compiles fine now. If I try without the PATH of homebrew it fails.

One important thing: To get the dylib linkings in the .app "independent" I do this:

    cd s25client.app/Contents/MacOS
	dylibbundler -of -cd -b -x s25client -d "libs" -p "@executable_path/libs/"
	dylibbundler -of -cd -b -x starter  -d "libs" -p "@executable_path/libs/"
	
	cd driver/video
	dylibbundler -of -cd -b -x libvideoSDL2.dylib -d "../../libs" -p "@executable_path/libs/"
	install_name_tool -add_rpath "@executable_path/../Frameworks" libvideoSDL2.dylib
	install_name_tool -id "@loader_path/libvideoSDL2.dylib" libvideoSDL2.dylib
	install_name_tool -add_rpath "@loader_path/../../libs" libvideoSDL2.dylib
	install_name_tool -add_rpath "@executable_path/libs" libvideoSDL2.dylib
	
	cd ../audio
	dylibbundler -of -cd -b -x libaudioSDL.dylib -d "../../libs" -p "@executable_path/libs/"
	install_name_tool -add_rpath "@executable_path/../Frameworks" libaudioSDL.dylib
	install_name_tool -id "@loader_path/libaudioSDL.dylib" libaudioSDL.dylib
	install_name_tool -add_rpath "@loader_path/../../libs" libaudioSDL.dylib
	install_name_tool -add_rpath "@executable_path/libs" libaudioSDL.dylib


@Flamefire
Copy link
Member

Flamefire commented Nov 3, 2025

Ok without C++17 Parameter it compiles now as the same speed. Don't know what was the problem before that it was kinda slow.

Just seen you are using ccache in the builds so the 10x might be because of the warm ccache cache and the relation to adding that flag just chance. Would then have been the same when removing the flag after initially adding it.

All in

/opt/homebrew/lib/cmake

points to ../../Cellar. Ok so far.

drwxr-xr-x   4 luigi  admin   128B 14 Aug. 03:41 ./
drwxr-xr-x  48 luigi  admin   1,5K 14 Aug. 03:41 ../
-r--r--r--   1 luigi  admin   9,4K 14 Aug. 03:41 BoostConfig.cmake
-r--r--r--   1 luigi  admin   304B 14 Aug. 03:41 BoostConfigVersion.cmake
luigi@M4:/opt/homebrew/Cellar/boost/1.89.0/lib/cmake/Boost-1.89.0$ 

Is it possible that Boost isn't properly installed? Can you try cmake with -DBoost_VERBOSE=ON -DBoost_DEBUG=ON?
Also check that there is /opt/homebrew/Cellar/boost/1.89.0/include and /opt/homebrew/Cellar/boost/1.89.0/lib/cmake/boost_system-1.87.0/boost_system-config.cmake as well as the content of that file?

And by the way .... with

cmake .. \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_PREFIX_PATH="/opt/homebrew" \
	-DRTTR_ENABLE_WERROR=OFF ..

it compiles fine now. If I try without the PATH of homebrew it fails.

So I guess your system isn't arm64 then?
Anyway great it worked!

One important thing: To get the dylib linkings in the .app "independent" I do this:

We use a CMake module for that for our releases. It gets activated with -DRTTR_BUNDLE=ON which should do this fixup upon install. I.e. you need -DCMAKE_INSTALL_PREFIX=<path> and install with make install after build

@MacThings
Copy link
Author

luigi@M4:~$ ls -l /opt/homebrew/Cellar/boost/1.89.0
total 40
drwxr-xr-x   3 luigi  admin    96B 14 Aug. 03:41 include/
-rw-r--r--   1 luigi  admin   4,6K  2 Nov. 17:18 INSTALL_RECEIPT.json
drwxr-xr-x  83 luigi  admin   2,6K  2 Nov. 17:18 lib/
-rw-r--r--   1 luigi  admin   541B 14 Aug. 03:41 README.md
-rw-r--r--   1 luigi  admin   6,5K  2 Nov. 17:18 sbom.spdx.json
drwxr-xr-x   3 luigi  admin    96B 14 Aug. 03:41 share/
luigi@M4:~$ ls - /opt/homebrew/Cellar/boost/1.89.0/lib/cmake/
boost_atomic-1.89.0/               boost_filesystem-1.89.0/           boost_math_c99f-1.89.0/            boost_random-1.89.0/               boost_unit_test_framework-1.89.0/
boost_charconv-1.89.0/             boost_graph_parallel-1.89.0/       boost_math_c99l-1.89.0/            boost_regex-1.89.0/                boost_url-1.89.0/
boost_chrono-1.89.0/               boost_graph-1.89.0/                boost_math_tr1-1.89.0/             boost_serialization-1.89.0/        boost_wave-1.89.0/
boost_container-1.89.0/            boost_headers-1.89.0/              boost_math_tr1f-1.89.0/            boost_stacktrace_addr2line-1.89.0/ boost_wserialization-1.89.0/
boost_context-1.89.0/              boost_iostreams-1.89.0/            boost_math_tr1l-1.89.0/            boost_stacktrace_basic-1.89.0/     Boost-1.89.0/
boost_contract-1.89.0/             boost_json-1.89.0/                 boost_math-1.89.0/                 boost_stacktrace_noop-1.89.0/      BoostDetectToolset-1.89.0.cmake
boost_coroutine-1.89.0/            boost_locale-1.89.0/               boost_nowide-1.89.0/               boost_test_exec_monitor-1.89.0/    
boost_date_time-1.89.0/            boost_log_setup-1.89.0/            boost_prg_exec_monitor-1.89.0/     boost_thread-1.89.0/               
boost_exception-1.89.0/            boost_log-1.89.0/                  boost_process-1.89.0/              boost_timer-1.89.0/                
boost_fiber-1.89.0/                boost_math_c99-1.89.0/             boost_program_options-1.89.0/      boost_type_erasure-1.89.0/    

boost_system......./boost_system-config.cmake

is missing.

I compiled with

-DBoost_VERBOSE=ON -DBoost_DEBUG=ON

Here is the log
compile5.log

I'm on an ARM System here (M4 Max).

@MacThings
Copy link
Author

MacThings commented Nov 3, 2025

I tried the "make install" method and got this:

compile6.log

If I copy the 2 SDL FW to the Build Folder:

-rw-r--r--   1 luigi  staff   5,9K  3 Nov. 11:28 cmake_install.cmake
-rw-r--r--   1 luigi  staff    39K  3 Nov. 11:28 CMakeCache.txt
drwxr-xr-x  17 luigi  staff   544B  3 Nov. 11:36 CMakeFiles/
drwxr-xr-x   3 luigi  staff    96B  3 Nov. 11:27 Contents/
-rw-r--r--   1 luigi  staff   2,3K  3 Nov. 11:28 copyDepsToBuildDir.cmake
-rw-r--r--   1 luigi  staff   3,8K  3 Nov. 11:28 CPackConfig.cmake
-rw-r--r--   1 luigi  staff   3,9K  3 Nov. 11:28 CPackSourceConfig.cmake
-rw-r--r--   1 luigi  staff   393B  3 Nov. 11:28 CTestTestfile.cmake
drwxr-xr-x  15 luigi  staff   480B  3 Nov. 11:28 external/
drwxr-xr-x  10 luigi  staff   320B  3 Nov. 11:28 extras/
drwxr-xr-x   3 luigi  staff    96B  3 Nov. 11:28 gen/
-rw-r--r--   1 luigi  staff   1,2K  3 Nov. 11:28 Info.plist
drwxr-xr-x  13 luigi  staff   416B  3 Nov. 11:28 libs/
-rw-r--r--   1 luigi  staff    31K  3 Nov. 11:28 Makefile
drwxr-xr-x@  6 luigi  staff   192B  1 Nov. 12:30 SDL2_mixer.framework/
drwxr-xr-x@  6 luigi  staff   192B  1 Nov. 12:30 SDL2.framework/
-rwxr-xr-x   1 luigi  staff   1,8K  3 Nov. 11:27 start.sh*
drwxr-xr-x  16 luigi  staff   512B  3 Nov. 11:28 tests/
drwxr-xr-x   3 luigi  staff    96B  3 Nov. 11:28 tools/

it continues but stuck here:

-- fixup_bundle: preparing...
-- 
warning: cannot resolve item '@rpath/gme.framework/Versions/A/gme'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- warning: gp_resolved_file_type non-absolute file '@rpath/gme.framework/Versions/A/gme' returning type 'other' -- possibly incorrect
-- 
warning: cannot resolve item '@rpath/gme.framework/Versions/A/gme'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- 
warning: cannot resolve item '@rpath/xmp.framework/Versions/A/xmp'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- warning: gp_resolved_file_type non-absolute file '@rpath/xmp.framework/Versions/A/xmp' returning type 'other' -- possibly incorrect
-- 
warning: cannot resolve item '@rpath/xmp.framework/Versions/A/xmp'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- 
warning: cannot resolve item '@rpath/opus.framework/Versions/A/opus'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- warning: gp_resolved_file_type non-absolute file '@rpath/opus.framework/Versions/A/opus' returning type 'other' -- possibly incorrect
-- 
warning: cannot resolve item '@rpath/opus.framework/Versions/A/opus'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- 
warning: cannot resolve item '@rpath/gme.framework/Versions/A/gme'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- warning: gp_resolved_file_type non-absolute file '@rpath/gme.framework/Versions/A/gme' returning type 'other' -- possibly incorrect
-- 
warning: cannot resolve item '@rpath/xmp.framework/Versions/A/xmp'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- warning: gp_resolved_file_type non-absolute file '@rpath/xmp.framework/Versions/A/xmp' returning type 'other' -- possibly incorrect
-- 
warning: cannot resolve item '@rpath/opus.framework/Versions/A/opus'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- warning: gp_resolved_file_type non-absolute file '@rpath/opus.framework/Versions/A/opus' returning type 'other' -- possibly incorrect
-- 
warning: cannot resolve item '@rpath/gme.framework/Versions/A/gme'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

CMake Error at /opt/homebrew/share/cmake/Modules/BundleUtilities.cmake:729 (message):
  otool -l failed: 1

  error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't
  open file: @rpath/gme.framework/Versions/A/gme (No such file or directory)

Call Stack (most recent call first):
  /opt/homebrew/share/cmake/Modules/BundleUtilities.cmake:798 (get_item_rpaths)
  /opt/homebrew/share/cmake/Modules/BundleUtilities.cmake:885 (set_bundle_key_values)
  /opt/homebrew/share/cmake/Modules/BundleUtilities.cmake:1204 (get_bundle_keys)
  tools/release/cmake_install.cmake:45 (fixup_bundle)
  cmake_install.cmake:105 (include)


make: *** [install] Error 1

@Flamefire
Copy link
Member

Flamefire commented Nov 3, 2025

boost_system......./boost_system-config.cmake

is missing.

I see, that's not a compiled library anymore which might be the reason. Check e.g. boost_headers. I'm looking for something like: get_filename_component(_BOOST_INCLUDEDIR "${_BOOST_CMAKEDIR}/../../../" ABSOLUTE) and where it sets _BOOST_CMAKEDIR to find out what it is supposed to pass as an include folder.

I see -isystem /opt/homebrew/include and the cmdline but still including /usr/local/include/boost/iostreams/stream.hpp

Is there a /opt/homebrew/include/boost/iostreams/stream.hpp?
Do you have /usr/local/include set in your $CPATH?

I'm on an ARM System here (M4 Max).

So you are supposedly compiling for the same system you are on? Or is this not an arm64 system? Otherwise I don't understand how the files like /usr/local/lib/libboost_unit_test_framework.dylib /usr/local/Cellar/libsamplerate/0.2.2/lib/libsamplerate.dylib don't contain symbols for the architecture they are installed for. Any ideas?

I tried the "make install" method and got this:

Found an open issue for this: https://discourse.cmake.org/t/unable-to-resolve-rpath-not-found/5325 -.-
Looks like in CMake 3.21 we can use install(RUNTIME_DEPENDENCY_SET but that requires a few more changes

@MacThings
Copy link
Author

I recognized that pkg-config was not installed for arm64. Did it now.

Than in .bashrc only this was there:

export PATH="/usr/local/sbin:$PATH"

changed it to

export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"

All /opt/homebrew

-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.89.0/BoostConfig.cmake (found suitable version "1.89.0", minimum required is "1.64")
-- Found SDL2: /Users/luigi/Library/Frameworks/SDL2.framework/Headers (found version "2.30.11")
-- Found SampleRate: /opt/homebrew/Cellar/libsamplerate/0.2.2/lib/libsamplerate.dylib (found suitable version "0.2.2", minimum required is "0.1.9")
-- Found Lua: /Users/luigi/Documents/GitHub/s25client/external/dev-tools/lua/mac/lib/liblua52.a (found suitable version "5.2.1", minimum required is "5.1")
-- Found BZip2: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libbz2.tbd (found suitable version "1.0.8", minimum required is "1.0.6")
-- Looking for BZ2_bzCompressInit
-- Looking for BZ2_bzCompressInit - found
-- Looking for backtrace
-- Looking for backtrace - found
-- backtrace facility detected in default set of libraries
-- Found Backtrace: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
-- Found SDL2: /Users/luigi/Library/Frameworks/SDL2.framework/Headers (found suitable version "2.30.11", minimum required is "2")
-- Found SDL_mixer: /Users/luigi/Library/Frameworks/SDL2_mixer.framework (found suitable version "2.8.0", minimum required is "2.0.1")
-- Found SDL2: /Users/luigi/Library/Frameworks/SDL2.framework/Headers (found suitable version "2.30.11", minimum required is "2.0.5")
-- Found Gettext: /opt/homebrew/bin/msgmerge

but it´s still stopping here and seeking in /usr/local:

In file included from /Users/luigi/Documents/GitHub/s25client/external/libutil/libs/common/src/Serializer.cpp:5:
In file included from /Users/luigi/Documents/GitHub/s25client/external/libutil/libs/common/include/s25util/Serializer.h:8:
In file included from /usr/local/include/boost/container/vector.hpp:32:
In file included from /usr/local/include/boost/container/detail/advanced_insert_int.hpp:42:
/usr/local/include/boost/move/detail/launder.hpp:47:24: error: cast from 'const volatile void *' to 'unsigned char *' drops const and volatile qualifiers [-Werror,-Wcast-qual]
   47 |    return (launder)((T)p);

stream.hpp is in place

luigi@M4:~/Documents/GitHub/s25client/build$ ls -l /opt/homebrew/include/boost/iostreams/stream.hpp
-rw-r--r--  1 luigi  admin   6,0K 14 Aug. 03:41 /opt/homebrew/include/boost/iostreams/stream.hpp

This here is an arm64 System. Apple Silicon is always arm64.

@Flamefire
Copy link
Member

Ok so the files are there but not used for some reason. Did you check $CPATH as I suggested above? Maybe even search the whole env: env | grep /usr/local/include

You can try to reproduce with a MWE:

  • echo '#include <boost/iostreams/stream.hpp>' | /usr/bin/c++ -xc++ -E --std=c++17 -isystem /opt/homebrew/include -
  • or: echo '#include <boost/iostreams/stream.hpp>' | /usr/bin/c++ -xc++ -E --std=c++17 -arch arm64 -isystem /opt/homebrew/include -
  • and directly: /usr/bin/c++ -xc++ -E -v -isystem /opt/homebrew/include - < /dev/null

The first 2 should somewhere in the output show the filepath to stream.hpp actually used. The last one should print a list of paths used in order of usage and some information why some are used (or not)

This here is an arm64 System. Apple Silicon is always arm64.

Then there must be a problem with this specific system: Why would x86 system files be installed there:

ld: warning: ignoring file '/usr/local/lib/libboost_unit_test_framework.dylib': found architecture 'x86_64', required architecture 'arm64'
ld: warning: ignoring file '/usr/local/Cellar/libsamplerate/0.2.2/lib/libsamplerate.dylib': found architecture 'x86_64', required architecture 'arm64'

Is it possible that those files were copied from another system?

@MacThings
Copy link
Author

MacThings commented Nov 3, 2025

That's my CPATH:

/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/java/bin:/usr/local/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin://Applications/Topaz Gigapixel AI.app/Contents/Resources/bin:/Library/Apple/usr/bin:/Applications/Little Snitch.app/Contents/Components:/usr/local/go/bin:/Users/luigi/.lmstudio/bin:/Users/luigi/.lmstudio/bin:/Users/luigi/.lmstudio/bin

And here MWE:

luigi@M4:~/Documents/GitHub/s25client/build$ /usr/bin/c++ -xc++ -E -v -isystem /opt/homebrew/include - < /dev/null
Apple clang version 17.0.0 (clang-1700.3.19.1)
Target: arm64-apple-darwin25.0.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
ignoring nonexistent directory "/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1"
 "/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple arm64-apple-macosx26.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -E -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mframe-pointer=non-leaf -fno-strict-return -ffp-contract=on -fno-rounding-math -funwind-tables=1 -fobjc-msgsend-selector-stubs -target-sdk-version=26.0 -fvisibility-inlines-hidden-static-local-var -fdefine-target-os-macros -fno-assume-unique-vtables -fno-modulemap-allow-subdirectory-search -target-cpu apple-m1 -target-feature +zcm -target-feature +zcz -target-feature +v8.5a -target-feature +aes -target-feature +altnzcv -target-feature +ccdp -target-feature +complxnum -target-feature +crc -target-feature +dotprod -target-feature +fp-armv8 -target-feature +fp16fml -target-feature +fptoint -target-feature +fullfp16 -target-feature +jsconv -target-feature +lse -target-feature +neon -target-feature +pauth -target-feature +perfmon -target-feature +predres -target-feature +ras -target-feature +rcpc -target-feature +rdm -target-feature +sb -target-feature +sha2 -target-feature +sha3 -target-feature +specrestrict -target-feature +ssbs -target-abi darwinpcs -debugger-tuning=lldb -fdebug-compilation-dir=/Users/luigi/Documents/GitHub/s25client/build -target-linker-version 1221.4 -v -fcoverage-compilation-dir=/Users/luigi/Documents/GitHub/s25client/build -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/17 -isystem /opt/homebrew/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/17/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -internal-iframework /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks -internal-iframework /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/SubFrameworks -internal-iframework /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -fdeprecated-macro -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -clang-vendor-feature=+disableAtImportPrivateFrameworkInImplementationError -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o - -x c++ -
clang -cc1 version 17.0.0 (clang-1700.3.19.1) default target arm64-apple-darwin25.0.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /opt/homebrew/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
 /Library/Developer/CommandLineTools/usr/lib/clang/17/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
 /Library/Developer/CommandLineTools/usr/include
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/SubFrameworks (framework directory)
End of search list.
# 1 "<stdin>"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 514 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "<stdin>" 2

No the files are fresh from brew. I have /usr/local too because I did crosscompiling for another apps/projects as Universal Binary. Installed it with

arch -x86_64 /usr/local/bin/brew install XYZ

@Flamefire
Copy link
Member

Ok, that helps a lot.

That's my CPATH:

That seems to be your $PATH not $CPATH, note the "C". The output you posted (part below) looks like /usr/local is in there:

#include <...> search starts here:
 /usr/local/include
 /opt/homebrew/include

Remove that and it should take the correct boost headers.

No the files are fresh from brew. I have /usr/local too because I did crosscompiling for another apps/projects as Universal Binary. Installed it with

arch -x86_64 /usr/local/bin/brew install XYZ

I'm not so used to macos multi-arch but it seems /usr/local is for the x64 (rosetta) files and /opt/homebrew for arm. So that is expected and we need CMake to search the arm folder first. You can do that with CMAKE_PREFIX_PATH=/opt/homebrew (as you did) or (according to ChatGPT, I don't have a Mac) by running the arm CMake (/opt/homebrew/bin/cmake) which should search the arm folder instead of /usr/local.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants