When converting to libtool, automake and autoconf cannot find libtool

I am trying to convert libcsv to use libtool, so I can use it on mac os x without distorting the makefile. When I try to run the makefile generated from the tools, I get the following error:

~/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 

I am running OS X 10.5. Therefore, after a little distortion, I noticed that the created make file has an empty libtool var:

 <generated makefile> LD = LDFLAGS = LIBOBJS = LIBS = LIBTOOL = LIPO = LN_S = LTLIBOBJS = <more generated makefile> 

If I installed LIBTOOL in libtool, then everything will be fine. I assume that I made a mistake in autoruns or automake files that are below:

 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 

If any help here is part of 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 

So does anyone know what I did wrong?

Thanks in advance.

+4
source share
3 answers

I don't have a specific answer for you, but the first thing I would suggest is to put AC_OUTPUT at the end of your configure.ac after LT_INIT . It is not so simple, but it’s not stupid to think of the contents of configure.ac as expanding, in turn, script shell fragments that are executed in turn. If you selected a customized Makefile before you found libtool , this may explain that libtool is empty.

The pretty conditional layout of your configure.ac will be as follows:

 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) 

I don’t think you need LT_OUTPUT , and docs note that AC_PROG_LIBTOOL is an outdated synonym for LT_INIT (so having both probably requires trouble).

(Regarding nothing special, note that OS X has a command called libtool that has nothing to do with GNU Libtool. I'm pretty sure this is not your problem here, but it was a problem that confused people before)

+7
source

You can try to strengthen the integration of libtool by running libtoolize --force (I had a lot of problems with different versions of libtool on different hosts, libtoolize --force helps in such cases). Also note the configure output for libtool messages, they should look like this:

 checking if libtool supports shared libraries... yes configure: creating libtool appending configuration tag "CXX" to libtool appending configuration tag "F77" to libtool 

especially the configure: creating libtool should be present at the output.

+1
source

My .ac configuration has only:

 LT_INIT([dlopen]) AC_SUBST([LIBTOOL_DEPS]) 

LT_OUTPUT is intended to be used by libtool for subsequent tests in the configuration itself and requires config.lt to install everything. I never had to use it, so I don’t know what all this entails, but it doesn’t hurt to make this line and see if this fixes your problem.

0
source

Source: https://habr.com/ru/post/1314532/


All Articles