You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Linaro交叉编译时Eclipse提示找不到Crti.o和Crt1.o求助

Fixing "Cannot find Crti.o/Crt1.o" with Linaro Cross-Compiler in Eclipse

I’ve run into this exact issue before with older Linaro toolchains—here’s how to get it sorted out quickly:

Why This Happens

You’ve only configured Eclipse to point to the toolchain’s bin directory, but the cross-compiler needs access to the sysroot (the target system’s root filesystem included with the toolchain) where Crt1.o, Crti.o, and other essential startup/linker files live. These files aren’t in the bin folder—they’re buried in the toolchain’s target-specific lib directories.

Step-by-Step Fixes

  1. Locate the actual path of Crt1.o/Crti.o
    Open a terminal and run this command to find exactly where these files are stored in your toolchain:

    find /home/xxx/opt/toolchains/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf -name "Crt1.o"
    

    You’ll get a path like:

    /home/xxx/opt/toolchains/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib/Crt1.o
    

    The key parent directory here is /home/xxx/opt/toolchains/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc—this is your toolchain’s sysroot.

  2. Configure Eclipse to use the sysroot

    • Right-click your project → Properties → C/C++ Build → Settings
    • Go to the Tool Settings tab, expand Cross GCC Linker → Miscellaneous
    • In the Other flags field, add this flag (replace with your actual sysroot path):
      --sysroot=/home/xxx/opt/toolchains/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc
      
    • Alternatively, you can add the directory containing Crt1.o to the Library search path (-L) field under Cross GCC Linker → Libraries, but using --sysroot is cleaner since it covers all target libraries and headers.
  3. Verify with a manual terminal compile
    To rule out Eclipse-specific issues, test the toolchain directly in the terminal:

    arm-linux-gnueabihf-gcc --sysroot=/home/xxx/opt/toolchains/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc test.c -o test
    

    If this works, your Eclipse configuration was missing the sysroot parameter—double-check the settings you added in step 2.

  4. Optional: Set environment variables in Eclipse
    For better integration, go to Properties → C/C++ Build → Environment and add:

    • PATH: Append /home/xxx/opt/toolchains/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/bin
    • SYSROOT: Set to your toolchain’s sysroot path (from step 1)

This should resolve the "missing Crti.o/Crt1.o" error—let me know if you hit any snags!

内容的提问来源于stack exchange,提问作者Trung Trinh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:44:17