❶ 怎樣使用交叉編譯器編譯單個C文件
$CC filename.c -o filename
❷ ubuntu下進行嵌入式C語言開發時,什麼叫交叉編譯為什麼要交叉編譯
交易編譯就是將文件編譯成目標機可執行的文件。
比如說:你在PC機上寫一個helloword,怎麼讓它到開發板上運行,開發板上的指令跟PC機不到,就需要用到交叉編譯工具,編譯成開發板上能識別的指令。
❸ linux怎樣才能讓所有用戶使用arm-linux-gcc編譯c文件
除設置環境變數外,還必須設置 gcc 環境的文件至少有 rx
❹ gcc交叉編譯怎麼找頭文件及lib庫的
是在specs裡面讀取的路徑信息。
命令行中鍵入 gcc -v
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /usr/build/package/orig/test.respin/gcc-3.4.4-3/configure --ver
bose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libe
xecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-langu
ages=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-gettext --
enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-
awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-thre
ads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptio
ns --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
注意「--prefix=/usr」 以及「--libdir=/usr/lib 」
表示gcc ld as 等可執行文件安裝在/usr/bin,而libc.a 等文件是在/usr/lib中。
解壓縮交叉編譯器時,也是要解壓縮在在--prefix 指定的目錄下。
比如 下載了arm-linux 的交叉編譯器cross-3.3.2.tar.bz2,解壓縮之後,運行 arm-linux-gcc -v
得到 --prefix=/usr/local/arm。那麼就要把 bin lib 等所有的文件和文件夾到/usr/local/arm目錄下。
否則到時候運行arm-linux-gcc hello.c會提示找不到stdio.h 或者 lib.so.6 等
HOWTO Use the GCC specs file
About Specs file
The "gcc" program invoked by users is a convenient front-end driver executable which will invoke other programs in the background such as cc1, as or ld to do its work according to the command line parameter given. A specs file is plain text used to control the default behavior for the "gcc" front-end. The specs file is usually built-in but for flexibility purposes, it can be overridden with an external version.
Basic Specs file modifications
CC will proce a specs file via the following command.
gcc -mpspecs > specs
You may use a text editor of your choice to inspect it. It may be confusing at first, but there are many places of interest. To use the specs file, invoke gcc with -specs= or place it at "/mingw/lib/gcc/mingw32//specs" to make GCC use it by default, where refers to the GCC version installed.
Adding include directories to the search path
& #160;he *cpp: section should be modified. It contains the following by default:
*cpp:
%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT}
If "z:\libx\include" needs to be added to the GCC includes search path, it should be changed to the following
*cpp:
%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} -I/z/libx/include
Adding lib directories to the search path
& #160;he *link_libgcc: section should be modified. It contains the following by default:
*link_libgcc:
%D
& #160;f "z:\libx\lib" needs to be added to the GCC library search path, it should be changed to the following
*link_libgcc:
%D -L/z/libx/lib
❺ 交叉編譯armlinuxgcc wchar.h: No such file or directory 不僅如此所有的C語言頭文件都找不到
我的抄也是這個問題 交叉編譯環境搭建後 arm-linux-gcc -v 顯示
No such file or directory 使用which命令可以找到,環境變數沒有問題,更詳細的描述問題就是which找到的命令所在的目錄下的所有命令都是同樣的問題。
果然問題的解決點就在我用的是64位系統,使用 sudo apt-get install ia32-libs命令就可以解決
希望對你有所幫助!
❻ 在linux下寫一份.c文件交叉編譯讓arm板屏幕全紅。
出現的錯誤時什麼樣子的,貼出來分析一下。 最好是可以看一下喔網名吧,方便以後遇到問題了好解決
❼ Linux系統下採用ARM交叉編譯器編譯C文件,make後的文件放到ARM開發板下,為什麼總是出現錯誤
出現的錯誤時什麼樣子的,貼出來分析一下。
最好是可以看一下喔網名吧,方便以後遇到問題了好解決
❽ 交叉編譯除了C語言和linux基礎還需要什麼知識
交叉編譯器其實沒什麼特殊的,你用gcc編譯是一樣的,只是最後結果不能在目標機上運行,在linux下可以執行而已。
需要了解mips指令集和交叉編譯器的使用方法,也就是編寫makefile
❾ C/C++源文件直接交叉編譯生成.so文件供安卓應用程序調用,可以嗎
Jni調用就行了,是要按規則寫介面api,如果介面很多,也沒法,那是你的業務問題,要重新設計業務邏輯。我們之前用的c++單獨交叉編譯一個進程,和安卓界面用tcp通信,如果介面多也以為著協議多,一樣的。
❿ linux下如何把一個.c文件通過arm-none-eabi-交叉編譯生成一個.bin的文件然後在qemu上運行
需要設置內核源碼樹,即你makefile中的KDIR
交叉編譯的話,要設置
ARCH
CROSS_COMPILE
兩個變數。
make就可以了。