微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

柯南和树莓派,如何搭配使用?

如何解决柯南和树莓派,如何搭配使用?

早上好!

我正在重写这个问题,因为经过大量阅读和尝试失败后,我进一步研究了这个问题,但我再次被赌注。

在这里试图帮助的是:使用 Conan 作为我的 Mac(使用 CLion)中嵌入式设备“RaspBerry PICO”的包管理器

与上一个问题不同的是,现在我正在创建一个包,而且我不只使用“独立”包管理器。

此“包裹”位于 github.com。要安装并尝试编译它,您还需要 Pico SDK

一些事实:

  • 没有 Conan 但有 SDK 的新 C++ 项目正在嵌入式设备上编译和运行。
  • 没有 Pico SDK 的 Conan 项目编译正确。
  • 我真的在配置文件上尝试了所有可能的配置,主要有两个配置配置文件会在构建过程中导致两个不同的错误

一个没有任何环境。这是因为在 CLion 上我没有添加任何环境,并且项目本身(没有 conan,但没有使用 SDK for pico)是正确的构建器。

[settings]
os_build=Macos
arch_build=x86_64

os=Linux
arch=armv7
# os=Macos
# arch=x86_64

# compiler=apple-clang
compiler=gcc
# compiler.version=12.0
compiler.version=9.2
# compiler.libcxx=libc++
compiler.libcxx=libstdc++

build_type=Release

[options]
[build_requires]
[env]

ps。注释行是在 conan build . 之后解析相同结果的附加测试。

错误是这样的:

jure.prah@MacBook-Pro-di-Jure conan-blink-mosfet % conan build .  
Using lockfile: '/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/conan.lock'
Using cached profile from lockfile
conanfile.py (blink/0.1): Calling build()
conanfile.py (blink/0.1): CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/package" "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/src"
Using PICO_SDK_PATH from environment ('/Users/jure.prah/CLionProjects/pico-sdk')
PICO_SDK_PATH is /Users/jure.prah/CLionProjects/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
-- Defaulting build type to 'Release' since not specified.
Using Conan toolchain through /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake.
-- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC)
-- Conan toolchain: Setting BUILD_SHARED_LIBS= OFF
-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- The ASM compiler identification is Clang
-- Found assembler: /Library/Developer/CommandLinetools/usr/bin/cc
-- Detecting C compiler ABI info
Using Conan toolchain through .
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLinetools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
Using Conan toolchain through .
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLinetools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Defaulting PICO target board to pico since not specified.
Using board configuration from /Users/jure.prah/CLionProjects/pico-sdk/src/boards/include/boards/pico.h
-- Found python3: /usr/local/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found version "3.9.6") found components: Interpreter 
TinyUSB available at /Users/jure.prah/CLionProjects/pico-sdk/lib/tinyusb/src/portable/raspBerrypi/rp2040; adding USB support.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release
conanfile.py (blink/0.1): CMake command: cmake --build '/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release'
[ 25%] Building CXX object CMakeFiles/blink.dir/blink.cpp.o
[ 50%] Linking CXX static library libblink.a
[ 50%] Built target blink
Scanning dependencies of target bs2_default
[ 75%] Building ASM object pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.o
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:89:1: error: unkNown directive
.Syntax unified
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:90:1: error: unkNown directive
.cpu cortex-m0plus
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:91:1: error: unkNown directive
.thumb
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:93:15: error: unexpected token in '.section' directive
.section .text
              ^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:101:1: error: unkNown directive
.type _stage2_boot,%function
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:102:1: error: unkNown directive
.thumb_func
^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:104:11: error: unkNown token in expression
    push {lr}
          ^
[...]
         ^
/Users/jure.prah/CLionProjects/pico-sdk/src/rp2_common/boot_stage2/boot2_w25q080.S:285:1: error: unkNown directive
.ltorg
^
make[2]: *** [pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.o] Error 1
make[1]: *** [pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/all] Error 2
make: *** [all] Error 2
ERROR: conanfile.py (blink/0.1): Error in build() method,line 40
        cmake.build()
        ConanException: Error 2 while executing cmake --build '/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release'

第二个配置文件配置基于 the example from conan.com(感谢@uilianres)并设置环境。:

toolchain_path=/usr/local/bin
toolchain=arm-none-eabi

[settings]
os_build=Macos
arch_build=x86_64
#os=Macos
#arch=x86_64
os=Linux
arch=armv7
compiler=apple-clang
# compiler=gcc
compiler.version=12.0
# compiler.version=9.2
compiler.libcxx=libc++
# compiler.libcxx=libstdc++
build_type=Release

[options]
[build_requires]
[env]
CONAN_CMAKE_FIND_ROOT_PATH=$toolchain_path/
AR=$toolchain-ar
AS=$toolchain-as
CC=$toolchain-gcc
CXX=$toolchain-g++
STRIP=$toolchain-strip

使用命令 conan build . 解决不同的错误

jure.prah@MacBook-Pro-di-Jure conan-blink-mosfet % conan build .
Using lockfile: '/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/conan.lock'
Using cached profile from lockfile
conanfile.py (blink/0.1): Calling build()
conanfile.py (blink/0.1): CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/package" "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/src"
Using PICO_SDK_PATH from environment ('/Users/jure.prah/CLionProjects/pico-sdk')
PICO_SDK_PATH is /Users/jure.prah/CLionProjects/pico-sdk
Defaulting PICO_PLATFORM to rp2040 since not specified.
-- Defaulting build type to 'Release' since not specified.
Using Conan toolchain through /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake.
-- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC)
-- Conan toolchain: Setting BUILD_SHARED_LIBS= OFF
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /usr/local/bin/arm-none-eabi-gcc
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - no
-- Detecting C compiler ABI info
Using Conan toolchain through .
-- Detecting C compiler ABI info - Failed
-- Check for working C compiler: /usr/local/bin/arm-none-eabi-gcc
Using Conan toolchain through .
-- Check for working C compiler: /usr/local/bin/arm-none-eabi-gcc - broken
CMake Error at /usr/local/Cellar/cmake/3.21.0/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    "/usr/local/bin/arm-none-eabi-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/make -f Makefile cmTC_69910/fast && /Library/Developer/CommandLinetools/usr/bin/make  -f CMakeFiles/cmTC_69910.dir/build.make CMakeFiles/cmTC_69910.dir/build
    Building C object CMakeFiles/cmTC_69910.dir/testCCompiler.c.o
    /usr/local/bin/arm-none-eabi-gcc -D_GLIBCXX_USE_CXX11_ABI=0  -O3 -DNDEBUG -isysroot /Library/Developer/CommandLinetools/SDKs/MacOSX11.3.sdk -fPIE -o CMakeFiles/cmTC_69910.dir/testCCompiler.c.o -c /Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_69910
    /usr/local/Cellar/cmake/3.21.0/bin/cmake -E cmake_link_script CMakeFiles/cmTC_69910.dir/link.txt --verbose=1
    /usr/local/bin/arm-none-eabi-gcc -O3 -DNDEBUG -isysroot /Library/Developer/CommandLinetools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_69910.dir/testCCompiler.c.o -o cmTC_69910 
    /usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol arch_paths_first; defaulting to 0000000000008018
    /usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /usr/local/Cellar/arm-none-eabi-gcc/9-2019-q4-major/gcc/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit':
    exit.c:(.text.exit+0x2c): undefined reference to `_exit'
    collect2: error: ld returned 1 exit status
    make[1]: *** [cmTC_69910] Error 1
    make: *** [cmTC_69910/fast] Error 2
   
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:5 (project)


-- Configuring incomplete,errors occurred!
See also "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release/CMakeFiles/CMakeOutput.log".
See also "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/Release/CMakeFiles/CMakeError.log".
ERROR: conanfile.py (blink/0.1): Error in build() method,line 39
        cmake.configure()
        ConanException: Error 1 while executing cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/build/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/package" "/Users/jure.prah/CLionProjects/rpi-pico/conan-blink-mosfet/src"

我也在这里做了所有的变体和测试,但一切都会导致这个错误。此外,我检查了工具链路径,并且是正确的。

我现在完全迷失了。 :(

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。