-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
I've been seeing a minor error when building libc using Ninja during the install step pertaining crti.o and crtn.o. Particularly, both files are never compiled and thus cmake returns me an error when installing libc:
CMake Error at projects/libc/startup/linux/cmake_install.cmake:55 (file):
file INSTALL cannot find
"/home/lucas.reis/llvm-18/build/projects/libc/startup/linux/CMakeFiles/libc.startup.linux.crti.dir/./crti.cpp.o":
No such file or directory.
Call Stack (most recent call first):
projects/libc/startup/cmake_install.cmake:47 (include)
projects/libc/cmake_install.cmake:77 (include)
projects/cmake_install.cmake:47 (include)
cmake_install.cmake:122 (include)
FAILED: CMakeFiles/install.util If I manually compile the object by calling ninja, the install works accordingly after:
lucas.reis:~/llvm-18/build$ ninja libc.startup.linux.crti
[1/1] Building CXX object projects/libc/startup/linux/CMakeFiles/libc.startup.linux.crti.dir/crti.cpp.o
lucas.reis:~/llvm-18/build$ ninja libc.startup.linux.crtn
[1/1] Building CXX object projects/libc/startup/linux/CMakeFiles/libc.startup.linux.crtn.dir/crtn.cpp.oIt is my understanding that those files are built with EXCLUDE_FROM_ALL:
llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake
Lines 383 to 389 in 1118c2e
| add_library( | |
| ${fq_target_name} | |
| EXCLUDE_FROM_ALL | |
| OBJECT | |
| ${ADD_OBJECT_SRCS} | |
| ${ADD_OBJECT_HDRS} | |
| ) |
and thus not compiled excplicitly unless requested, but they are still required in the install step:
llvm-project/libc/startup/linux/CMakeLists.txt
Lines 116 to 137 in 1118c2e
| add_startup_object( | |
| crti | |
| SRC | |
| crti.cpp | |
| ) | |
| add_startup_object( | |
| crtn | |
| SRC | |
| crtn.cpp | |
| ) | |
| add_custom_target(libc-startup) | |
| set(startup_components crt1 crti crtn) | |
| foreach(target IN LISTS startup_components) | |
| set(fq_target_name libc.startup.linux.${target}) | |
| add_dependencies(libc-startup ${fq_target_name}) | |
| install(FILES $<TARGET_OBJECTS:${fq_target_name}> | |
| DESTINATION ${CMAKE_INSTALL_LIBDIR} | |
| RENAME $<TARGET_PROPERTY:${fq_target_name},OUTPUT_NAME> | |
| COMPONENT libc) | |
| endforeach() |
Being startup object files it makes sense to me that they should be dependencies for libc to build on linux.