serenity: Build is broken on macOS
macOS 10.14.6
cd Toolchain
./BuildIt_x86_64.sh
cd ..
mkdir build
cmake ..
make -i
[ 0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/Base64.cpp.o
[ 0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/FileSystemPath.cpp.o
[ 0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/FlyString.cpp.o
^C
bash-5.0$ make -i -j8
[ 0%] Building ASM object Kernel/CMakeFiles/boot.dir/Arch/i386/Boot/boot.S.o
/bin/sh: /Users/diver/serenity/Toolchain/Local/bin/i686-pc-serenity-gcc: No such file or directory
[ 0%] Building CXX object Libraries/LibC/CMakeFiles/crt0.dir/crt0.cpp.o
[ 0%] Building CXX object Kernel/Modules/CMakeFiles/TestModule.dir/TestModule.o
/bin/sh: /Users/diver/serenity/Toolchain/Local/bin/i686-pc-serenity-g++: No such file or directory
/bin/sh: /Users/diver/serenity/Toolchain/Local/bin/i686-pc-serenity-g++: No such file or directory
[ 0%] Built target boot
[ 0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/FlyString.cpp.o
[ 0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/MappedFile.cpp.o
[ 0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/LogStream.cpp.o
[ 0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/JsonParser.cpp.o
[ 0%] Linking CXX static library libcrt0.a
[ 0%] Linking CXX static library libTestModule.a
[ 0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/JsonValue.cpp.o
Error running link command: No such file or directory
Error running link command: No such file or directory
install: illegal option -- D
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 file2
install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 ... fileN directory
install -d [-v] [-g group] [-m mode] [-o owner] directory ...
[ 0%] Built target TestModule
[ 0%] Built target crt0
[ 0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/AK/SharedBuffer.cpp.o
[ 0%] Building CXX object Libraries/LibM/CMakeFiles/LibM.dir/math.cpp.o
/bin/sh: /Users/diver/serenity/Toolchain/Local/bin/i686-pc-serenity-g++: No such file or directory
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (16 by maintainers)
Commits related to this issue
- Docs: Update FreeBSD instructions ginstall should not be symlinked to install globally. The actual issue of having GNU coreutils prefixed with `g` and not being picked up by CMake can be fixed on CMa... — committed to zpl-zak/serenity by zpl-zak 4 years ago
- Docs: Update FreeBSD instructions (#2510) ginstall should not be symlinked to install globally. The actual issue of having GNU coreutils prefixed with `g` and not being picked up by CMake can be fi... — committed to SerenityOS/serenity by zpl-zak 4 years ago
- Docs: Update FreeBSD instructions (#2510) ginstall should not be symlinked to install globally. The actual issue of having GNU coreutils prefixed with `g` and not being picked up by CMake can be fi... — committed to sppmacd/serenity by zpl-zak 4 years ago
I got it to build and run on macOS by splitting the CMake host tools and actual OS building. I will try to cleanup the patch so that it can be sent as a PR.
We could just check if
ginstall
exists and use that.Just I have been spending some time to try building everything on macOS from latest master with the new CMake Build System. I’ve needed to patch things here and there, but the real issue is another.
I don’t think it’s possible to get it to work unless we split the build process with two separate cmake invocations, with two separate cmake directories, one for support host tools (that must be compiled with host compiler) and one for the OS using serenity’s GCC cross-compiler.
The trick of setting
set(CMAKE_C_COMPILER)
& company at a later stage of the root CMake script, after building host tools, doesn’t work on macOS because once the root project() is called, it will set options like-isysroot
and-mmacosx-version-min
even when using serenity’s GCC, that of course will complain about the unknown option and fail.I’m not a CMake expert, but from what I’ve read, the best solution is to split the compilation in two invocations (or use ExternalProjects or something like that). I’ve not found a way to remove or overwrite such “auto-detected” cxx flags at later stages. CMake is appending them at the end of
CMAKE_CXX_FLAGS
no matter what I am doing.Tried again with BuildIt.sh: