fcgi、fastcgi 交叉编译 (cannot stat `libfcgi_la-fcgiapp.o' )

(如果有帮助,请点个赞;如果有错误,请指出;如果转载,请注明出处)


关键词:

(1)fcgi

(2)mips、openwrt

(3)mv : cannot stat `libfcgi_la-fcgiapp.o': No such file or directory

(4)`alocal symbol' can not be used when making a shared object;

(5)recompile with -fPIC 

(6)'EOF' was not declared in this scope

(7)undefined reference to `frexp' 


正文:

1、执行configure,生成Makefile

./configure --build=i686-pc-linux-gnu --host=mips-openwrt-linux --prefix=$PWD/install CFLAGS="-g -O2 -Wall -fPIC"  CXXFLAGS="-g -O2 -Wall -fPIC" 


2、make CC=/home/ubuntu/workplace/sdk/toolchain/bin/mips-openwrt-linux-uclibc-gcc      LD=/home/ubuntu/workplace/sdk/toolchain/bin/mips-openwrt-linux-uclibc-ld  

(交叉编译工具链路径请根据情况指定)


3、make install,安装路径在编译路径的install目录下面


4.

(1)遇到的问题:mv : cannot stat `libfcgi_la-fcgiapp.o': No such file or directory

(2)原因分析:意思是没有这个文件,原因是libtool里面执行这个文件之前,没有先生成这个文件。

(3)解决办法:修改libtool文件,找到867行(不同版本可能行数会有点不同),在then后面添加一行,make $output_obj


5.

(1)遇到的问题:

relocation R_MIPS_26 against`a local symbol' can not be used when making a shared object;

recompile with -fPIC

libfcgi_la-fcgiapp.lo:could not read symbols: Bad value

(2)原因分析:编译器提示需要添加 -fPIC 选项。但是在configure的时候添加比较方便。

(3)解决办法:configure的时候添加CFLAGSCXXFLAGS选项.

./configure --build=i686-pc-linux-gnu --host=mips-openwrt-linux --prefix=$PWD/install   CFLAGS="-g -O2 -Wall -fPIC" CXXFLAGS="-g -O2 -Wall -fPIC"


6.

(1)遇到的问题: fcgio.cpp error: 'EOF' was not declared in this scope 

(2)原因分析:编译器版本有关

(3)解决办法:在报错文件的最开始加上 #include<stdio.h>


7.

(1)遇到的问题:undefined reference to `frexp' 

(2)原因分析:无法找到数学库(math)

(3)解决办法:先make clean,然后修改 libfcgi目录下的Makefile-LIBS那一行增加 -lm 参数




    IT从业人员需要及时关注技术动态,但是互联网的内容却过于离散,好东西往往隐藏得很深。 现在可以在微信公众号里面
    搜索关注 “小鱼儿的IT技术分享” ,订阅我为大家每天汇总的IT技术信息。欢迎大家关注!
      有兴趣的请点击《与IT技术相关的微信公众号》

你可能感兴趣的:(fastcgi,fcgi,交叉编译)