cygwin下用arm-xscale-linux-gnueabi交叉编译libcgi
【背景】
折腾:
【记录】用交叉编译器arm-xscale-linux-gnueabi交叉编译一个基于嵌入式Linux的无线HART的项目
期间,却发现,include的路径中有:
-I xxx/armxscalelibcgi/include |
所以,还需要一个库libcgi。
其中,此处已有源码:libcgi-1.0
【折腾过程】
1.先去看看代码和配置:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ ls
AUTHORS* autogen.sh* BUGS* ChangeLog* configure* configure.in* doc/ examples/ install-sh* Makefile.in* README* src/ THANKS* TODO*CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ ./configure --help
Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print `checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $
2.直接去配置:
./configure --prefix=$HOME/develop/crosstool-ng/x-tools/libcgi --build=i686-pc-cygwin --target=arm-xscale-linux-gnueabi --host=arm-xscale-linux-gnueabi CC=arm-xscale-linux-gnueabi-gcc
结果说是不支持这个CC:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ ./configure --prefix=$HOME/develop/crosstool-ng/x-tools/libcgi --build=i686-pc-cygwin --target=arm-xscale-linux-gnueabi --host=arm-xscale-linux-gnueabi CC=arm-xscale-linux-gnueabi-gcc
configure: warning: CC=arm-xscale-linux-gnueabi-gcc: invalid host type
creating cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for a BSD compatible install... /usr/bin/install -c checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes updating cache ./config.cache creating ./config.status creating Makefile creating src/config.h src/config.h is unchanged
3.所以,去掉CC:
./configure --prefix=$HOME/develop/crosstool-ng/x-tools/libcgi --build=i686-pc-cygwin --target=arm-xscale-linux-gnueabi --host=arm-xscale-linux-gnueabi
试试:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ ./configure --prefix=$HOME/develop/crosstool-ng/x-tools/libcgi --build=i686-pc-cygwin --target=arm-xscale-linux-gnueabi --host=arm-xscale-linux-gnueabi
loading cache ./config.cache
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for a BSD compatible install... (cached) /usr/bin/install -c checking how to run the C preprocessor... (cached) gcc -E checking for ANSI C header files... (cached) yes creating ./config.status creating Makefile creating src/config.h src/config.h is unchanged
4.然后再去make编译:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ make
cc -c -o src/error.o src/error.c
cc -c -o src/cgi.o src/cgi.c
cc -c -o src/session.o src/session.c
cc -c -o src/base64.o src/base64.c
cc -c -o src/md5.o src/md5.c
cc -c -o src/string.o src/string.c
cc -c -o src/general.o src/general.c
cc -c -o src/list.o src/list.c cc -c -o src/cookie.o src/cookie.c ar rc src/libcgi.a src/error.o src/cgi.o src/session.o src/base64.o src/md5.o src/string.o src/general.o src/list.o src/cookie.o cc -shared -o src/libcgi.so src/error.o src/cgi.o src/session.o src/base64.o src/md5.o src/string.o src/general.o src/list.o src/cookie.o +---------------------------------------+ | Thanks for using LibCGI | +---------------------------------------+ | LibCGI is getting better because | | people like you are using it. So, if | | LibCGI is helping you in some way, | | please help us to improve it, sending | | suggestions, bug reports, bug fixes, | | and specially improvment code. | | You can subscribe to the mailing list | | or send a mail to the author. | +---------------------------------------+---------------------------+ | List: http://lists.sourceforge.net/lists/listinfo/libcgi-general | +-------------------------------------------------------------------+
和明显,不是交叉编译。
5.去看了下,.o,也的确只是x86的,不是arm的:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ file src/
base64.c cgi.c cgi.o config.h.in cookie.o error.h general.c libcgi.a list.c md5.c session.c session.o string.o
base64.o cgi.h config.h cookie.c error.c error.o general.o libcgi.so list.o md5.o session.h string.cCLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ file src/cgi.o
src/cgi.o: 80386 COFF executable not stripped - version 30821
6.参考:
How to libcgi?
以及去看了:
libcgi-1.0\Makefile
中的:
.c.o: $(CC) $(FLAGS) -c $<
所以,去重新配置一下:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ ./configure --prefix=$HOME/develop/crosstool-ng/x-tools/libcgi --build=i686-pc-cygwin --target=arm-xscale-linux-gnueabi --host=arm-xscale-linux-gnueabi
loading cache ./config.cache
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for a BSD compatible install... (cached) /usr/bin/install -c checking how to run the C preprocessor... (cached) gcc -E checking for ANSI C header files... (cached) yes creating ./config.status creating Makefile creating src/config.h src/config.h is unchanged
7.然后再在make的时候加上CC参数
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ make CC=arm-xscale-linux-gnueabi-gcc
结果没东西需要重新编译的:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ make CC=arm-xscale-linux-gnueabi-gcc+---------------------------------------+
| Thanks for using LibCGI |
+---------------------------------------+
| LibCGI is getting better because |
| people like you are using it. So, if | | LibCGI is helping you in some way, | | please help us to improve it, sending | | suggestions, bug reports, bug fixes, | | and specially improvment code. | | You can subscribe to the mailing list | | or send a mail to the author. | +---------------------------------------+---------------------------+ | List: http://lists.sourceforge.net/lists/listinfo/libcgi-general | +-------------------------------------------------------------------+
8.所以去clean一把:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ make clean
find src/ -name *.*o -exec rm -f {} \; find src/ -name *.a -exec rm -f {} \;
再重新配置:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ ./configure --prefix=$HOME/develop/crosstool-ng/x-tools/libcgi --build=i686-pc-cygwin --target=arm-xscale-linux-gnueabi --host=arm-xscale-linux-gnueabi
loading cache ./config.cache
checking for gcc... (cached) gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for a BSD compatible install... (cached) /usr/bin/install -c checking how to run the C preprocessor... (cached) gcc -E checking for ANSI C header files... (cached) yes creating ./config.status creating Makefile creating src/config.h src/config.h is unchanged
make加CC,然后可以交叉编译了:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ make CC=arm-xscale-linux-gnueabi-gcc
arm-xscale-linux-gnueabi-gcc -c -o src/error.o src/error.c
arm-xscale-linux-gnueabi-gcc -c -o src/cgi.o src/cgi.c
arm-xscale-linux-gnueabi-gcc -c -o src/session.o src/session.c
arm-xscale-linux-gnueabi-gcc -c -o src/base64.o src/base64.c
arm-xscale-linux-gnueabi-gcc -c -o src/md5.o src/md5.c
9.但是结果出错问题了:
【已解决】cygwin下用arm-xscale-linux-gnueabi交叉编译libcgi出错:src/string.c:587:2: error: incompatible type for argument 2 of ‘__builtin_va_copy’
10.make是编译完了。
现在去试试安装:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ make install
cp src/libcgi.a /home/CLi/develop/crosstool-ng/x-tools/libcgi/lib
cp src/libcgi.so /home/CLi/develop/crosstool-ng/x-tools/libcgi/lib
cp src/cgi.h /home/CLi/develop/crosstool-ng/x-tools/libcgi/include
cp src/session.h /home/CLi/develop/crosstool-ng/x-tools/libcgi/include
11.本以为OK了,但是突然坑爹的发现,安装目录中lib和include,都是文件,而不是文件夹:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi
total 48K
-rwxr-xr-x 1 CLi Domänen-Benutzer 1.1K Aug 6 12:59 include*
-rw-r--r-- 1 CLi Domänen-Benutzer 44K Aug 6 12:59 lib
所以,删除掉此两个文件,新建两个文件夹,手动重新拷贝试试:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ rm /home/CLi/develop/crosstool-ng/x-tools/libcgi/*CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi
total 0CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ mkdir /home/CLi/develop/crosstool-ng/x-tools/libcgi/libCLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ mkdir /home/CLi/develop/crosstool-ng/x-tools/libcgi/include CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ cp src/libcgi.a /home/CLi/develop/crosstool-ng/x-tools/libcgi/lib/ CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ cp src/libcgi.so /home/CLi/develop/crosstool-ng/x-tools/libcgi/lib/ CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ cp src/cgi.h /home/CLi/develop/crosstool-ng/x-tools/libcgi/include/ CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ cp src/session.h /home/CLi/develop/crosstool-ng/x-tools/libcgi/include/ CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi total 0 drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Aug 6 13:04 include/ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Aug 6 13:03 lib/ CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi/include/ total 12K -rwxr-xr-x 1 CLi Domänen-Benutzer 4.3K Aug 6 13:04 cgi.h* -rwxr-xr-x 1 CLi Domänen-Benutzer 1.1K Aug 6 13:04 session.h* CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi/lib total 88K -rw-r--r-- 1 CLi Domänen-Benutzer 43K Aug 6 13:03 libcgi.a -rwxr-xr-x 1 CLi Domänen-Benutzer 44K Aug 6 13:03 libcgi.so*
如此,才算成功:
有了对应的.a和.so的库,有了对应的.h文件。
->
很明显是makefile写错了。
12.去折腾了下,测试结果是,makefile,应该从原先的:
install:
cp src/libcgi.a $(LIBDIR)
cp src/libcgi.so $(LIBDIR) cp src/cgi.h $(INCDIR) cp src/session.h $(INCDIR)
改为:
install:
mkdir -p $(LIBDIR)
cp src/libcgi.a $(LIBDIR)
cp src/libcgi.so $(LIBDIR) mkdir -p $(INCDIR) cp src/cgi.h $(INCDIR) cp src/session.h $(INCDIR)
就可以了。
其中:
(1)对应的uninstall部分,没去管;
(2)由于makefile文件,也是configure生成的,所以,最终的修改,应该是修改configure文件。此处不熟悉,暂不去深究了。
效果是:
CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0
$ rm /home/CLi/develop/crosstool-ng/x-tools/libcgi/* -fr CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi total 0 CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi^C CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ make install mkdir -p /home/CLi/develop/crosstool-ng/x-tools/libcgi/lib cp src/libcgi.a /home/CLi/develop/crosstool-ng/x-tools/libcgi/lib cp src/libcgi.so /home/CLi/develop/crosstool-ng/x-tools/libcgi/lib mkdir -p /home/CLi/develop/crosstool-ng/x-tools/libcgi/include cp src/cgi.h /home/CLi/develop/crosstool-ng/x-tools/libcgi/include cp src/session.h /home/CLi/develop/crosstool-ng/x-tools/libcgi/include CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi total 0 drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Aug 6 13:10 include/ drwxr-xr-x+ 1 CLi Domänen-Benutzer 0 Aug 6 13:10 lib/ CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi/lib/ total 88K -rw-r--r-- 1 CLi Domänen-Benutzer 43K Aug 6 13:10 libcgi.a -rwxr-xr-x 1 CLi Domänen-Benutzer 44K Aug 6 13:10 libcgi.so* CLi@PC-CLI-1 ~/develop/libcgi/libcgi-1.0 $ ll /home/CLi/develop/crosstool-ng/x-tools/libcgi/include/ total 12K -rwxr-xr-x 1 CLi Domänen-Benutzer 4.3K Aug 6 13:10 cgi.h* -rwxr-xr-x 1 CLi Domänen-Benutzer 1.1K Aug 6 13:10 session.h*
【总结】
此处的过程是:
1.配置:
./configure --prefix=$HOME/develop/crosstool-ng/x-tools/libcgi --build=i686-pc-cygwin --target=arm-xscale-linux-gnueabi --host=arm-xscale-linux-gnueabi
注:此处指定CC的话,无法识别,所以CC的指定,放在make后面了。
2.编译:
准备工作:
(1)修改:
libcgi-1.0\src\string.c
中的587行的:
va_copy(bkp, str);
改为:
//va_copy(bkp, str);
va_copy(bkp, ptr);
编译:
再去指定CC,去make编译:
make CC=arm-xscale-linux-gnueabi-gcc
3.安装:
准备工作:
将makefile中的:
install:
cp src/libcgi.a $(LIBDIR)
cp src/libcgi.so $(LIBDIR) cp src/cgi.h $(INCDIR) cp src/session.h $(INCDIR)
改为:
install:
mkdir -p $(LIBDIR)
cp src/libcgi.a $(LIBDIR)
cp src/libcgi.so $(LIBDIR) mkdir -p $(INCDIR) cp src/cgi.h $(INCDIR) cp src/session.h $(INCDIR)
就可以了。
安装:
make install
转载于:https://www.cnblogs.com/LxwEmbedded/p/4180020.html
cygwin下用arm-xscale-linux-gnueabi交叉编译libcgi相关推荐
- arm hisiv100 linux,hisiv100交叉编译工具链安装
hisi交叉编译工具链安装 一. 摘要: 交叉编译简单的说,就是A机器上编译生成,运行在B机器上.那么在A机器上的编译工具安装,就是本文所要描述的内容. 工欲善其事必先利其器,所以交叉 ...
- arm oe linux gnueabi 系统,OpenCV ARM移植(交叉编译opencv) arm-oe-linux-gnueabi-gcc编译opencv3.1.0...
Cmake的安装 OpenCV 2.2以后版本需要使用Cmake生成makefile文件,因此需要先安装cmake. ubuntu下安装cmake比较简单, apt-get install cm ...
- arm oe linux gnueabi 系统,交叉编译移植openssl
交叉编译openssl静态库步骤: 1.解压源码 tar xf openssl-1.1.1a.tar.gz 2.进入到解压后的源码目录 cd openssl-1.1.1a/ 3.配置Makefile ...
- arm oe linux gnueabi 系统,[MDM9X07] ME3610/3630开发环境快速搭建
说明 ME3610/3630基于Arm linux, 在上位机开发POC应用需要配置交叉编译环境 步骤 1 资料 基础包和依赖库环境都在百度网盘: ** 4G模块>ME3610 ME3630 * ...
- arm oe linux gnueabi 系统,【技术分享】Quectel 4G模块Opencpu中实现高通wifi功能
导语 越来越多的IOT应用场景中需要使用4G模块,而在有些特定的场合需要把4G上网能力转化wifi功能,比如说无人机中视频传输,以及打印机行业中都有类似的应用案例,以便更好的提供给更多的客户端去使用. ...
- cygwin 编译linux内核,【记录】Cygwin下交叉编译Linux内核时用make menuconfig去确认和修改配置...
[背景] 折腾: 期间,已用make xxxx_defconfig调用默认配置: 此处,接着去: make menuconfig 去确认和修改配置. [折腾过程] 1.去make menuconfig ...
- 嵌入式软件开发培训笔记——ARM架构Linux系统下交叉编译环境搭建、NFS、TFTP服务配置及Nandflash的读写
bootloader原理和开发-->kernel构建-->文件系统/根文件系统(filesystem/rootfs) APP 一.配置交叉编译环境(可参考嵌入式Linux移植与驱动开发co ...
- xscale linux内核编译,【记录】用交叉编译器arm-xscale-linux-gnueabi交叉编译一个基于嵌入式Linux的无线HART的项目...
[背景] 手上有一个无线HART的源码,其是基于Eclipse的项目. 想要交叉编译该项目. 之前已经通过crosstool-ng弄出一个交叉编译器arm-xscale-linux-gnueabi了: ...
- arm linux gnueabi编译,交叉编译器 arm-linux-gnueabi 和 arm-linux-gnueabihf 的区别
本身以前一直没搞清楚这两个交叉编译器到底有什么问题,特地google一番,总结以下,但愿能帮到道上和我有一样困惑的兄弟-..linux 一. 什么是ABI和EABI 1) ABI: 二进制应用程序接口 ...
最新文章
- 流水线经典讲解!!!!!
- UWA DAY 2018 精彩议题全曝光!
- boost::mpl模块实现count相关的测试程序
- BZOJ3527: [Zjoi2014]力
- aio 系统原理 Java_Java新一代网络编程模型AIO原理及Linux系统AIO介绍
- 【计算机网络】为什么一个路由器会有两个wifi信号
- 推荐系统实战第一部分 协同过滤
- HDU 5971 2016ICPC大连 A: Wrestling Match(二分图判断)
- Ubuntu配置显卡驱动
- PHP实现微信公众平台开发---提升篇(access_token存session)
- 使用JavaScript实现动态效果
- SpringBoot 系列教程(九十二):Spring Boot全局设置Jackson时间处理
- 笔记本(只有一个HDMI接口)接双屏的方案(谨慎使用)
- 【高德地图入门】--- 绘制面
- 基于Python的书店销售管理系统
- Name Mangling
- (转载)MatLab绘图
- 现代计算机理论模型与工作原理
- mysql查询更新优化_mysql查询优化(持续更新中)
- 3D摄影机选择指南,你知道自己需要什么样的摄影机吗?
热门文章
- linux ip addr命令,linux – 理解“ip addr change”和“ip addr replace”命令
- (附源码)SSM校园摄影爱好者交流网站JAVA计算机毕业设计项目
- python 生成手机号,并且验证手机号是否存在
- webWork和JSP整合案例
- 注意:美国退货量呈现攀升,这些举措要重视
- VBA智慧办公——高效处理Excel表格(序)
- vagrant 网络
- 让淘宝链接在微信中分享,GO
- 英特尔公司Centrino Advanced-N 6205间歇性无线断开连接 (rev 34)
- 盛迈坤电商:怎么提升网店的流量