bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_TRY_LINK command line problem


From: Yevgen Muntyan
Subject: Re: AC_TRY_LINK command line problem
Date: Wed, 10 Jan 2007 13:04:37 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060809 Debian/1.7.13-0.3

Ralf Wildenhues wrote:

Hello Yevgen,

* Yevgen Muntyan wrote on Wed, Jan 10, 2007 at 06:17:09AM CET:
AC_TRY_LINK puts LDFLAGS before conftest.c on compilation
command line, and it fails with mingw. Here, it made the following:

/usr/bin/i586-mingw32msvc-gcc -o conftest.exe -O2 -I/usr/local/win/gtk/include -mms-bitfields -march=i686 -I/usr/local/win/gtk/include -I/usr/local/win/Python24/include -L/usr/local/win/gtk/lib -L/usr/local/win/Python24/libs -lpython24 conftest.c

It produces linker errors, undefined reference to whatever is in libpython24.
AC_COMPILE_IFELSE does work fine.

Post the errors, otherwise there's little we can do to help you.
Here you go. I am cross-compiling on linux with mingw,

AC_TRY_LINK([#include <Python.h>],[Py_Initialize();],[
   AC_MSG_RESULT([$_ac_pyincludes $_ac_pylibs])
   _ac_have_pydev=true
 ],[
   AC_MSG_RESULT(not found)
 ])

produces this in config.log:

configure:28275: /usr/bin/i586-mingw32msvc-gcc -o conftest.exe -O2 -I/usr/local/win/gtk/include -mno-cygwin -mms-bitfields -march=i686 -I/usr/local/win/gtk/include -I/usr/local/win/Python24/include -L/usr/local/win/gtk/lib -mno-cygwin -L/usr/local/win/Python24/libs -lpython24 conftest.c >&5 /tmp/ccwANJNr.o:conftest.c:(.text+0x1a): undefined reference to `__imp__Py_Initialize'
collect2: ld returned 1 exit status
configure:28281: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "medit"
| #define PACKAGE_TARNAME "medit"
| #define PACKAGE_VERSION "0.8.1"
| #define PACKAGE_STRING "medit 0.8.1"
| #define PACKAGE_BUGREPORT "address@hidden"
| #define PACKAGE "medit"
| #define VERSION "0.8.1"
| #define MOO_VERSION "0.8.1"
| #define MOO_VERSION_MAJOR 0
| #define MOO_VERSION_MINOR 8
| #define MOO_VERSION_MICRO 1
| #define MOO_MODULE_VERSION_MAJOR 1
| #define MOO_MODULE_VERSION_MINOR 0
| #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 GETTEXT_PACKAGE "moo"
| #define HAVE_LOCALE_H 1
| #define HAVE_BIND_TEXTDOMAIN_CODESET 1
| #define HAVE_GETTEXT 1
| #define HAVE_DCGETTEXT 1
| #define ENABLE_NLS 1
| #define MOO_BUILD_UTILS 1
| #define MOO_BUILD_SCRIPT 1
| #define MOO_BUILD_EDIT 1
| #define MOO_BUILD_APP 1
| #define MOO_PACKAGE_NAME "moo"
| #define MOO_OS_MINGW 1
| #define HAVE_MEMMOVE 1
| #define HAVE_STRERROR 1
| #define HAVE_UNISTD_H 1
| #define HAVE_UNLINK 1
| #define HAVE_SIGNAL_H 1
| #define RETSIGTYPE void
| #define HAVE_ERRNO_H 1
| #define HAVE_IO_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_WCHAR_H 1
| #define HAVE__PIPE 1
| #define HAVE_SIGNAL 1
| #define RETSIGTYPE void
| #define HAVE_XMLNODE_LINE 1
| #define MOO_USE_XML 1
| #define MOO_USE_XDGMIME 1
| #define MOO_BUILD_PCRE
| #define HAVE_MEMMOVE 1
| #define HAVE_STRERROR 1
| #define NEWLINE '\n'
| #define LINK_SIZE 2
| #define POSIX_MALLOC_THRESHOLD 10
| #define MATCH_LIMIT 10000000
| #define MATCH_LIMIT_RECURSION MATCH_LIMIT
| #define MAX_NAME_SIZE 32
| #define MAX_NAME_COUNT 10000
| #define MAX_DUPLENGTH 30000
| #define SUPPORT_UTF8
| #define SUPPORT_UCP
| #define EBCDIC 0
| /* end confdefs.h.  */
| #include <Python.h>
| int
| main ()
| {
| Py_Initialize();
|   ;
|   return 0;
| }


And here's same thing on command line, with the same conftest.c content:

address@hidden:~/projects/moo/build/mingw$ /usr/bin/i586-mingw32msvc-gcc -o conftest.exe -O2 -I/usr/local/win/gtk/include -mno-cygwin -mms-bitfields -march=i686 -I/usr/local/win/gtk/include -I/usr/local/win/Python24/include -L/usr/local/win/gtk/lib -mno-cygwin -L/usr/local/win/Python24/libs -lpython24 conftest.c /tmp/ccA2HUAh.o:conftest.c:(.text+0x1a): undefined reference to `__imp__Py_Initialize'
collect2: ld returned 1 exit status

and this command line with linker flags moved after conftest.c:

address@hidden:~/projects/moo/build/mingw$ /usr/bin/i586-mingw32msvc-gcc -o conftest.exe -O2 -I/usr/local/win/gtk/include -mno-cygwin -mms-bitfields -march=i686 -I/usr/local/win/gtk/include -I/usr/local/win/Python24/include conftest.c -L/usr/local/win/gtk/lib -mno-cygwin -L/usr/local/win/Python24/libs -lpython24
address@hidden:~/projects/moo/build/mingw$

I was wrong about AC_TRY_COMPILE, since it doesn't link (which I thought
it does). In any case, later I use those PYTHON_INCLUDES and PYTHON_LIBS
to link a dll, and it works fine. I used to have "AC_MSG_NOTICE([Did not do real
linking])" near this python flags check, I guess it's the reason why.

Thank you,
Yevgen





reply via email to

[Prev in Thread] Current Thread [Next in Thread]