You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In default examples project has no explicitly used languages, which implies C and CXXLANGUAGES, but if I set my project to be C only (which is correct), cmake fails to generate it. I think toolchain's internals should be separated from the project completely like VCPKG does.
Error log:
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILE_OBJECT
CMake Error: Error required internal CMake variable not set, cmake may not be built correctly.
Missing variable is:
CMAKE_CXX_LINK_EXECUTABLE
CMake Generate step failed. Build files cannot be regenerated correctly.
Problems were encountered while collecting compiler information:
cc1plus: fatal error: /home/wirtos/GithubProjects/pico-sdk/src/common/pico_stdlib/include: No such file or directory
cc1plus: fatal error: /home/wirtos/GithubProjects/pico-sdk/src/rp2_common/hardware_gpio/include: No such file or directory
cc1plus: fatal error: /home/wirtos/GithubProjects/pico-sdk/src/common/pico_base/include: No such file or directory
cc1plus: fatal error: /mnt/c/GithubProjects/picolrn/cmake-build-debug-wsl-gcc/generated/pico_base: No such file or directory
cc1plus: fatal error: /home/wirtos/GithubProjects/pico-sdk/src/boards/include: No such file or directory
...
Which part of your project was being built when you saw those errors? Note that building the toolchain also builds elf2uf2 (which converts the .elf file that GCC generates into a .uf2 file for copying onto your Pico) which is a native (it runs on your computer rather than on your Pico) program written in C++.
Which part of your project was being built when you saw those errors? Note that building the toolchain also builds elf2uf2 (which converts the .elf file that GCC generates into a .uf2 file for copying onto your Pico) which is a native (it runs on your computer rather than on your Pico) program written in C++.
It breaks before the build process during generation as mentioned in the report. Does this regardlessly of me having add_extra_outputs. The toolchain config should be responsible for providing C++ compiler to build elf2uf2, not the project itself. But even considering that I'm not sure whether elf2uf2 is the root of the problem.
Yeah; fixing this is a bit nasty, because the SDK itself is a CXX project, and reports as such vi ENABLED_LANGUAGES property in cmake. Your project fails, because at the toplevel scope CXX is not a valid language. I had a little play and see that if the SDK doesn't include new_delete.cpp then you are fine, but as I say we can't simply check ENABLED_LANGUAGES as that does contain CXX at this point.
I don't feel strongly enough to expend much effort on it right now, so feel free to post a PR... I guess we could add a CMake build flag at least to say you want nothing to do with C++ assuming it is an actual requirement
So it's solely the toolchain that breaks because of undefined languages? It seems like it's quite trivial to use gcc-arm toolchain in place of CMAKE_TOOLCHAIN_FILE, but I'm not sure on how to link the libraries in this case. iirc vcpkg adds directories to CMAKE_FIND_ROOT_PATH in order to be able to use find_package or find_path. Can I do the same separately for pico toolchain and if yes, which dirs should I add?
Activity
lurch commentedon May 7, 2021
Which part of your project was being built when you saw those errors? Note that building the toolchain also builds elf2uf2 (which converts the
.elffile that GCC generates into a.uf2file for copying onto your Pico) which is a native (it runs on your computer rather than on your Pico) program written in C++.Wirtos commentedon May 7, 2021
It breaks before the build process during generation as mentioned in the report. Does this regardlessly of me having add_extra_outputs. The toolchain config should be responsible for providing C++ compiler to build elf2uf2, not the project itself. But even considering that I'm not sure whether elf2uf2 is the root of the problem.
kilograham commentedon May 8, 2021
Yeah; fixing this is a bit nasty, because the SDK itself is a CXX project, and reports as such vi ENABLED_LANGUAGES property in cmake. Your project fails, because at the toplevel scope CXX is not a valid language. I had a little play and see that if the SDK doesn't include new_delete.cpp then you are fine, but as I say we can't simply check ENABLED_LANGUAGES as that does contain CXX at this point.
I don't feel strongly enough to expend much effort on it right now, so feel free to post a PR... I guess we could add a CMake build flag at least to say you want nothing to do with C++ assuming it is an actual requirement
See #339 for C99
Wirtos commentedon May 9, 2021
I guess I'll try to toy with the toolchain later and maybe port tools like elf2uf2 to C then
kilograham commentedon May 9, 2021
elf2uf2 is not the problem; that is a separate build and works fine
Wirtos commentedon May 9, 2021
So it's solely the toolchain that breaks because of undefined languages? It seems like it's quite trivial to use gcc-arm toolchain in place of CMAKE_TOOLCHAIN_FILE, but I'm not sure on how to link the libraries in this case. iirc vcpkg adds directories to CMAKE_FIND_ROOT_PATH in order to be able to use find_package or find_path. Can I do the same separately for pico toolchain and if yes, which dirs should I add?
Bolayniuss commentedon Jul 8, 2021
I manage to solve this by using a variable
PICO_SDK_PURE_Cto removenew_delete.cppfrom the source.In
src/rp2_common/pico_standard_link/CMakeLists.txtreplaceby
And then, in your
CMakeList.txtdefine addset(PICO_SDK_PURE_C 1)beforeinclude(pico_sdk_import.cmake)JannickBremm commentedon Aug 4, 2021
Worked for me! Thank's a lot @Bolayniuss