krime / serf

Automatically exported from code.google.com/p/serf
Apache License 2.0
1 stars 0 forks source link

[PATCH] autoconf build system fails with gssapi #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Follow-up on #95... the change was modified to include a linker test. However 
AC_LINK_IFELSE fails unless LIBS="$LIBS $GSSAPI_libs". See attached patch.

What steps will reproduce the problem?
1. run ./configure --with-gssapi=/usr/lib/mit

What is the expected output? What do you see instead?

expected:

[   84s] checking for krb5-config... /usr/lib/mit//bin/krb5-config
[   84s] checking for gssapi support in krb5-config... yes
[   84s]   adding "-DSERF_HAVE_GSSAPI" to CFLAGS
[   84s]   adding "-lgssapi_krb5" to LDFLAGS
[   84s]   adding "-lkrb5" to LDFLAGS
[   84s]   adding "-lk5crypto" to LDFLAGS
[   84s]   adding "-lcom_err" to LDFLAGS
[   84s] checking if gssapi works... yes

actual

[   85s] checking for gssapi support in krb5-config... yes
[   85s]   adding "-DSERF_HAVE_GSSAPI" to CFLAGS
[   85s]   adding "-lgssapi_krb5" to LDFLAGS
[   85s]   adding "-lkrb5" to LDFLAGS
[   85s]   adding "-lk5crypto" to LDFLAGS
[   85s]   adding "-lcom_err" to LDFLAGS
[   85s] checking if gssapi works... no
[   85s] configure: error: cannot find GSSAPI (Kerberos)

What version of the product are you using? On what operating system?

serf 1.2.1 on openSUSE 12.2 through Factory

Please provide any additional information below.

Original issue reported on code.google.com by andreas.stieger@gmx.de on 3 Jun 2013 at 9:36

Attachments:

GoogleCodeExporter commented 9 years ago
That's peculiar, why do you need LIBS set, it's filling in LDFLAGS, so it 
should work.

Documentation for AC_LINK_IFELSE says it observes LDFLAGS:
http://www.hep.by/gnu/autoconf/Running-the-Linker.html

Original comment by breser on 3 Jun 2013 at 10:55

GoogleCodeExporter commented 9 years ago
Yes, I would expect this to work, and it only seems to occur in the chrooted 
osc build environment (open build service). Works fine in a regular system.

Relevant config.log section below. The exact gcc command compiles the conftest 
code fine elsewhere. Odd.

configure:4779: checking for krb5-config
configure:4783: result: /usr/lib/mit//bin/krb5-config
configure:4785: checking for gssapi support in krb5-config
configure:4788: result: yes
configure:4869: checking if gssapi works
configure:4878: gcc -std=gnu99 -o conftest -fomit-frame-pointer 
-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 
-fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -pthread 
-DSERF_HAVE_GSSAPI  -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE   
-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err conftest.c  >&5
/tmp/ccoQtD6s.o: In function `main':
/home/abuild/rpmbuild/BUILD/serf-1.2.1/conftest.c:22: undefined reference to 
`gss_init_sec_context'
collect2: error: ld returned 1 exit status
configure:4878: $? = 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 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
| /* end confdefs.h.  */
| 
| #include <gssapi.h>
| int main()
| {gss_init_sec_context(NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 
NULL, NULL, NULL);}
configure:4889: result: no
configure:4891: error: cannot find GSSAPI (Kerberos)

Original comment by andreas.stieger@gmx.de on 4 Jun 2013 at 6:09

GoogleCodeExporter commented 9 years ago
This works as well:

Index: serf-1.2.1/configure.in
===================================================================
--- serf-1.2.1.orig/configure.in        2013-06-03 18:52:41.000000000 +0100
+++ serf-1.2.1/configure.in     2013-06-04 07:15:02.000000000 +0100
@@ -230,7 +230,7 @@ AC_ARG_WITH(gssapi,
        fi
        APR_ADDTO(CFLAGS, "$GSSAPI_cflags")
        APR_ADDTO(CFLAGS, [-DSERF_HAVE_GSSAPI])
-       APR_ADDTO(LDFLAGS, "$GSSAPI_libs")
+       APR_ADDTO(LIBS, "$GSSAPI_libs")
        AC_MSG_CHECKING([if gssapi works])
        AC_LINK_IFELSE([AC_LANG_SOURCE([[
 #include <gssapi.h>

Original comment by andreas.stieger@gmx.de on 4 Jun 2013 at 6:17

GoogleCodeExporter commented 9 years ago
LIBS should be used instead of LDFLAGS, because order is important.

`man ld` in description of -l option says:
The linker will search an archive only once, at the location where it is 
specified on the command line.  If the archive defines a symbol which was 
undefined in some object which appeared before the archive on the command line, 
the linker will include the appropriate file(s) from the archive.  However, an 
undefined symbol in an object appearing later on the command line will not 
cause the linker to search the archive again.

Original comment by Arfrever...@gmail.com on 4 Jun 2013 at 6:20

GoogleCodeExporter commented 9 years ago
Applied the patch to use LIBS by Andreas Stieger.

Original comment by breser on 5 Jun 2013 at 11:30

GoogleCodeExporter commented 9 years ago

Original comment by breser on 5 Jun 2013 at 11:33