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

Most upvoted comments

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.

Screenshot 2020-06-05 at 23 14 38

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:

make -i
[  0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/TCPServer.cpp.o
/Users/diver/serenity/Libraries/LibCore/TCPServer.cpp:40:42: error: use of undeclared identifier 'SOCK_NONBLOCK'
    m_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
                                         ^
/Users/diver/serenity/Libraries/LibCore/TCPServer.cpp:40:58: error: use of undeclared identifier 'SOCK_CLOEXEC'
    m_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
                                                         ^
2 errors generated.
[  0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/TCPSocket.cpp.o
/Users/diver/serenity/Libraries/LibCore/TCPSocket.cpp:46:44: error: use of undeclared identifier 'SOCK_NONBLOCK'
    int fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
                                           ^
1 error generated.
[  0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/UDPServer.cpp.o
/Users/diver/serenity/Libraries/LibCore/UDPServer.cpp:39:41: error: use of undeclared identifier 'SOCK_NONBLOCK'
    m_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
                                        ^
/Users/diver/serenity/Libraries/LibCore/UDPServer.cpp:39:57: error: use of undeclared identifier 'SOCK_CLOEXEC'
    m_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
                                                        ^
2 errors generated.
[  0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/UDPSocket.cpp.o
/Users/diver/serenity/Libraries/LibCore/UDPSocket.cpp:46:43: error: use of undeclared identifier 'SOCK_NONBLOCK'
    int fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
                                          ^
1 error generated.
[  0%] Linking CXX static library libLagomCore.a
ar: CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/TCPServer.cpp.o: No such file or directory
ar: CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/TCPSocket.cpp.o: No such file or directory
ar: CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/UDPServer.cpp.o: No such file or directory
ar: CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/UDPSocket.cpp.o: No such file or directory
[  3%] Built target LagomCore
[  3%] Linking CXX executable IPCCompiler
ld: archive has no table of contents file '../../Meta/Lagom/libLagomCore.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[  3%] Built target IPCCompiler
[  3%] Linking CXX executable FormCompiler
ld: archive has no table of contents file '../../Meta/Lagom/libLagomCore.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[  3%] Built target FormCompiler
[  3%] Linking CXX executable Generate_CSS_PropertyID_cpp
ld: archive has no table of contents file '../../../Meta/Lagom/libLagomCore.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[  3%] Built target Generate_CSS_PropertyID_cpp
[  3%] Linking CXX executable Generate_CSS_PropertyID_h
ld: archive has no table of contents file '../../../Meta/Lagom/libLagomCore.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[  3%] Built target Generate_CSS_PropertyID_h
[  3%] Linking CXX executable TestOptional
^C
MacBookPro:Build diver$ make -i
[  0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/TCPServer.cpp.o
/Users/diver/serenity/Libraries/LibCore/TCPServer.cpp:40:42: error: use of undeclared identifier 'SOCK_NONBLOCK'
    m_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
                                         ^
/Users/diver/serenity/Libraries/LibCore/TCPServer.cpp:40:58: error: use of undeclared identifier 'SOCK_CLOEXEC'
    m_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
                                                         ^
2 errors generated.
[  0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/TCPSocket.cpp.o
/Users/diver/serenity/Libraries/LibCore/TCPSocket.cpp:46:44: error: use of undeclared identifier 'SOCK_NONBLOCK'
    int fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0);
                                           ^
1 error generated.
[  0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/UDPServer.cpp.o
/Users/diver/serenity/Libraries/LibCore/UDPServer.cpp:39:41: error: use of undeclared identifier 'SOCK_NONBLOCK'
    m_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
                                        ^
/Users/diver/serenity/Libraries/LibCore/UDPServer.cpp:39:57: error: use of undeclared identifier 'SOCK_CLOEXEC'
    m_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
                                                        ^
2 errors generated.
[  0%] Building CXX object Meta/Lagom/CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/UDPSocket.cpp.o
/Users/diver/serenity/Libraries/LibCore/UDPSocket.cpp:46:43: error: use of undeclared identifier 'SOCK_NONBLOCK'
    int fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
                                          ^
1 error generated.
[  0%] Linking CXX static library libLagomCore.a
ar: CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/TCPServer.cpp.o: No such file or directory
ar: CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/TCPSocket.cpp.o: No such file or directory
ar: CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/UDPServer.cpp.o: No such file or directory
ar: CMakeFiles/LagomCore.dir/__/__/Libraries/LibCore/UDPSocket.cpp.o: No such file or directory
[  3%] Built target LagomCore
[  3%] Linking CXX executable IPCCompiler
ld: archive has no table of contents file '../../Meta/Lagom/libLagomCore.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[  3%] Built target IPCCompiler
[  3%] Linking CXX executable FormCompiler
ld: archive has no table of contents file '../../Meta/Lagom/libLagomCore.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[  3%] Built target FormCompiler
[  3%] Linking CXX executable Generate_CSS_PropertyID_cpp
ld: archive has no table of contents file '../../../Meta/Lagom/libLagomCore.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[  3%] Built target Generate_CSS_PropertyID_cpp
[  3%] Linking CXX executable Generate_CSS_PropertyID_h
ld: archive has no table of contents file '../../../Meta/Lagom/libLagomCore.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[  3%] Built target Generate_CSS_PropertyID_h
[  3%] Linking CXX executable TestOptional
^C