免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4943 | 回复: 6
打印 上一主题 下一主题

[FTP] 一波三折——solaris9下编译vsftpd-2.0.3 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-07-17 16:48 |只看该作者 |倒序浏览
小弟初次发如此长的原创的帖,语言罗索,表达不周处,请各位朋友原谅!

环境:
vmware4.5.2+solaris9(u7)+make 3.8 +gcc 3.4.2

在编译apache失败后,决定从感觉比较简单的vsftpd开始下手,下载vsftpd-2.0.3.tarv.gz,在/tmp目录下解压,参照http://bbs.chinaunix.net/forum/v ... der=asc&start=0
(vsftp配置大全---超完整版,首发CU之FTP区 ),本想也如高手演示的那么容易,没想到一编译就出问题了,下面是我在编译过程中遇到的4个问题。

一波之第一折:
    一开始编译提示tcp.h 找不到,还有tcpwrap之类的字样(抱歉,这一段出错记录没有保留下来),我从网上查了有关tcp.h和tcpwrap的资料,都没有头绪,最后索性下载了tcp_wrappers-7.6-sol9-intel-local.gz,安装后,tcpwrap.o模块就编译过去了,感觉这一步有些瞎蒙,不过第一个问题就这样解决了。
   
一波之第二折:
编译问题是 ssl.o模块,症状如下所示:
.....
-c ssl.c -O2 -Wall -W -Wshadow  -idirafter dummyinc
ssl.c:27:25: openssl/err.h: No such file or directory
ssl.c:28:26: openssl/rand.h: No such file or directory
ssl.c:29:25: openssl/bio.h: No such file or directory
ssl.c:32: error: parse error before '*' token
ssl.c:32: warning: type defaults to `int' in declaration of `get_ssl'
ssl.c:32: warning: data definition has no type or storage class
ssl.c:36: error: parse error before '*' token
ssl.c: In function `ssl_init':
ssl.c:45: error: `SSL_CTX' undeclared (first use in this function)
ssl.c:45: error: (Each undeclared identifier is reported only once
ssl.c:45: error: for each function it appears in.)
ssl.c:45: error: `p_ctx' undeclared (first use in this function)
ssl.c:47: warning: implicit declaration of function `SSL_library_init'
ssl.c:48: warning: implicit declaration of function `SSL_CTX_new'
ssl.c:48: warning: implicit declaration of function `SSLv23_server_method'
ssl.c:49: error: `NULL' undeclared (first use in this function)
ssl.c:53: error: `SSL_OP_ALL' undeclared (first use in this function)
ssl.c:56: error: `SSL_OP_NO_SSLv2' undeclared (first use in this function)
ssl.c:60: error: `SSL_OP_NO_SSLv3' undeclared (first use in this function)
ssl.c:64: error: `SSL_OP_NO_TLSv1' undeclared (first use in this function)
ssl.c:66: warning: implicit declaration of function `SSL_CTX_set_options'
ssl.c:74: warning: implicit declaration of function `SSL_CTX_use_certificate_file'
ssl.c:75: error: `X509_FILETYPE_PEM' undeclared (first use in this function)
ssl.c:79: warning: implicit declaration of function `SSL_CTX_use_PrivateKey_file'
ssl.c:102: warning: implicit declaration of function `SSL_CTX_set_cipher_list'
ssl.c:106: warning: implicit declaration of function `RAND_status'
ssl.c: In function `ssl_getline':
ssl.c:197: warning: implicit declaration of function `SSL_read'
ssl.c: In function `ssl_read':
ssl.c:220: error: `SSL' undeclared (first use in this function)
ssl.c:220: error: parse error before ')' token
ssl.c:221: warning: implicit declaration of function `SSL_get_error'
ssl.c:221: error: parse error before ')' token
ssl.c:223: error: `SSL_ERROR_WANT_READ' undeclared (first use in this function)
ssl.c:224: error: `SSL_ERROR_WANT_WRITE' undeclared (first use in this function)
ssl.c: In function `ssl_write':
ssl.c:235: warning: implicit declaration of function `SSL_write'
ssl.c:235: error: `SSL' undeclared (first use in this function)
ssl.c:235: error: parse error before ')' token
ssl.c:236: error: parse error before ')' token
ssl.c:238: error: `SSL_ERROR_WANT_READ' undeclared (first use in this function)
ssl.c:239: error: `SSL_ERROR_WANT_WRITE' undeclared (first use in this function)
ssl.c: In function `ssl_write_str':
ssl.c:247: error: `SSL' undeclared (first use in this function)
ssl.c:247: error: parse error before ')' token
ssl.c: In function `ssl_accept':
ssl.c:258: error: `SSL' undeclared (first use in this function)
ssl.c:258: error: `p_ssl' undeclared (first use in this function)
ssl.c:259: error: `NULL' undeclared (first use in this function)
ssl.c: In function `ssl_data_close':
ssl.c:271: warning: implicit declaration of function `SSL_free'
ssl.c: At top level:
ssl.c:283: error: parse error before '*' token
ssl.c:285: warning: return type defaults to `int'
ssl.c: In function `get_ssl':
ssl.c:286: error: `SSL' undeclared (first use in this function)
ssl.c:286: error: `p_ssl' undeclared (first use in this function)
ssl.c:286: warning: implicit declaration of function `SSL_new'
ssl.c:287: error: `NULL' undeclared (first use in this function)
ssl.c:291: warning: implicit declaration of function `SSL_set_fd'
ssl.c:296: warning: implicit declaration of function `SSL_accept'
ssl.c: In function `ssl_session_init':
ssl.c:308: error: `SSL' undeclared (first use in this function)
ssl.c:308: error: `p_ssl' undeclared (first use in this function)
ssl.c:309: error: `NULL' undeclared (first use in this function)
ssl.c: In function `get_ssl_error':
ssl.c:321: warning: implicit declaration of function `SSL_load_error_strings'
ssl.c:322: warning: implicit declaration of function `ERR_error_string'
ssl.c:322: warning: implicit declaration of function `ERR_get_error'
ssl.c:322: error: `NULL' undeclared (first use in this function)
ssl.c:322: warning: return makes pointer from integer without a cast
ssl.c: At top level:
ssl.c:325: error: parse error before '*' token
ssl.c: In function `setup_bio_callbacks':
ssl.c:327: error: `BIO' undeclared (first use in this function)
ssl.c:327: error: `p_bio' undeclared (first use in this function)
ssl.c:327: warning: implicit declaration of function `SSL_get_rbio'
ssl.c:327: error: `p_ssl' undeclared (first use in this function)
ssl.c:328: warning: implicit declaration of function `BIO_set_callback'
ssl.c:329: warning: implicit declaration of function `SSL_get_wbio'
ssl.c: At top level:
ssl.c:335: error: parse error before '*' token
ssl.c: In function `bio_callback':
ssl.c:339: error: `p_arg' undeclared (first use in this function)
ssl.c:340: error: `argi' undeclared (first use in this function)
ssl.c:341: error: `argl' undeclared (first use in this function)
ssl.c:342: error: `oper' undeclared (first use in this function)
ssl.c:342: error: `BIO_CB_READ' undeclared (first use in this function)
ssl.c:342: error: `BIO_CB_RETURN' undeclared (first use in this function)
ssl.c:343: error: `BIO_CB_WRITE' undeclared (first use in this function)
ssl.c:345: error: `ret' undeclared (first use in this function)
ssl.c:346: warning: implicit declaration of function `BIO_get_fd'
ssl.c:346: error: `p_bio' undeclared (first use in this function)
ssl.c:346: error: `NULL' undeclared (first use in this function)
ssl.c: At top level:
ssl.c:244: warning: unused parameter 'p_ssl'
ssl.c:229: warning: unused parameter 'p_ssl'
ssl.c:229: warning: unused parameter 'p_buf'
ssl.c:229: warning: unused parameter 'len'
ssl.c:214: warning: unused parameter 'p_ssl'
ssl.c:214: warning: unused parameter 'p_buf'
ssl.c:214: warning: unused parameter 'len'
make: *** [ssl.o] Error 1

    依照上法,先下载了openssl-0.9.7g-sol9-intel-local.gz,安装后,仍然提示同样的问题,从如下的提示可以看出是没有找到相关的文件,可能是路径不合适。
ssl.c:27:25: openssl/err.h: No such file or directory
ssl.c:28:26: openssl/rand.h: No such file or directory
ssl.c:29:25: openssl/bio.h: No such file or directory
从openssl的安装路径 /usr/local/ssl/include/openssl/下找到了err.h ,于是,在/usr/include/下建立了链接:
ln -s  /usr/local/ssl/include/openssl    /usr/include/openssl
再次make,OK,ssl.o模块编译过了。

然而一波未平一波又起呀.......
“当”
一波之第3折:
sysutil.o模块又报错了:

bash-2.05# make
gcc -c ssl.c -O2 -Wall -W -Wshadow  -idirafter dummyinc
gcc -c sysutil.c -O2 -Wall -W -Wshadow  -idirafter dummyinc
In file included from /usr/include/sys/reg.h:13,
                 from /usr/include/sys/regset.h:24,
                 from /usr/include/sys/ucontext.h:21,
                 from /usr/local/lib/gcc/i386-pc-solaris2.9/3.4.2/include/sys/signal.h:249,
                 from /usr/include/signal.h:27,
                 from sysutil.c:28:
/usr/include/ia32/sys/reg.h:300: error: parse error before "upad128_t"
/usr/include/ia32/sys/reg.h:302: error: parse error before '}' token
/usr/include/ia32/sys/reg.h:309: error: field `kfpu_fx' has incomplete type
/usr/include/ia32/sys/reg.h:331: error: parse error before "upad128_t"
/usr/include/ia32/sys/reg.h:338: error: parse error before '}' token
/usr/include/ia32/sys/reg.h:339: error: parse error before '}' token
/usr/include/ia32/sys/reg.h:376: error: parse error before "fpregset_t"
In file included from /usr/local/lib/gcc/i386-pc-solaris2.9/3.4.2/include/sys/signal.h:249,
                 from /usr/include/signal.h:27,
                 from sysutil.c:28:
/usr/include/sys/ucontext.h:69: error: parse error before "mcontext_t"
/usr/include/sys/ucontext.h:71: error: parse error before '}' token
make: *** [sysutil.o] Error 1

     从错误报告来看和上两次的不同,上面的都只是文件找不到这样简单的故障,这个不一样了,头文件的问题,这可难办了,谁知到他们怎么定义的头文件呀,本人也不是程序员出身,头疼!!!,不过偶没有放弃,先打开了提示的头文件reg.h,看了看13行,知道了reg.h又调用了/usr/include/ia32/sys/reg.h,(ia32?这个估计是关于cpu架构的吧,32位/64位),其他的都看不懂了,然后先登录cu,搜索一下sysutil.o,没有解决办法,接着又搜索了reg.h,没想到找到解决办法了,参见http://bbs.chinaunix.net/forum/viewtopic.php?t=416642([准原创]sol9_x86+apache+mysql+php+discuz [精华])
里面给出了解决办法:
请修改/usr/include/ia32/sys/reg.h
在第245行
写入
typedef union {
long _q;
uint32_t _l[4];
} upad128_t;

偶照抄过去,修改后,再编译仍然通不过。
仔细看错误提示,感觉就是变量声明又问题,后来看/usr/include/ia32/sys/reg.h 中又调用了/usr/include/sys/types.h,从types.h中找到了如下一段代码:
typedef union{
            long double           _q;
            uint32_t               _l[4];
} upad128_t;
将这段代码拷贝到 /usr/include/ia32/sys/reg.h 第245行,再次make,通过!!!
过后想了想,第一次make没过,可能是我输入union定义时输错了,没有看到long与_q ,uint32_t和_l[4]之间的空格,所以才失败的。


下面最后一“折”了,编译都通过了,链接到最后时又出问题了:
bash-2.05# make
gcc -o vsftpd main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o tunables.o ftpdataio.o secbuf.o ls.o postprivparent.o logging.o str.o netstr.o sysstr.o strlist.o banner.o filestr.o parseconf.o secutil.o ascii.o oneprocess.o twoprocess.o privops.o standalone.o hash.o tcpwrap.o ipaddrparse.o access.o features.o readwrite.o ssl.o sysutil.o sysdeputil.o -Wl,-s `./vsf_findlibs.sh`
ld: fatal: library -lssl: not found
ld: fatal: library -lcrypto: not found
ld: fatal: File processing errors. No output written to vsftpd
collect2: ld returned 1 exit status
make: *** [vsftpd] Error 1
      马上打开vsf_findlibs.sh文件,发现文件内容太简单,看不出是哪里出了问题。从系统里find lssl和lcrypto,find了半天也没找到,搞的偶都要灰心了,想想为了装vsftpd,重装了系统,花费了2天的时间。到最后,又要功亏一篑了,:(。
.......
和很多电影里演的一样,机会总是在翻检绝望的垃圾堆时不经意的被找到了,我不停的尝试各种方法,当试着把/usr/local/ssl/lib 下的文件都拷贝到/lib 下,然后再make时,竟然编译成功了呀。^_^ ,又是文件路径的问题。

呵呵,make成功了,还没有运行,先把编译的经历写下来,免得忘了,同时给有此“痛苦遭遇”的朋友一点点参考。

make后的 sftpd:
bash-2.05# ls -l vsftpd
-rwxr-xr-x   1 root     other     124780 Jul 17 14:11 vsftpd

论坛徽章:
0
2 [报告]
发表于 2005-07-17 21:55 |只看该作者

一波三折——solaris9下编译vsftpd-2.0.3

传说中的solaris,原来这么麻烦啊,那儿有下载的?俺也去试试

      

论坛徽章:
0
3 [报告]
发表于 2005-07-18 09:14 |只看该作者

一波三折——solaris9下编译vsftpd-2.0.3

good.

也可参考这个
http://bbs.chinaunix.net/forum/viewtopic.php?t=505936

论坛徽章:
0
4 [报告]
发表于 2005-07-21 13:08 |只看该作者

一波三折——solaris9下编译vsftpd-2.0.3

哪有这么复杂啊。误导啊。

论坛徽章:
0
5 [报告]
发表于 2005-07-21 13:47 |只看该作者

一波三折——solaris9下编译vsftpd-2.0.3

[quote]原帖由 "fei"]哪有这么复杂啊。误导啊。[/quote 发表:
有简单的方法,欢迎分享

论坛徽章:
0
6 [报告]
发表于 2005-07-23 23:37 |只看该作者

一波三折——solaris9下编译vsftpd-2.0.3

有时候系统的差异性就如同人之间的差异,同样是海鲜,有的吃了没问题,有的人就会过敏,有的人会拉肚子,有的人会难受好长时间。遇到了此类情况只能具体问题具体对待了。

论坛徽章:
0
7 [报告]
发表于 2008-07-10 09:13 |只看该作者
"我不停的尝试各种方法,当试着把/usr/local/ssl/lib 下的文件都拷贝到/lib 下"

这里使用链接进行:
ln -s /usr/local/ssl/lib/libcrytpo.so.0.9.8 /usr/lib/libcrypto.so
ln -s /usr/local/ssl/lib/libssl.so.0.9.8 /usr/lib/libssl.so
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP