rob*_*ill 4 c macos automake autoconf libtool
我正在尝试将libcsv转换为使用libtool,因此我可以在mac os x上使用它而不会破坏makefile.当我尝试运行从工具生成的makefile时,我收到以下错误:
~/software/libcsv (gnu_tools) $ make
tag=CC --mode=compile gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"libcsv\"
-DVERSION=\"3.0.1\" -I. -g -O2 -MT libcsv.lo -MD -MP -MF .deps/libcsv.Tpo -c -o libcsv.lo
libcsv.c
/bin/sh: --mode=compile: command not found
make: [libcsv.lo] Error 127 (ignored)
mv -f .deps/libcsv.Tpo .deps/libcsv.Plo
mv: rename .deps/libcsv.Tpo to .deps/libcsv.Plo: No such file or directory
make: *** [libcsv.lo] Error 1
Run Code Online (Sandbox Code Playgroud)
我正在运行OS X 10.5.经过一番小小的考虑后,我注意到生成的makefile有一个空的libtool var:
<generated makefile>
LD =
LDFLAGS =
LIBOBJS =
LIBS =
LIBTOOL =
LIPO =
LN_S =
LTLIBOBJS =
<more generated makefile>
Run Code Online (Sandbox Code Playgroud)
如果我将LIBTOOL设置为libtool,那么一切都很好.我假设我在我的autoconf或automake文件中犯了一个错误,如下所示:
Makefile.am
lib_LTLIBRARIES = libcsv.la
libcsv_la_SOURCES = libcsv.c
include_HEADERS = csv.h
libcsv_la_LDFLAGS = -version-info 3:1:0
ACLOCAL_AMFLAGS = -I m4
configure.ac
dn1 Process this file with autoconf to produce a configure script.
AC_INIT(libcsv.c)
AM_INIT_AUTOMAKE(libcsv, 3.0.1)
AC_PROG_CC
AC_OUTPUT(Makefile)
AC_PROG_LIBTOOL
AC_CONFIG_MACRO_DIR([m4])
AC_CHECK_FUNCS([strerror])
AC_FUNC_MALLOC
C_PROG_RANLIB
AC_PROG_CXX
LT_INIT
LT_OUTPUT
AC_TYPE_SIZE_T
Run Code Online (Sandbox Code Playgroud)
如果有任何帮助,这是config.log的一部分:
## ------------------ ##
## Running config.lt. ##
## ------------------ ##
config.lt:680: creating libtool
configure:17115: checking for size_t
configure:17115: gcc -c -g -O2 conftest.c >&5
configure:17115: $? = 0
configure:17115: gcc -c -g -O2 conftest.c >&5
conftest.c: In function 'main':
conftest.c:62: error: syntax error before ')' token
configure:17115: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "libcsv"
| #define VERSION "3.0.1"
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_STRERROR 1
| #define HAVE_STDLIB_H 1
| #define HAVE_MALLOC 1
| /* end confdefs.h. */
| #include <stdio.h>
| #ifdef HAVE_SYS_TYPES_H
| # include <sys/types.h>
| #endif
| #ifdef HAVE_SYS_STAT_H
| # include <sys/stat.h>
| #endif
| #ifdef STDC_HEADERS
| # include <stdlib.h>
| # include <stddef.h>
| #else
| # ifdef HAVE_STDLIB_H
| # include <stdlib.h>
| # endif
| #endif
| #ifdef HAVE_STRING_H
| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
| # include <memory.h>
| # endif
| # include <string.h>
| #endif
| #ifdef HAVE_STRINGS_H
| # include <strings.h>
| #endif
| #ifdef HAVE_INTTYPES_H
| # include <inttypes.h>
| #endif
| #ifdef HAVE_STDINT_H
| # include <stdint.h>
| #endif
| #ifdef HAVE_UNISTD_H
| # include <unistd.h>
| #endif
| int
| main ()
| {
| if (sizeof ((size_t)))
| return 0;
| ;
| return 0;
| }
configure:17115: result: yes
Run Code Online (Sandbox Code Playgroud)
那么有谁知道我做错了什么?
提前致谢.
我没有一个明确的答案,但我suggst的第一件事就是把你AC_OUTPUT在你的结束configure.ac,后LT_INIT.这并不完全是这么简单,但是考虑configure.ac到依次扩展到依赖执行的shell脚本片段的内容并没有太大的错误.如果Makefile在找到之前发出配置libtool,则可以解释LIBTOOL为空.
您的相当传统的布局configure.ac如下:
dnl Process this file with autoconf to produce a configure script.
AC_INIT(libcsv.c)
AM_INIT_AUTOMAKE(libcsv, 3.0.1)
AC_CONFIG_MACRO_DIR([m4])
dnl find programs
AC_PROG_CC
AC_PROG_CXX
LT_INIT
AC_PROG_RANLIB
dnl check functionality
AC_CHECK_FUNCS([strerror])
AC_FUNC_MALLOC
AC_TYPE_SIZE_T
AC_OUTPUT(Makefile)
Run Code Online (Sandbox Code Playgroud)
我认为你不需要LT_OUTPUT,而且文档注意到这AC_PROG_LIBTOOL是一个不推荐使用的同义词LT_INIT(所以两者都可能有问题).
(没有什么关系,注意OS X有一个叫做的命令libtool,这与GNU Libtool没什么关系.我很确定这不是你的问题,但这是一个让人困惑的问题)
| 归档时间: |
|
| 查看次数: |
4966 次 |
| 最近记录: |