bugGNU Astronomy Utilities - Bugs: bug #61192, BuildProgram custom program...

 
 

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

bug #61192: BuildProgram custom program linking problems on Debian-based OSs

Submitter:  Raul Infante-Sainz <infantesainz>
Submitted:  Mon 20 Sep 2021 12:45:14 PM UTC
   
 
Category:  BuildProgram Severity:  3 - Normal
Item Group:  Crash Status:  Fixed
Privacy:  Public Assigned to:  makhlaghi
Open/Closed:  Closed

Tue 21 Sep 2021 05:06:50 PM UTC, comment #4: 

I have just tried the most recent version of Gnuastro with this fix and I can confirm that the problem has been solved. Now BuildProgram works perfectly and is able to compile the programs. Thank you very much Mohammad.

Raul Infante-Sainz <infantesainz>
Group Member
Tue 21 Sep 2021 04:29:46 PM UTC, comment #3: 

With the help of Raul we had an in-person trial (comparing the runs on my computer and his) and we were able to track the source of the problem: Debian (and thus all derivative OSs) patch (or modify) GNU Libtool to avoid linking with dependency libraries!!!

I was able to get a modified Debian 'libtool' script and reproduce the problem on my Arch GNU/linux and I am happy to say that the problem has been solved in Commit 9ff5f5993.

This should fix the problem, so I am closing this bug, and modifying the title to be more clear on the cause.

But just to make sure, can you try building this commit of Gnuastro on your computer again Raul? If the problem persists, please open the bug again. Its ready-to-build tarball is also available here: https://akhlaghi.org/gnuastro-latest.tar.lz

Mohammad Akhlaghi <makhlaghi>
Group administrator
Mon 20 Sep 2021 01:38:04 PM UTC, comment #2: 

Thanks Mohammad. This is what I can see in the configure step:


checking whether wctob works... guessing yes
checking whether wctob is declared... yes
linking flags (LDADD) ... -lgit2 -ltiff -ljpeg -L/usr/local/lib -lwcs -R/usr/local/lib -L/usr/local/lib -lcfitsio -R/usr/local/lib -lz -L/usr/local/lib -lgsl -L/usr/local/lib -lgslcblas -lm -R/usr/local/lib -lm
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile


As you can see, they are not empty.

Raul Infante-Sainz <infantesainz>
Group Member
Mon 20 Sep 2021 12:53:33 PM UTC, comment #1: 

Thanks for reporting this Raul. The strange thing is that on my Arch GNU/Linux, this doesn't happen and all Gnuastro's dependency libraries (including the math library) are automatically linked when I run BuildProgram.


gcc -Wall -O3 normalize-and-asinh-edited.c -I/usr/local/include -o normalize-and-asinh-edited  /usr/local/lib/libgnuastro.so -L/usr/local/lib -lgit2 -ltiff -ljpeg -lwcs -lcfitsio -lcurl -lbz2 -lz /usr/local/lib/libgsl.so /usr/local/lib/libgslcblas.so -lm -lc -lpthread -pthread -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib


The list of dependency libraries is created at configure time. We should see why on Ubuntu, they are empty. Can you re-configure Gnuastro and send the line above the "checking that generated files are newer than configure" (close to the end, just before generating the Makefiles)? In particular, I want to see the "linking flags (LDADD) ..." line.


...
checking whether wctob works... guessing yes
checking whether wctob is declared... yes
linking flags (LDADD) ... -lgit2   -ltiff   -ljpeg   /usr/local/lib/libwcs.a   /usr/local/lib/libcfitsio.a   -lcurl   -lbz2   -lz   /usr/local/lib/libgsl.a /usr/local/lib/libgslcblas.a -lm   -lm
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/Makefile
...


If my guess is correct, this line should be empty for you!

Mohammad Akhlaghi <makhlaghi>
Group administrator
Mon 20 Sep 2021 12:45:14 PM UTC, original submission:  

When trying to compile with 'BuildProgram' a small program that uses the function 'asinh' from 'math.h', an error occurs.


$ astbuildprog FileName.c

astbuildprog FileName.c

Compiling and linking the program
---------------------------------
libtool: link: gcc -Wall -O3 FileName.c -I/usr/local/include -o FileName  /usr/local/lib/libgnuastro.so -pthread
/usr/bin/ld: /tmp/ccpCWGkZ.o: undefined reference to symbol 'asinh@@GLIBC_2.2.5'
/usr/bin/ld: /lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
astbuildprog: failed to build, see libtool error above


In this particular case, the problem can be fixed by adding the flag '-lm'. However, it is necessary to check what is happening because the main goal of using 'BuildProgram' is actually to avoid having to add all necessary flags manually. This issue happen with Gnuastro 0.15.54-4846 in Ubuntu 20.04.

Raul Infante-Sainz <infantesainz>
Group 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 infantesainz (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.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-09-21 makhlaghi Open/ClosedOpen Closed
    2021-09-21 makhlaghi StatusNone Fixed
        Assigned toNone makhlaghi
        SummaryBuildProg does not add the proper flags BuildProgram custom program linking problems on Debian-based OSs

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code