hello world 编译失败



  • 在论坛中看见了一些类似的topic,不知道是否有解决方法,试了CSDN上的在main函数前加函数的方法也未能解决

    [ 99%] Building C object CMakeFiles/hello_world.dir/src/hello_world/main.c.obj
    [100%] Linking C executable hello_world
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-puts.o): in function .L2': puts.c:(.text._puts_r+0x5c): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-puts.o): in function .L5': puts.c:(.text._puts_r+0xac): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-__atexit.o): in function .L0 ': __atexit.c:(.text.__register_exitproc+0x12): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: __atexit.c:(.text.__register_exitproc+0x44): undefined reference to _lock_release_recursive' /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-__atexit.o): in function.L6':
    __atexit.c:(.text.__register_exitproc+0x9a): undefined reference to _lock_release_recursive' /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-__call_atexit.o): in function.L0 ':
    __call_atexit.c:(.text.__call_exitprocs+0x1c): undefined reference to _lock_acquire_recursive' /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: __call_atexit.c:(.text.__call_exitprocs+0x50): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fflush.o): in function .L47': fflush.c:(.text._fflush_r+0x3e): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fflush.o): in function .L49': fflush.c:(.text._fflush_r+0x66): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-findfp.o): in function .L0 ': findfp.c:(.text.std+0x68): undefined reference to_lock_init_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-findfp.o): in function __sfp_lock_acquire': findfp.c:(.text.__sfp_lock_acquire+0x4): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-findfp.o): in function __sfp_lock_release': findfp.c:(.text.__sfp_lock_release+0x4): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-findfp.o): in function __sinit_lock_acquire': findfp.c:(.text.__sinit_lock_acquire+0x4): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-findfp.o): in function __sinit_lock_release': findfp.c:(.text.__sinit_lock_release+0x4): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-mlock.o): in function __malloc_lock': mlock.c:(.text.__malloc_lock+0x4): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-mlock.o): in function __malloc_unlock': mlock.c:(.text.__malloc_unlock+0x4): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fclose.o): in function .L3': fclose.c:(.text._fclose_r+0x38): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fclose.o): in function .L4': fclose.c:(.text._fclose_r+0x52): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fclose.o): in function .L9': fclose.c:(.text._fclose_r+0xcc): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fclose.o): in function .L11': fclose.c:(.text._fclose_r+0xd6): undefined reference to_lock_close_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fputc.o): in function .L2': fputc.c:(.text._fputc_r+0x38): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fputc.o): in function .L3': fputc.c:(.text._fputc_r+0x62): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fputs.o): in function .L2': fputs.c:(.text._fputs_r+0x4a): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fputs.o): in function .L4': fputs.c:(.text._fputs_r+0x96): undefined reference to_lock_release_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-putc.o): in function .L2': putc.c:(.text._putc_r+0x38): undefined reference to_lock_acquire_recursive'
    /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/desktop/opt/Kendryte/kendryte-toolchain/bin/../lib/gcc/riscv64-unknown-elf/8.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-putc.o): in function .L6': putc.c:(.text._putc_r+0x82): undefined reference to_lock_release_recursive'
    collect2: error: ld returned 1 exit status
    make[2]: *** [CMakeFiles/hello_world.dir/build.make:112:hello_world] 错误 1
    make[1]: *** [CMakeFiles/Makefile2:284:CMakeFiles/hello_world.dir/all] 错误 2
    make: *** [Makefile:104:all] 错误 2