mainGNU Astronomy Utilities - Support: sr #109171, Linker errors when running from...

 
 

sr #109171: Linker errors when running from system-wide install

Submitter:  Mohammad Akhlaghi <makhlaghi>
Submitted:  Sat 22 Oct 2016 10:26:27 PM UTC
   
 
Category:  Installation Priority:  5 - Normal
Severity:  4 - Important Item Group:  * Crash
Status:  Done Privacy:  Public
Assigned to:  makhlaghi Open/Closed:  Closed
Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 23 Oct 2016 04:35:48 PM UTC, comment #6: 

Thanks for the further explanation, it explains the problem. I added an item to the Known issues section of the book to warn users to not manually copy the built executables (this new item will be available in the next release of the online manual).

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sun 23 Oct 2016 03:42:30 PM UTC, comment #5: 

Thanks for the clear explanation.

Looking at the bash history I was not able to reproduce the error again, but indeed it happens if I replace by hand the binary file by the executable before installation (e.g. I move `bin/cosmiccal/astcosmiccal' to `/usr/bin/astcosmiccal'). So that must be what I ended up doing somehow, and I didn't remove it properly (maybe also worth mentioning that before proceeding with the installation I updated several packages including system libraries).

Thanks!
Francesco

Francesco Montanari <fmontanari>
Sun 23 Oct 2016 01:11:43 PM UTC, comment #4: 

Its great that the problem has been fixed. I am marking this issue as closed. However, discussion is not unlocked, so if you do find the cause of the problem, it would be great if you could post it as a comment here for the future (other users that might take the same steps).

If you are interested in learning more about the `.libs' directory and Libtool, its manual is a good starting point. In summary, its created to facilitate portability of shared libraries (installation on a wide variety of operating systems).

Since the Gnuastro programs depend on a shared library, their main executable file before installation (for example `bin/cosmiccal/astcosmiccal') is not a binary file, its actually a shell script (created by Libtool). This shell script calls the actual compiled (binary) executable, which is in the `.libs' directory along with some other information to help in portability. But after installation the binary file is placed in the installation directory and the `.libs' file is no longer necessary.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sun 23 Oct 2016 05:58:33 AM UTC, comment #3: 

Hi guys,

Thanks a lot for the prompt replies! Here is more precisely what I was doing:


./configure --prefix=/usr
make -j3
make check
sudo make install


Also:


$ which astcosmiccal
/usr/bin/astcosmiccal


I am on debian stretch.

As I just wrote on the mailing list, I think I messed up when first installing on local folders and then in the system directory. If it is relevant, I was also trying to --disable-shared in both cases.

Not sure where I messed up (after each installation I gave make uninstall and reset the system PATH to the default one). I removed completely the folder, rebooted and re-installed directly in /usr/bin/, which seems to work fine.

Thanks for the explanation about the ld tool. I will try to go through the history and see at which point a .libs/ folder started to be required.

Francesco Montanari <fmontanari>
Sat 22 Oct 2016 11:12:07 PM UTC, comment #2: 

Ciao Francesco,

could you please share the exact recipe with which you built and installed gnuastro?  I don't think you can successfully run


./configure && make && make check && make install


unless you gained root privileges before issuing this command chain.  If so, try building gnuastro as a normal user and only install it with root privileges.

If instead you had done as I suggested and you wrote the command chain in that way only for the sake of shortness, you can ignore my message

Mosè Giordano <giordano>
Group Member
Sat 22 Oct 2016 10:57:07 PM UTC, comment #1: 

I had never confronted this situation. It is certainly not expected ;-)!

The problem is to do with linking (the `ld' tool). The `.libs' directory is created internally (in the build directory) by GNU Libtool, it is there for portability on various systems (a portable shared library system on various operating systems is a very tricky job that Libtool does). But the `.libs' directory is not installed, so I am surprized why your system is looking into `/usr/bin/.libs'.

More generally, I am wondering how/why it is looking into `/usr/bin/', it should be looking into `/usr/local/bin'. Could you report the output of this command (to see where the main executable is located in):


which astcosmiccal


May I ask what operating system you are using?

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sat 22 Oct 2016 10:26:27 PM UTC, original submission:  

(This was reported by Francesco Montanari in help-gnuastro)

When installing the programs in a local folder everything works fine. However, when installing in a system folder (./configure && make && make check && make install):


$ astcosmiccal -z 1
/usr/bin/ld: cannot open output file
/usr/bin/.libs/9000-lt-astcosmiccal: Permission denied
collect2: error: ld returned 1 exit status


This would require to run gnuastro with root privileges. Is this
expected and is there a way to avoid it? Just out of curiosity, what is the purpose of this .libs/ folder?

Mohammad Akhlaghi <makhlaghi>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

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 fmontanari (Posted a comment)
  • -email is unavailable- added by giordano (Posted a comment)
  • -email is unavailable- added by makhlaghi (Submitted the item)
  • -email is unavailable- added by makhlaghi
  •  

    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.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-10-23 makhlaghi StatusNeed Info Done
        Open/ClosedOpen Closed
        Operating SystemNone GNU/Linux
    2016-10-22 makhlaghi Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code