LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Problems using "make" and executing program (https://www.linuxquestions.org/questions/programming-9/problems-using-make-and-executing-program-4175614229/)

matti_chr 09-21-2017 05:46 AM

Problems using "make" and executing program
 
Hello everyone,

I am from Germany and very new to Linux. In school I had some courses with programming in Java and i did some work with Matlab etc. Further than this i have no experience with programming etc.

For a project I need Linux to run the program FEAP, I got some files including "makefile". Because of that I installed Linux Mint Sonya 64bit on my "old" notebook Toshiba A200. Installation went well.
Additionally I installed Intel Fortran Compiler (because I need it). After some problems with the program itself i could fix myself, I am now facing some problems:
  1. While running the makefile:
    ifort -o ../feap -L/usr/X11R6/lib64 -lX11 -lm ../64b/*.o -L../lib -lmkl_solver -lmkl_lapack -lmkl_em64t -lguide -lpthread ../lib/feaplib.a
    ifort: warning #10315: specifying -lm before files may supersede the Intel(R) math library and affect performance
  1. When I execute the "feap":
    ./feap: error while loading shared libraries: libguide.so: cannot open shared object file: No such file or directory

Thanks in advance!
Maybe the questions are "stupid" or if there are some informations missing: Sorry

hazel 09-21-2017 06:12 AM

The make message is a warning, not an error, so it shouldn't affect your build. The second message is the important one.

Error messages in Linux tend to be very informative once you have learned to look at them properly and this is a case in point. It tells you that libguide.so, one of the libraries which feap is supposed to link to, can't be found. You will have to find out what package this library belongs to (try googling the name) and install it.

There are no stupid questions! There are only stupid people who won't learn. You have given your post a reasonable title and quoted the messages you received, so you strike me as an intelligent person who should be able to learn from this.

rtmistler 09-21-2017 06:23 AM

Hi matti_chr and welcome to LQ.

Your system should have an environment variable named LD_LIBRARY_PATH set. If not, then this should be set to point to the system directories.

Please search your system for libguide.so to see if it is already there, or if you need to install it. If it is there, then check to see if you have the LD_LIBRARY_PATH environment variable and whether or not it includes a path to where this library resides. It should be there because this is part of the Intel FORTRAN compiler. What I recommend is that you check the documentation for that compiler to determine if it recommends you update your LD_LIBRARY_PATH once you've installed the compiler, so as to include the library directories which were installed.

Additionally if you're going to perform FORTRAN programming, you should become familiar with the compiler documentation, https://software.intel.com/sites/def...6366-ifort.txt

I'm moving this question to the Programming forum to get it additional exposure.

matti_chr 09-21-2017 06:51 AM

Thank you both for your quick friendly reply and help.

1) I thought that this warning is "just a warning", thank you for the confirmation, so I can focus on the error.

2) I read the Error message Linux gave me. I looked for the lipguide.so, it exists. So my next thought that probably I need to "tell" where to find. On this point I decided to ask for help.
So I think I need to set the LD_LIBRARY_PATH, right? But how? Maybe the answer is simple...

Thank you!

rtmistler 09-21-2017 06:56 AM

This should be in your .bashrc file located in your user home directory.

You can see that file using the 'ls -a' command.

You should be able to edit it with whichever editor you are normally using.

If there is no variable saying this, then do recommend you check your documentation for the tools to inform you how to set that up, however a line such as:
Code:

LD_LIBRARY_PATH=/lib:/usr/lib
Where you put in all relevant paths separated by a full colon, if you have more than one path to put into it. That is an example only and you should either add to whatever you have already, thus using the colon to separate paths, or you should create it only using the path to the library where you have found the file.

Emerson 09-21-2017 07:28 AM

You may need to run ldconfig.

NevemTeve 09-21-2017 07:29 AM

@OP: Exactly where did you find this libguide.so in your filesystem?

matti_chr 09-21-2017 07:46 AM

Ok, the program is running. What I did for the LD_LIBRARY_PATH, I used the following command in the terminal:

export LD_LIBRARY_PATH=/home/matti/Dokumente/feap81/lib


@NevemTeve: above you can the the directory of the libguide.so

Thank you all so far for your help from all over the world, I really appreciate that!:thumbsup:

hazel 09-21-2017 08:47 AM

I wouldn't do it that way. If you have LD_LIBRARY_PATH set, it should include all the library paths that you use. Otherwise, other programs might start playing up.

By default, /lib and /usr/lib are always searched for libraries. If you have other library locations on your system (for example /opt/lib), they need to be specified somewhere.

Another way would be to put these paths into /etc/ld.so.conf and then run ldconfig. That way you don't need LD_LIBRARY_PATH.

You might find this reference useful.

matti_chr 09-21-2017 09:07 AM

For my understanding:

Quote:

I wouldn't do it that way. If you have LD_LIBRARY_PATH set, it should include all the library paths that you use. Otherwise, other programs might start playing up.
With my command I set the path just to the specific library and other programs can have problems, correct?

Quote:

By default, /lib and /usr/lib are always searched for libraries. If you have other library locations on your system (for example /opt/lib), they need to be specified somewhere.
Means because I set up the path by command, other programs do not search in this default libraries?

What would be the "best" (or not problem causing) solution?

Following quote is from your link:
Quote:

The best way to use LD_LIBRARY_PATH is to set it on the command line or script immediately before executing the program. This way you can keep the new LD_LIBRARY_PATH isolated from the rest of your system.
Because of that I thought using a command before the program causes the least trouble :scratch:

NevemTeve 09-21-2017 09:18 AM

@OP: So you have installed this 'feap' program manually into your own home-directory? Then it is no wonder that it doesn't find its own shared libraries.
You could try something like this (if the executable is /home/matti/Dokumente/feap81/bin/feap):
Code:

cd /home/matti/Dokumente/feap81/bin
mv feap feap.bin
cat >feap <<DONE
#!/bin/sh
export LD_LIBRARY_PATH=/home/matti/Dokumente/feap81/lib
exec /home/matti/Dokumente/feap81/bin/feap.bin "$@"
DONE
chmod +x feap


matti_chr 09-21-2017 09:35 AM

@NevemTeve:
I am thankful for every hint.
I was given some files on USB-Stick for the feap program. Those files include the libguide.so and the makefile. I copied this files to /home/matti/dokumente/feap81.
  1. What is wrong with that? Where should I copy it to?
I then used the make command for the makefile and everything was done automatically. After that I had the problem with the library which I can solve with the command.

Thank you for the code, but would you maybe comment what it will do before I just copy and paste? I understand that it will "move" (mv) someway...

hazel 09-21-2017 09:37 AM

Quote:

Originally Posted by matti_chr (Post 5761293)
For my understanding:
With my command I set the path just to the specific library and other programs can have problems, correct?

If they are looking for libraries off the standard path (e.g in /opt/lib or /usr/local/lib, you might have problems, yes. It's always better, if you already have a LD_LIBRARY_PATH variable, to add new libraries to that existing path.
Quote:

Means because I set up the path by command, other programs do not search in this default libraries?
The linker always searches the two default libraries (/lib and /usr/lib) because they are hard-coded into the program. Other library locations are only searched if they are specified either in /etc/ld.so.conf or in the LD_LIBRARY_PATH environmental variable.
Quote:

What would be the "best" (or not problem causing) solution?
Depends on what you really want! Putting a library path into /etc/ld.so.conf makes it available to all users. LD_LIBRARY_PATH is for a single user. In addition, the paths named in this variable take precedence over the ones in /etc/ld.so.conf, which might make a difference if you had different versions of a library in different places..
Quote:

Because of that I thought using a command before the program causes the least trouble :scratch:
Ah! So you are going to use it as a one-off environmental variable on the command line. Then I withdraw my objection. Doing that can't affect any other program.

NevemTeve 09-21-2017 10:00 AM

@OP: This thing is called loader script or launcher script: it sets some environment-variables, then executes the actual binary program.

If it is properly created, running /home/matti/Dokumente/feap81/bin/feap will start the launcher script, that will set LD_LIBRARY_PATH then execute the binary program. Note: you have to correct the file-names so they match your installation.


All times are GMT -5. The time now is 05:22 AM.