SerenityOS / serenity

The Serenity Operating System 🐞
https://serenityos.org
BSD 2-Clause "Simplified" License
30.67k stars 3.19k forks source link

Can't build on macOS with "Unix Makefiles" generator: crt0_shared.o not found #6657

Closed keith-rollin closed 3 years ago

keith-rollin commented 3 years ago

When using cmake to generate make-based build scripts, I get the following error when building:

...
[  5%] Building ASM object Userland/Libraries/LibC/CMakeFiles/LibCStaticWithoutDeps.dir/__/LibELF/Arch/i386/plt_trampoline.S.o
[  5%] Building ASM object Userland/Libraries/LibC/CMakeFiles/LibCStaticWithoutDeps.dir/arch/i386/setjmp.S.o
[  5%] Linking CXX static library libLibCStaticWithoutDeps.a
[  5%] Built target LibCStaticWithoutDeps
[  5%] Built target LibCStatic
Scanning dependencies of target LibC
[  5%] Building CXX object Userland/Libraries/LibC/CMakeFiles/LibC.dir/arpa/inet.cpp.o
[  5%] Building CXX object Userland/Libraries/LibC/CMakeFiles/LibC.dir/assert.cpp.o
...
[  7%] Building ASM object Userland/Libraries/LibC/CMakeFiles/LibC.dir/__/LibELF/Arch/i386/plt_trampoline.S.o
[  7%] Building ASM object Userland/Libraries/LibC/CMakeFiles/LibC.dir/arch/i386/setjmp.S.o
[  7%] Linking CXX shared library libc.so
/Users/keith/dev/serenity/Toolchain/Local/i686/bin/../lib/gcc/i686-pc-serenity/10.3.0/../../../../i686-pc-serenity/bin/ld: cannot find crt0_shared.o: No such file or directory
collect2: error: ld returned 1 exit status
make[2]: *** [Userland/Libraries/LibC/libc.so] Error 1
make[1]: *** [Userland/Libraries/LibC/CMakeFiles/LibC.dir/all] Error 2
make: *** [all] Error 2

It's indeed the case that crt0_shared.o is not shown as being built in the build progress information.

Invoking cmake --build . --verbose --target install to get verbose output, I see the following failing command. It's not at all apparent to me where the requirement for crt0_shared.o is being established:

/Users/keith/dev/serenity/Toolchain/Local/i686/bin/i686-pc-serenity-g++  -pie -fpic -Wno-unknown-warning-option -DSERENITY_LIBC_BUILD -static-libstdc++ -static-libstdc++ -shared -Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack --sysroot /Users/keith/dev/serenity/Build/i686/Root -o libc.so CMakeFiles/LibC.dir/arpa/inet.cpp.o CMakeFiles/LibC.dir/assert.cpp.o CMakeFiles/LibC.dir/ctype.cpp.o CMakeFiles/LibC.dir/cxxabi.cpp.o CMakeFiles/LibC.dir/dirent.cpp.o CMakeFiles/LibC.dir/dlfcn.cpp.o CMakeFiles/LibC.dir/fcntl.cpp.o CMakeFiles/LibC.dir/fenv.cpp.o CMakeFiles/LibC.dir/getopt.cpp.o CMakeFiles/LibC.dir/grp.cpp.o CMakeFiles/LibC.dir/inttypes.cpp.o CMakeFiles/LibC.dir/ioctl.cpp.o CMakeFiles/LibC.dir/libcinit.cpp.o CMakeFiles/LibC.dir/libgen.cpp.o CMakeFiles/LibC.dir/link.cpp.o CMakeFiles/LibC.dir/locale.cpp.o CMakeFiles/LibC.dir/malloc.cpp.o CMakeFiles/LibC.dir/mman.cpp.o CMakeFiles/LibC.dir/mntent.cpp.o CMakeFiles/LibC.dir/netdb.cpp.o CMakeFiles/LibC.dir/poll.cpp.o CMakeFiles/LibC.dir/pthread_forward.cpp.o CMakeFiles/LibC.dir/pthread_integration.cpp.o CMakeFiles/LibC.dir/pthread_tls.cpp.o CMakeFiles/LibC.dir/pwd.cpp.o CMakeFiles/LibC.dir/qsort.cpp.o CMakeFiles/LibC.dir/scanf.cpp.o CMakeFiles/LibC.dir/sched.cpp.o CMakeFiles/LibC.dir/serenity.cpp.o CMakeFiles/LibC.dir/signal.cpp.o CMakeFiles/LibC.dir/spawn.cpp.o CMakeFiles/LibC.dir/stat.cpp.o CMakeFiles/LibC.dir/stdio.cpp.o CMakeFiles/LibC.dir/stdlib.cpp.o CMakeFiles/LibC.dir/string.cpp.o CMakeFiles/LibC.dir/strings.cpp.o CMakeFiles/LibC.dir/stubs.cpp.o CMakeFiles/LibC.dir/syslog.cpp.o CMakeFiles/LibC.dir/sys/prctl.cpp.o CMakeFiles/LibC.dir/sys/ptrace.cpp.o CMakeFiles/LibC.dir/sys/select.cpp.o CMakeFiles/LibC.dir/sys/socket.cpp.o CMakeFiles/LibC.dir/sys/uio.cpp.o CMakeFiles/LibC.dir/sys/wait.cpp.o CMakeFiles/LibC.dir/termcap.cpp.o CMakeFiles/LibC.dir/termios.cpp.o CMakeFiles/LibC.dir/time.cpp.o CMakeFiles/LibC.dir/times.cpp.o CMakeFiles/LibC.dir/ulimit.cpp.o CMakeFiles/LibC.dir/unistd.cpp.o CMakeFiles/LibC.dir/utime.cpp.o CMakeFiles/LibC.dir/utsname.cpp.o CMakeFiles/LibC.dir/wchar.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/Base64.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/ByteBuffer.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/FlyString.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/Format.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/GenericLexer.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/Hex.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/JsonParser.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/JsonPath.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/JsonValue.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/LexicalPath.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/MappedFile.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/StackInfo.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/String.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/StringBuilder.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/StringImpl.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/StringUtils.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/StringView.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/Time.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/URL.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/URLParser.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/UUID.cpp.o CMakeFiles/LibC.dir/__/__/__/AK/Utf8View.cpp.o CMakeFiles/LibC.dir/__/LibELF/DynamicLinker.cpp.o CMakeFiles/LibC.dir/__/LibELF/DynamicLoader.cpp.o CMakeFiles/LibC.dir/__/LibELF/DynamicObject.cpp.o CMakeFiles/LibC.dir/__/LibELF/Image.cpp.o CMakeFiles/LibC.dir/__/LibELF/Validation.cpp.o CMakeFiles/LibC.dir/__/LibELF/Arch/i386/plt_trampoline.S.o CMakeFiles/LibC.dir/arch/i386/setjmp.S.o   -L/Users/keith/dev/serenity/Build/i686/Userland/Libraries/LibC  -L/Users/keith/dev/serenity/Build/i686/Userland/Libraries/LibCrypt  -L/Users/keith/dev/serenity/Build/i686/Userland/Libraries/LibDl  -L/Users/keith/dev/serenity/Build/i686/Userland/Libraries/LibM  -L/Users/keith/dev/serenity/Build/i686/Userland/Libraries/LibPthread  -L/Users/keith/dev/serenity/Build/i686/Userland/Libraries/LibSystem  libssp.a -lsystem 

I'll note that building with the ninja-based build scripts succeeds.

linusg commented 3 years ago

Duplicate of #4538.