I’m stuck trying to get CMake, GCC and QT Creator working. I created a shell.nix
file and run it using just nix-shell
. From this nix shell I then launch QT Creator and try to configure a CMake Project. I keep running into a problem where g++
is looking for crt1.o
and crti.o
. (I also tried it not specifying glibc
or libcxx
.) Any suggestions?
shell.nix
{ pkgs? import <nixpkgs> {} }:
pkgs.mkShell {
nativeBuildInputs = [
pkgs.git
pkgs.gcc
pkgs.glibc
pkgs.libcxx
pkgs.lld
pkgs.gdb
pkgs.cmake
pkgs.gnumake
pkgs.qt5.full
pkgs.qtcreator
];
}
The CMake Output from within QT Creator:
Running /nix/store/5cl0n3viqbgfgh0zaizaag6p3s5444x6-cmake-3.19.7/bin/cmake -S /home/wmadmin/Working/libsys -B /run/user/1000/QtCreator-YvSgaj/qtc-cmake-wtSWgvRY '-GUnix Makefiles' -DCMAKE_BUILD_TYPE:String=Debug -DQT_QMAKE_EXECUTABLE:STRING=/nix/store/g6761vwblm4v7ai64xv891a0pjp4grf2-qt-full-5.15.2/bin/qmake -DCMAKE_PREFIX_PATH:STRING=/nix/store/g6761vwblm4v7ai64xv891a0pjp4grf2-qt-full-5.15.2 -DCMAKE_C_COMPILER:STRING=/nix/store/sjhz1j2d1ssn59f66kqp92xj9mpsww2d-gcc-10.3.0/bin/gcc -DCMAKE_CXX_COMPILER:STRING=/nix/store/sjhz1j2d1ssn59f66kqp92xj9mpsww2d-gcc-10.3.0/bin/g++ in /run/user/1000/QtCreator-YvSgaj/qtc-cmake-wtSWgvRY.
-- The CXX compiler identification is GNU 10.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /nix/store/sjhz1j2d1ssn59f66kqp92xj9mpsww2d-gcc-10.3.0/bin/g++
-- Check for working CXX compiler: /nix/store/sjhz1j2d1ssn59f66kqp92xj9mpsww2d-gcc-10.3.0/bin/g++ - broken
-- Configuring incomplete, errors occurred!
See also "/run/user/1000/QtCreator-YvSgaj/qtc-cmake-wtSWgvRY/CMakeFiles/CMakeOutput.log".
See also "/run/user/1000/QtCreator-YvSgaj/qtc-cmake-wtSWgvRY/CMakeFiles/CMakeError.log".
CMake Error at /nix/store/5cl0n3viqbgfgh0zaizaag6p3s5444x6-cmake-3.19.7/share/cmake-3.19/Modules/CMakeTestCXXCompiler.cmake:59 (message):
The C++ compiler
"/nix/store/sjhz1j2d1ssn59f66kqp92xj9mpsww2d-gcc-10.3.0/bin/g++"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /run/user/1000/QtCreator-YvSgaj/qtc-cmake-wtSWgvRY/CMakeFiles/CMakeTmp
Run Build Command(s):/nix/store/wfzdk9vxayfnw7fqy05s7mmypg5a8lyr-gnumake-4.3/bin/make cmTC_0656d/fast && /nix/store/wfzdk9vxayfnw7fqy05s7mmypg5a8lyr-gnumake-4.3/bin/make -f CMakeFiles/cmTC_0656d.dir/build.make CMakeFiles/cmTC_0656d.dir/build
make[1]: Entering directory '/run/user/1000/QtCreator-YvSgaj/qtc-cmake-wtSWgvRY/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_0656d.dir/testCXXCompiler.cxx.o
/nix/store/sjhz1j2d1ssn59f66kqp92xj9mpsww2d-gcc-10.3.0/bin/g++ -o CMakeFiles/cmTC_0656d.dir/testCXXCompiler.cxx.o -c /run/user/1000/QtCreator-YvSgaj/qtc-cmake-wtSWgvRY/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_0656d
/nix/store/5cl0n3viqbgfgh0zaizaag6p3s5444x6-cmake-3.19.7/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0656d.dir/link.txt --verbose=1
/nix/store/sjhz1j2d1ssn59f66kqp92xj9mpsww2d-gcc-10.3.0/bin/g++ CMakeFiles/cmTC_0656d.dir/testCXXCompiler.cxx.o -o cmTC_0656d
/nix/store/5ddb4j8z84p6sjphr0kh6cbq5jd12ncs-binutils-2.35.1/bin/ld: cannot find crt1.o: No such file or directory
/nix/store/5ddb4j8z84p6sjphr0kh6cbq5jd12ncs-binutils-2.35.1/bin/ld: cannot find crti.o: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_0656d.dir/build.make:106: cmTC_0656d] Error 1
make[1]: Leaving directory '/run/user/1000/QtCreator-YvSgaj/qtc-cmake-wtSWgvRY/CMakeFiles/CMakeTmp'
make: *** [Makefile:140: cmTC_0656d/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
CMake process exited with exit code 1.
Elapsed time: 00:00.