bugGNU Astronomy Utilities - Bugs: bug #57894, Wrong order of flags when...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #57894: Wrong order of flags when configuring Gnuastro 0.11 for x86_64-w64-mingw32

Submitter:  Mosè Giordano <giordano>
Submitted:  Tue 25 Feb 2020 04:26:22 PM UTC
 
Category:  Installation Severity:  3 - Normal
Item Group:  Configuration file Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Tue 25 Feb 2020 11:11:16 PM UTC, comment #1: 

Thanks Mose! This part of the configure script is automatically generated by Gnulib's `AC_LIB_HAVE_LINKFLAGS' macro, its not written by hand. The part that is written by hand is in line 314 of the configure.ac file, where we just define the C function to test with:

AC_LIB_HAVE_LINKFLAGS([cfitsio], [], [
#include <fitsio.h>
void junk(void) {
int status;
fitsfile *f;
ffopen(&f, "junk", READONLY, &status);} ])

Just above that shell `case' statement, on my system, `LIBCFITSIO' expands to `/usr/local/lib/libcfitsio.so -Wl,-rpath -Wl,/usr/local/lib'. So it doesn't start with ` -l', and it falls in the proper condition of `LIBS="$LIBCFITSIO $LIBS"'.

In an attempt to reproduce the problem, I manually set `LIBCFITSIO  =-lcfitsio' and the same compile command came (with `-lcfitsio' after all the other libraries. However, my compiler didn't have a problem!!!

I then noticed that in the end, it doesn't actually use this `LIBS' at all, it resets it with the `LIBS="$ac_save_LIBS"' statement. So in the end, on my system (where the ordering didn't cause a crash), the final value of LIBS is actually set from the `LIBS="$LIBCFITSIO $LIBS"' statement (which is hand-written and can be seen in `configure.ac').

So I think this is a bug in Gnulib (and the `AC_LIB_HAVE_LINKFLAGS' in particualr), if you have the chance, can you post it to them?

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Tue 25 Feb 2020 04:26:22 PM UTC, original submission:  

When cross-compiling Gnuastro 0.11 for x86_64-w64-mingw32, configure fails to find CFITSIO for me:

configure:23857: cc -o conftest.exe -Wall -O3  -pthread -I/workspace/destdir/include  conftest.c -lcurl -lz -lgsl -lgslcblas -lm   -lcfitsio >&5
/opt/x86_64-w64-mingw32/bin/../x86_64-w64-mingw32/sys-root/usr/local/lib/libcfitsio.a(cfileio.o): In function `ffihtps':
/workspace/srcdir/cfitsio-3.47/cfileio.c:7771: undefined reference to `__imp_curl_global_init'
/opt/x86_64-w64-mingw32/bin/../x86_64-w64-mingw32/sys-root/usr/local/lib/libcfitsio.a(cfileio.o): In function `ffchtps':
/workspace/srcdir/cfitsio-3.47/cfileio.c:7784: undefined reference to `__imp_curl_global_cleanup'
collect2: error: ld returned 1 exit status
configure:23857: $? = 1

This happens because the order of the flags is wrong: CFITSIO depends on CURL, so `-lcurl` should follow `-lcfitsio`.  I manually changed line 23838 of `configure` from

      *" -l"*) LIBS="$LIBS $LIBCFITSIO" ;;

to

      *" -l"*) LIBS="$LIBCFITSIO $LIBS" ;;

but this should probably fixed in one of macros used by `configure.ac`.

Mosè Giordano <giordano>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by makhlaghi (Posted a comment)
  • -email is unavailable- added by giordano (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.9