AIX上的proftpd的静态编译 [英] static compilation of proftpd on AIX

查看:290
本文介绍了AIX上的proftpd的静态编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想收集关于AIX的proftpd,使其部署其他服务器上,无需重新安装所有的GNU LIB库中的每个服务器上。结果
我已经设法dynamicaly编译它,但我可以' t管理使用选项编译

  LDFLAG = -  Wl,-static



像官方proftpd文档中的建议。

这里的config.log错误我得到



此文件包含编译器生成的任何消息,而
运行configure,以帮助调试,如果配置出错。

它是由configure创建的,它是由GNU Autoconf 2.61生成的
。调用命令行是

$的./configure LDFLAGS =轮候册,-static --with模块= mod_tls:mod_sql:mod_sql_mysql:mod_sql_passwd:mod_sftp:mod_sftp_sql --without-getopt的--enable-的OpenSSL --with-includes = / opt / freeware / include:/ opt / freeware / include / mysql / mysql /:/ home / poney2 / src_proftpd / libmath_header / --with-libraries = / opt / freeware / lib:免费软件/ lib / mysql / mysql /:/ home / poney2 / src_proftpd / libmath_lib --prefix = / home / poney / proftpd_bin --exec-prefix = / home / poney / proftpd_bin / proftpd

# #--------- ##
##平台。 ##
## --------- ##

hostname = serverName
uname -m = 00C876004C00
uname -r = 1
uname -s = AIX
uname -v = 6

/ usr / bin / uname -p = powerpc
/ bin / uname -X = unknown

/ bin / arch = unknown
/ usr / bin / arch -k = unknown
/ usr / convex / getsysinfo =未知
/ usr / bin / hostinfo =未知
/ bin / machine = unknown
/ usr / bin / oslevel = 6.1.0.0
/ bin / universe = unknown

PATH:/ usr / bin
路径:/ etc
路径:/ usr / sbin
路径:/ usr / ucb
路径:/ home / poney / bin
路径:/ usr / bin / X11
PATH:/ sbin
PATH:。


## ----------- ##
##核心测试。 ##
## ----------- ##

configure:2122:检查构建系统类型
configure:2140:result:powerpc-ibm -aix6.1.0.0
配置:2162:检查主机系统类型
配置:2177:结果:PowerPC的IBM-aix6.1.0.0
配置:2199:检查目标系统类型
configure:2214:result:powerpc-ibm-aix6.1.0.0
configure:2346:检查gcc
configure:2362:found / usr / bin / gcc
configure: 2373:result:gcc
configure:2611:检查C编译器版本
configure:2618:gcc --version>& 5
gcc(GCC)4.4.6
版权所有(C)2010自由软件基金会,
这是免费软件;请参阅复制条件的来源。有NO
保修;甚至不适用于适销性或特定用途的适用性。

configure:2621:$? = 0
configure:2628:gcc -v>& 5
使用内置规格。
目标:powerpc-ibm-aix6.1.0.0
配置为:../gcc-4.4.6/configure --with-as = / usr / bin / as --with-ld = / usr / bin / ld --enable-languages = c,c ++,fortran --prefix = / opt / freeware --enable-threads --enable-version-specific-runtime-libs --disable-nls --enable- decimal-float = dpd -host = powerpc-ibm-aix6.1.0.0
线程模型:aix
gcc版本4.4.6(GCC)
configure:2631:$? = 0
configure:2638:gcc -V>& 5
gcc:'-V'选项必须有参数
configure:2641:$? = 1
configure:2664:检查C编译器默认输出文件名
configure:2691:gcc -Wl,-static conftest.c>& 5
ld:0706-012 -t标志不被识别。
ld:0706-012无法识别-a标志。
ld:0706-012无法识别-t标志。
ld:0706-027 -i标志被忽略。
ld:0706-012无法识别-c标志。
collect2:ld返回255退出状态
configure:2694:$? = 1
configure:2732:result:
configure:failed program was:
| / * confdefs.h。 * /
| #define PACKAGE_NAME
| #define PACKAGE_TARNAME
| #define PACKAGE_VERSION
| #define PACKAGE_STRING
| #define PACKAGE_BUGREPORT
| #定义PR_BUILD_OPTS'LDFLAGS =轮候册,-static'--with模块= mod_tls:mod_sql:mod_sql_mysql:mod_sql_passwd:mod_sftp:mod_sftp_sql'--without-getopt的'--enable-OpenSSL的'--with - 包括= /选择/免费软件/包括中:/ opt /免费软件/包括/ MySQL的/ mysql的/:/家庭/ poney2 / src_proftpd / libmath_header /''的--with-libraries = /选择/免费软件/ lib目录中:/ opt /免费软件/ lib / mysql / mysql /:/ home / poney2 / src_proftpd / libmath_lib''--prefix = / home / poney / proftpd_bin''--exec-prefix = / home / poney / proftpd_bin / proftpd'
| #define PR_PLATFORMAIX6(AIX6_1_0_0)
| / * end confdefs.h。 * /
|
| int
| main()
| {
|
| ;
| return 0;
| }
configure:2738:错误:C编译器无法创建可执行文件
有关详细信息,请参阅`config.log'。

## ---------------- ##
##缓存变量。 ##
## ---------------- ##

ac_cv_build = powerpc-ibm-aix6.1.0.0
ac_cv_env_CC_set ='
ac_cv_env_CC_value ='
ac_cv_env_CF​​LAGS_set ='
ac_cv_env_CF​​LAGS_value ='
ac_cv_env_CPPFLAGS_set ='
ac_cv_env_CPPFLAGS_value ='
ac_cv_env_CPP_set =' '
ac_cv_env_CPP_value ='
ac_cv_env_LDFLAGS_set =设定
ac_cv_env_LDFLAGS_value =轮候册,-static
ac_cv_env_LIBS_set ='
ac_cv_env_LIBS_value ='
ac_cv_env_build_alias_set =' '
ac_cv_env_build_alias_value ='
ac_cv_env_host_alias_set ='
ac_cv_env_host_alias_value ='
ac_cv_env_target_alias_set ='
ac_cv_env_target_alias_value ='
ac_cv_host = PowerPC的IBM -aix6.1.0.0
ac_cv_prog_ac_ct_CC = gcc
ac_cv_target = powerpc-ibm-aix6.1.0.0

## ------------ ----- ##
##输出变量。 ##
## ----------------- ##

ADDL_CPPFLAGS =''
ADDL_DIRS =''
ALLOCA =''
AR =''
ARGZ_H =''
BINDIR =''
BUILD_SHARED_MODULE_OBJS =''
BUILD_STATIC_MODULE_ARCHIVES =''
BUILD_STATIC_MODULE_OBJS =''
CC ='gcc'
CFLAGS =''
CONFIG_SHELL ='/ bin / sh'
CPP =''
CPPFLAGS =''
CURSES_LIBS =''
DATADIR =''
DEFS =''
DSYMUTIL =''
DUMPBIN =''
ECHO_C ='ECHO_N =''
ECHO_T =''
EGREP =''
ENABLE_NLS =''
ENABLE_TESTS =''
EXEEXT =''
FGREP =''
GLUE_MODULE_OBJS =''
GREP =''
INCLTDL =''
INCLUDEDIR =''
INCLUDES =''
INSTALL_DATA =''
INSTALL_DEPS =''
INSTALL_PROGRAM =''
INSTALL_SCRIPT =''
INSTALL_STRIP =''
LD =''
LDFLAGS =' - Wl,-static'
LIBADD_DL =''
LIBADD_DLD_LINK =''
LIBADD_DLOPEN =''
LIBADD_SHL_LOAD =''
LIBDIRS =''
LIBEXECDIR =''
LIBLTDL =''
LIBOBJS =''
LIBRARIES =''
LIBS =''
LIBTOOL ='
LIBTOOL_DEPS ='
LIB_DEPS = ''
LIB_OBJS =''
LIPO =''
LN_S =''
LOCALSTATEDIR =''
LTDLDEPS =''
LTDLINCL =
LTDLOPEN =''
LTLIBOBJS =''
LT_CONFIG_H =''
LT_DLLOADERS =''
LT_DLPREOPEN =''
MAIN_LDFLAGS =''
MAIN_LIBS =''
MODULE_DEPS =''
MODULE_LDFLAGS =''
NM =''
NMEDIT =''
OBJDUMP =''
OBJEXT =''
OSREL =' - DAIX6_1_0_0'
OSTYPE =' - DAIX6'
OTOOL64 =''
OTOOL =''
PACKAGE_BUGREPORT =''
PACKAGE_NAME =''
PACKAGE_STRING =''
PACKAGE_TARNAME =''
PACKAGE_VERSION =''
PATH_SEPARATOR =':'
PREFIX =''
RANLIB =''
SBINDIR =''
SED =''
SET_MAKE =''
SHARED_MODULE_DIRS =''
SHARED_MODULE_LIBS =''
SHARED_MODULE_OBJS =''
SHELL ='/ bin / sh'
STATIC_MODULE_DIRS =''
STATIC_MODULE_OBJS =''
STRIP =''
SYSCONFDIR =''
UTILS_LIBS =''
VERSION =''
ac_ct_CC ='gcc'
ac_ct_DUMPBIN =''
bindir ='$ {exec_prefix} / bin'
build = 'powerpc-ibm-aix6.1.0.0'
build_alias =''
build_cpu ='powerpc'
build_os ='aix6.1.0.0'
build_vendor ='ibm'
datadir ='$ {datarootdir}'
datarootdir ='$ {prefix} / share'
docdir ='$ {datarootdir} / doc / $ {PACKAGE}'
dvidir ='$ {docdir}'
exec_prefix ='/ home / poney / proftpd_bin / proftpd'
host ='powerpc-ibm-aix6.1.0.0'
host_alias =''
host_cpu ='powerpc'
host_os ='aix6.1.0.0'
host_vendor ='ibm'
htmldir ='$ {docdir}'
includedir ='$ { prefix} / include'
infodir ='$ {datarootdir} / info'
install_group =''
install_user =''
libdir ='$ {exec_prefix} / lib'
libexecdir ='$ {exec_prefix} / libexec'
localedir ='$ {datarootdir} / locale'
localstatedir ='$ {prefix} / var'
lt_ECHO ='print - r'
ltdl_LIBOBJS =''
ltdl_LTLIBOBJS =''
mandir ='$ {datarootdir} / man'
oldincludedir ='/ usr / include'
pdfdir = '$ {docdir}'
pkgconfigdir =''
prefix ='/ home / poney / proftpd_bin'
program_transform_name ='s,x,x,'
psdir ='$ {docdir}'
sbindir ='$ {exec_prefix} / sbin'
sharedstatedir ='$ {prefix} / com'
subdirs =''
sys_symbol_underscore =''
sysconfdir ='$ {prefix} / etc'
target ='powerpc-ibm-aix6.1.0.0'
target_alias =''
target_cpu ='powerpc'
target_os ='aix6.1.0.0'
target_vendor ='ibm'

## ----------- ##
## confdefs.h 。 ##
## ----------- ##

#define PACKAGE_NAME
#define PACKAGE_TARNAME
#define PACKAGE_VERSION
#define PACKAGE_STRING
#define PACKAGE_BUGREPORT
#define PR_BUILD_OPTSLDFLAGS = -Wl,-static''--with-modules = mod_tls:mod_sql:mod_sql_mysql: mod_sql_passwd:mod_sftp:mod_sftp_sql''--without-getopt''--enable-openssl''--with-includes = / opt / freeware / include:/ opt / freeware / include / mysql / mysql /:/ home / poney2 / src_proftpd / libmath_header /''--with-libraries = / opt / freeware / lib:/ opt / freeware / lib / mysql / mysql /:/ home / poney2 / src_proftpd / libmath_lib''--prefix = / home / poney / proftpd_bin''--exec-prefix = / home / poney / proftpd_bin / proftpd'
#define PR_PLATFORMAIX6(AIX6_1_0_0)

PS:我已经尝试了-Bstatic -all-static和-static标志,但它们被忽略。






可能的答案



我的一部分解决方案是修改libpath以添加一个文件夹到这里,我将所有的lib包装作为tar文件,并部署带有lib内部的proftpd安装文件夹,它不干净,但它工作:

  LDFLAGS = -Wl,-blibpath:/ a / new / lib / path

我不验证我的答案因为它不是真正的答案,但可以帮助一些你。



PS:请注意,这适用于IBM XL C编译器,并且也应该在GCC上工作

解决方案

configure脚本的输出显示:

  configure:2691:gcc -Wl,-static conftest.c>& 5 
ld:0706-012无法识别-t标志。
ld:0706-012无法识别-a标志。
ld:0706-012无法识别-t标志。
ld:0706-027 -i标志被忽略。
ld:0706-012无法识别-c标志。
collect2:ld返回255退出状态

这表示 -Wl 选项成功将选项传递给ld,但ld无法识别该选项。在使用AIX ld时,需要使用链接行使用 -dn 以及 -bsvr4 例如flags选项应该读为 -Wl,-bsvr4 -Wl,-dn



在AIX上的 ld 手册页末尾说明:


每当安装更新的操作系统版本时,应用程序也必须重新链接。任何静态链接的应用程序不是从任何修订或发行版级别到任何其他修订或发行版级别的二进制可移植。


proftpd的最终链接行的复杂性,可以使用选项 -bstatic -bdynamic 来提示加载特定项目的静态库;所以在我的情况下,我的最终链接行看起来像:

  gcc -o proftpd< -L / home / user / Development / experiments / proftpd-1.3.4d / lib -lsupp -lcrypt -ldl -L / home / user / Development / experiments / proftpd-1.3.4d / lib / libcap -lcap -lpam 

现在在这种情况下,这意味着它依赖于libcrypt,这不是默认提供的库,因此我rejig链接线,使它有 -lcrypt 包裹:

  -Wl,-bstatic -lcrypt -Wl,-bdynamic 

现在它链接到静态版本



作为附件,你应该只静态链接库中的库默认情况下在所讨论的操作系统上运行,我注意到proftpd支持动态加载模块,这意味着你应该只静态链接所需的模块。



,但是,如果您正在构建为在另一个系统上部署,我建议您创建仅使用依赖库的静态副本,并显式将它们传递到配置选项。这会使构建环境与运行时环境保持一致。


I'd like to compile proftpd on AIX to make it deployable on other server without having to reinstall all gnu lib library on each server.
I already manage to compile it dynamicaly, but I can't manage to get it compile with the option

 LDFLAG="-Wl,-static"  

like advise in the official proftpd documentation.
here the config.log error I get

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  $ ./configure LDFLAGS=-Wl,-static --with-modules=mod_tls:mod_sql:mod_sql_mysql:mod_sql_passwd:mod_sftp:mod_sftp_sql --without-getopt --enable-openssl --with-includes=/opt/freeware/include:/opt/freeware/include/mysql/mysql/:/home/poney2/src_proftpd/libmath_header/ --with-libraries=/opt/freeware/lib:/opt/freeware/lib/mysql/mysql/:/home/poney2/src_proftpd/libmath_lib --prefix=/home/poney/proftpd_bin --exec-prefix=/home/poney/proftpd_bin/proftpd

## --------- ##
## Platform. ##
## --------- ##

hostname = serverName
uname -m = 00C876004C00
uname -r = 1
uname -s = AIX
uname -v = 6

/usr/bin/uname -p = powerpc
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = 6.1.0.0
/bin/universe          = unknown

PATH: /usr/bin
PATH: /etc
PATH: /usr/sbin
PATH: /usr/ucb
PATH: /home/poney/bin
PATH: /usr/bin/X11
PATH: /sbin
PATH: .


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2122: checking build system type
configure:2140: result: powerpc-ibm-aix6.1.0.0
configure:2162: checking host system type
configure:2177: result: powerpc-ibm-aix6.1.0.0
configure:2199: checking target system type
configure:2214: result: powerpc-ibm-aix6.1.0.0
configure:2346: checking for gcc
configure:2362: found /usr/bin/gcc
configure:2373: result: gcc
configure:2611: checking for C compiler version
configure:2618: gcc --version >&5
gcc (GCC) 4.4.6
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2621: $? = 0
configure:2628: gcc -v >&5
Using built-in specs.
Target: powerpc-ibm-aix6.1.0.0
Configured with: ../gcc-4.4.6/configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,fortran --prefix=/opt/freeware --enable-threads --enable-version-specific-runtime-libs --disable-nls --enable-decimal-float=dpd --host=powerpc-ibm-aix6.1.0.0
Thread model: aix
gcc version 4.4.6 (GCC)
configure:2631: $? = 0
configure:2638: gcc -V >&5
gcc: '-V' option must have argument
configure:2641: $? = 1
configure:2664: checking for C compiler default output file name
configure:2691: gcc   -Wl,-static conftest.c  >&5
ld: 0706-012 The -t flag is not recognized.
ld: 0706-012 The -a flag is not recognized.
ld: 0706-012 The -t flag is not recognized.
ld: 0706-027 The -i flag is ignored.
ld: 0706-012 The -c flag is not recognized.
collect2: ld returned 255 exit status
configure:2694: $? = 1
configure:2732: result:
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PR_BUILD_OPTS " 'LDFLAGS=-Wl,-static' '--with-modules=mod_tls:mod_sql:mod_sql_mysql:mod_sql_passwd:mod_sftp:mod_sftp_sql' '--without-getopt' '--enable-openssl' '--with-includes=/opt/freeware/include:/opt/freeware/include/mysql/mysql/:/home/poney2/src_proftpd/libmath_header/' '--with-libraries=/opt/freeware/lib:/opt/freeware/lib/mysql/mysql/:/home/poney2/src_proftpd/libmath_lib' '--prefix=/home/poney/proftpd_bin' '--exec-prefix=/home/poney/proftpd_bin/proftpd'"
| #define PR_PLATFORM "AIX6 (AIX6_1_0_0)"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2738: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=powerpc-ibm-aix6.1.0.0
ac_cv_env_CC_set=''
ac_cv_env_CC_value=''
ac_cv_env_CFLAGS_set=''
ac_cv_env_CFLAGS_value=''
ac_cv_env_CPPFLAGS_set=''
ac_cv_env_CPPFLAGS_value=''
ac_cv_env_CPP_set=''
ac_cv_env_CPP_value=''
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=-Wl,-static
ac_cv_env_LIBS_set=''
ac_cv_env_LIBS_value=''
ac_cv_env_build_alias_set=''
ac_cv_env_build_alias_value=''
ac_cv_env_host_alias_set=''
ac_cv_env_host_alias_value=''
ac_cv_env_target_alias_set=''
ac_cv_env_target_alias_value=''
ac_cv_host=powerpc-ibm-aix6.1.0.0
ac_cv_prog_ac_ct_CC=gcc
ac_cv_target=powerpc-ibm-aix6.1.0.0

## ----------------- ##
## Output variables. ##
## ----------------- ##

ADDL_CPPFLAGS=''
ADDL_DIRS=''
ALLOCA=''
AR=''
ARGZ_H=''
BINDIR=''
BUILD_SHARED_MODULE_OBJS=''
BUILD_STATIC_MODULE_ARCHIVES=''
BUILD_STATIC_MODULE_OBJS=''
CC='gcc'
CFLAGS=''
CONFIG_SHELL='/bin/sh'
CPP=''
CPPFLAGS=''
CURSES_LIBS=''
DATADIR=''
DEFS=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C='ECHO_N=''
ECHO_T=''
EGREP=''
ENABLE_NLS=''
ENABLE_TESTS=''
EXEEXT=''
FGREP=''
GLUE_MODULE_OBJS=''
GREP=''
INCLTDL=''
INCLUDEDIR=''
INCLUDES=''
INSTALL_DATA=''
INSTALL_DEPS=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
INSTALL_STRIP=''
LD=''
LDFLAGS='-Wl,-static'
LIBADD_DL=''
LIBADD_DLD_LINK=''
LIBADD_DLOPEN=''
LIBADD_SHL_LOAD=''
LIBDIRS=''
LIBEXECDIR=''
LIBLTDL=''
LIBOBJS=''
LIBRARIES=''
LIBS=''
LIBTOOL=''
LIBTOOL_DEPS=''
LIB_DEPS=''
LIB_OBJS=''
LIPO=''
LN_S=''
LOCALSTATEDIR=''
LTDLDEPS=''
LTDLINCL=''
LTDLOPEN=''
LTLIBOBJS=''
LT_CONFIG_H=''
LT_DLLOADERS=''
LT_DLPREOPEN=''
MAIN_LDFLAGS=''
MAIN_LIBS=''
MODULE_DEPS=''
MODULE_LDFLAGS=''
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OSREL='-DAIX6_1_0_0'
OSTYPE='-DAIX6'
OTOOL64=''
OTOOL=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PREFIX=''
RANLIB=''
SBINDIR=''
SED=''
SET_MAKE=''
SHARED_MODULE_DIRS=''
SHARED_MODULE_LIBS=''
SHARED_MODULE_OBJS=''
SHELL='/bin/sh'
STATIC_MODULE_DIRS=''
STATIC_MODULE_OBJS=''
STRIP=''
SYSCONFDIR=''
UTILS_LIBS=''
VERSION=''
ac_ct_CC='gcc'
ac_ct_DUMPBIN=''
bindir='${exec_prefix}/bin'
build='powerpc-ibm-aix6.1.0.0'
build_alias=''
build_cpu='powerpc'
build_os='aix6.1.0.0'
build_vendor='ibm'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='/home/poney/proftpd_bin/proftpd'
host='powerpc-ibm-aix6.1.0.0'
host_alias=''
host_cpu='powerpc'
host_os='aix6.1.0.0'
host_vendor='ibm'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_group=''
install_user=''
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
lt_ECHO='print -r'
ltdl_LIBOBJS=''
ltdl_LTLIBOBJS=''
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
pkgconfigdir=''
prefix='/home/poney/proftpd_bin'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
subdirs=''
sys_symbol_underscore=''
sysconfdir='${prefix}/etc'
target='powerpc-ibm-aix6.1.0.0'
target_alias=''
target_cpu='powerpc'
target_os='aix6.1.0.0'
target_vendor='ibm'

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PR_BUILD_OPTS " 'LDFLAGS=-Wl,-static' '--with-modules=mod_tls:mod_sql:mod_sql_mysql:mod_sql_passwd:mod_sftp:mod_sftp_sql' '--without-getopt' '--enable-openssl' '--with-includes=/opt/freeware/include:/opt/freeware/include/mysql/mysql/:/home/poney2/src_proftpd/libmath_header/' '--with-libraries=/opt/freeware/lib:/opt/freeware/lib/mysql/mysql/:/home/poney2/src_proftpd/libmath_lib' '--prefix=/home/poney/proftpd_bin' '--exec-prefix=/home/poney/proftpd_bin/proftpd'"
#define PR_PLATFORM "AIX6 (AIX6_1_0_0)"

PS: I already try -Bstatic -all-static and -static flags but they are ignored.


Possible answer

Part of solution for me is modyfing the libpath to add a folder to this where I will put all the lib to pack it as a tar file and deploy the proftpd installation folder with the lib inside, it's not clean but it does work:

LDFLAGS="-Wl,-blibpath:/a/new/lib/path"

I do not validate my answer as it's not the real answer but that could help some of you.

PS: Please take into account that this is working with IBM XL C Compiler and should work on GCC as well

解决方案

The output of the configure script shows:

configure:2691: gcc   -Wl,-static conftest.c  >&5
ld: 0706-012 The -t flag is not recognized.
ld: 0706-012 The -a flag is not recognized.
ld: 0706-012 The -t flag is not recognized.
ld: 0706-027 The -i flag is ignored.
ld: 0706-012 The -c flag is not recognized.
collect2: ld returned 255 exit status

This indicates that the -Wl option is successfully passing the option to ld, but ld does not recognize the option. As you're using AIX ld, it requires using -dn along with -bsvr4 with the link line, so, for example the flags option should read -Wl,-bsvr4 -Wl,-dn.

There is a note at the end of the man page for ld on AIX which states that:

The application can also have to be linked again whenever an updated release of the operating system is installed. Any application that is statically linked is not binary portable from any fix or release level to any other fix or release level.

Depending on the complexity of the final link line for proftpd, you can use the options -bstatic and -bdynamic to prompt the loading of static libraries for specific items; so in my case my final link line looked like:

gcc -o proftpd <lots of .o files> -L/home/user/Development/experiments/proftpd-1.3.4d/lib -lsupp -lcrypt -ldl -L/home/user/Development/experiments/proftpd-1.3.4d/lib/libcap -lcap -lpam

Now in this case, it means that it depends on libcrypt, which isn't a default shipped library, so I rejig the link line so that it has the -lcrypt wrapped:

-Wl,-bstatic -lcrypt -Wl,-bdynamic

and now it links with the static version of the crypt library, and no longer mentions it as part of the run-time link dependencies.

As an addenda to this, you should only static link the libraries that aren't shipped by default on the OS in question, and I note that proftpd supports dynamically loading modules, which means that you should only statically link the required modules.

In general, though, if you're building to deploy on another system, I would advise creating static-only copies of the dependent libraries that you're using and explicitly pass them into the configure options. This keeps the build environment clean from the run-time environment.

这篇关于AIX上的proftpd的静态编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆