/linux/f1c200s/linux_kernel/linux-4.14.0+driver/led$ arm-linux-gnueabihf-gcc -no-pie -o hello hello.c -Wl,-dynamic-linker,/lib/ld-linux.so.3 -R/usr/arm-linux-gnueabihf/lib/ld-linux.so.3 arm-linux-gnueabihf-gcc: error: unrecognized command line option ‘-R’
时间: 2023-08-02 14:08:00 浏览: 49
这个错误提示是因为在 arm-linux-gnueabihf-gcc 命令中使用了不支持的选项 "-R"。请确保您使用的是正确的选项,并检查您的命令行语法是否正确。如果您需要设置动态链接器路径,可以使用 "-Wl,--dynamic-linker=/lib/ld-linux.so.3" 选项,而不是 "-R" 选项。
相关问题
jia@jia-VirtualBox:~/linux/f1c200s/linux_kernel/linux-4.14.0+driver/led$ arm-linux-gnueabihf-gcc -o ledtest ledtest.c jia@jia-VirtualBox:~/linux/f1c200s/linux_kernel/linux-4.14.0+driver/led$ file ledtest ledtest: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=2e2a5d57ab5ad18d72d855e10d88aaf24dca5e18, for GNU/Linux 3.2.0, not stripped原因,为啥不是共享文件
根据你提供的信息,重新编译后生成的ledtest文件依然是共享对象文件。这可能是因为交叉编译工具链使用了默认的编译选项,而默认的编译选项是生成共享对象文件。你可以尝试使用静态链接的方式重新编译,这样可以生成可执行文件,命令如下:
```
arm-linux-gnueabihf-gcc -o ledtest ledtest.c -static
```
在命令中加入-static选项,就可以生成静态链接的可执行文件。
如果你需要调试生成的可执行文件,可以在编译命令中加入-g选项,命令如下:
```
arm-linux-gnueabihf-gcc -o ledtest ledtest.c -static -g
```
这样生成的ledtest文件就包含了调试信息,可以用gdb进行调试。
arm-linux-gnueabihf-gcc 和arm-linux-gnueabihf-gcc-nm的区别
arm-linux-gnueabihf-gcc和arm-linux-gnueabihf-gcc-nm是两个不同的工具,用于在ARM架构上进行编译和链接操作。
arm-linux-gnueabihf-gcc是GNU Compiler Collection (GCC) 的ARM交叉编译器。它可以将C、C++和其他语言的源代码编译为ARM架构上的可执行文件。它提供了编译、汇编和链接等功能,可以将源代码转换为可在ARM架构上运行的机器码。
arm-linux-gnueabihf-gcc-nm是GCC的一个工具,用于显示目标文件中的符号表。它可以列出目标文件中定义的符号和引用的符号,并提供有关这些符号的信息,如地址、类型和大小等。它通常与arm-linux-gnueabihf-gcc一起使用,以便在编译和链接过程中查看符号表信息。
总结来说,arm-linux-gnueabihf-gcc用于编译源代码,将其转换为可执行文件,而arm-linux-gnueabihf-gcc-nm用于查看目标文件中的符号表信息。