0

I was doing it referring to the following site1 but when I built it with the following procedure, an error occurred. If anyone knows the cause, please let me know.

1 vi .vscode/settings.json

2 I will also attach an image.2

{
    "cmake.configureEnvironment": {
        "PICO_SDK_PATH": "/home/$ubuntu/micro_ros_ws/src/pico-sdk",
    },
}

3 code .

error code

[{
    "resource": "/home/ubuntu/micro_ros_ws/src/micro_ros_raspberrypi_pico_sdk/CMakeLists.txt",
    "owner": "cmake-configure-diags",
    "severity": 8,
    "message": "CMake Error at CMakeLists.txt:3 (include):include could not find load file:\n\n  /home/$ubuntu/micro_ros_ws/src/pico-sdk/external/pico_sdk_import.cmake",
    "source": "CMake (include)",
    "startLineNumber": 3,
    "startColumn": 1,
    "endLineNumber": 3,
    "endColumn": 10000
}]

[{
    "resource": "/usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake",
    "owner": "cmake-configure-diags",
    "severity": 8,
    "message": "CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):The C compiler\n\n  \"/bin/arm-none-eabi-gcc-9.2.1\"\n\nis not able to compile a simple test program.\n\nIt fails with the following output:\n\n  Change Dir: /home/ubuntu/micro_ros_ws/src/micro_ros_raspberrypi_pico_sdk/build/CMakeFiles/CMakeTmp\n  \n  Run Build Command(s):/usr/bin/make cmTC_157be/fast && /usr/bin/make -f CMakeFiles/cmTC_157be.dir/build.make CMakeFiles/cmTC_157be.dir/build\n  make[1]: Entering directory '/home/ubuntu/micro_ros_ws/src/micro_ros_raspberrypi_pico_sdk/build/CMakeFiles/CMakeTmp'\n  Building C object CMakeFiles/cmTC_157be.dir/testCCompiler.c.o\n  /bin/arm-none-eabi-gcc-9.2.1    -o CMakeFiles/cmTC_157be.dir/testCCompiler.c.o   -c /home/ubuntu/micro_ros_ws/src/micro_ros_raspberrypi_pico_sdk/build/CMakeFiles/CMakeTmp/testCCompiler.c\n  Linking C executable cmTC_157be\n  /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_157be.dir/link.txt --verbose=1\n  /bin/arm-none-eabi-gcc-9.2.1      CMakeFiles/cmTC_157be.dir/testCCompiler.c.o  -o cmTC_157be \n  /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':\n  /build/newlib-CVVEyx/newlib-3.3.0/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:64: undefined reference to `_exit'\n  collect2: error: ld returned 1 exit status\n  make[1]: *** [CMakeFiles/cmTC_157be.dir/build.make:87: cmTC_157be] Error 1\n  make[1]: Leaving directory '/home/ubuntu/micro_ros_ws/src/micro_ros_raspberrypi_pico_sdk/build/CMakeFiles/CMakeTmp'\n  make: *** [Makefile:121: cmTC_157be/fast] Error 2\n  \n  \n\n\n\nCMake will not be able to correctly generate this project.",
    "source": "CMake (message)",
    "startLineNumber": 60,
    "startColumn": 1,
    "endLineNumber": 60,
    "endColumn": 10000,
    "relatedInformation": [
        {
            "startLineNumber": 5,
            "startColumn": 1,
            "endLineNumber": 5,
            "endColumn": 1000,
            "message": "In call to 'project' here",
            "resource": "/home/ubuntu/micro_ros_ws/src/micro_ros_raspberrypi_pico_sdk/CMakeLists.txt"
        }
    ]
}]
surume
  • 1
  • 3
  • 1
    Did you do the part `Obtaining the Information` from the link? Does the file `/home/$ubuntu/micro_ros_ws/src/pico-sdk/external/pico_sdk_import.cmake` with _literal `$` character_ (!!!) exists? Do you have `/home/ubuntu/` or `'/home/$ubuntu/'` path? – KamilCuk Feb 16 '22 at 10:04
  • Thank you for your replay! I have already installed it. I don't have $ character so I changed `/home/ubuntu/micro_ros_ws/src/pico-sdk/external/pico_sdk_import.cmake`. Then I can solve 1st error but I can't solve second error. – surume Feb 17 '22 at 07:23
  • Remove CMakeCache and start fresh. You could remove and recreate your project. While this https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program/53635241#53635241 is the solution, most probably it is already included in pico-sdk build scripts. – KamilCuk Feb 17 '22 at 07:52

0 Answers0