我正在尝试使用 GNU ARM 工具链将 libiconv 构建为 Cortex M4 的静态库,并且似乎该过程大部分是成功的。
我这样配置libiconv:
./configure --build=x86_64-linux-gnu --host=arm-none-eabi --prefix=/home/josaphat/Downloads/libiconv-1.14/build_dir CFLAGS="-nostdlib -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mthumb -mfloat-abi=hard" --enable-static
除了“警告:使用不以主机三元组为前缀的交叉工具”之外,Configure 没有显示任何我可以辨别的警告或错误(但它可以很好地找到并使用正确的编译器,所以我认为我可以放心地忽略这一点)。
编译时出现错误sigprogmask.c
:
[...剪断...]
arm-none-eabi-gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -nostdlib -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mthumb -mfloat-abi=hard -c sigprocmask.c
In file included from /usr/local/gcc-arm-none-eabi-4_8-2014q2/arm-none-eabi/include/signal.h:5:0,
from ./signal.h:52,
from sigprocmask.c:44:
./signal.h:490:1: error: expected identifier or '(' before 'const'
_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
^
./signal.h:490:1: error: expected ')' before '&' token
_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
^
./signal.h:490:1: error: expected ')' before '!=' token
_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig)
^
./signal.h:503:1: error: expected ')' before '*' token
_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
^
./signal.h:503:1: error: expected ')' before '=' token
_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
^
./signal.h:515:1: error: expected ')' before '*' token
_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
^
./signal.h:515:1: error: expected ')' before '|=' token
_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig)
^
./signal.h:528:1: error: expected ')' before '*' token
_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
^
./signal.h:528:1: error: expected ')' before '&=' token
_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig)
^
./signal.h:541:1: error: expected ')' before '*' token
_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
^
./signal.h:541:1: error: expected ')' before '=' token
_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1)));
^
sigprocmask.c:87:14: error: expected identifier or '(' before 'const'
sigismember (const sigset_t *set, int sig)
^
sigprocmask.c:87:1: error: expected ')' before '&' token
sigismember (const sigset_t *set, int sig)
^
sigprocmask.c:87:1: error: expected ')' before '!=' token
sigismember (const sigset_t *set, int sig)
^
sigprocmask.c:103:23: error: expected ')' before '*' token
sigemptyset (sigset_t *set)
^
sigprocmask.c:103:1: error: expected ')' before '=' token
sigemptyset (sigset_t *set)
^
sigprocmask.c:110:21: error: expected ')' before '*' token
sigaddset (sigset_t *set, int sig)
^
sigprocmask.c:110:1: error: expected ')' before '|=' token
sigaddset (sigset_t *set, int sig)
^
sigprocmask.c:130:21: error: expected ')' before '*' token
sigdelset (sigset_t *set, int sig)
^
sigprocmask.c:130:1: error: expected ')' before '&=' token
sigdelset (sigset_t *set, int sig)
^
sigprocmask.c:151:22: error: expected ')' before '*' token
sigfillset (sigset_t *set)
^
sigprocmask.c:151:1: error: expected ')' before '=' token
sigfillset (sigset_t *set)
^
make[2]: *** [sigprocmask.o] Error 1
[... ETC....]
我在这里不知所措。我尝试省略“nostdlib”标志,但随后配置步骤失败,因为编译器找不到 _exit(我正在为没有操作系统的目标构建,所以这是有道理的)。那么,我错过了什么?libiconv 是否依赖于 -nostdlib 删除的内容?如果是这样,那如何解释这些显然是语法错误的事实?
所以我想我的问题归结为:是否有可能为没有操作系统的系统构建 libiconv?如果是这样,我该如何克服当前的障碍?