Author Topic: Installation Problem: Error with -lX11  (Read 7911 times)

Aravind27

  • New Member
  • *
  • Posts: 8
Installation Problem: Error with -lX11
« on: November 12, 2019, 07:03:00 AM »
Hello everybody,

I am trying to set up FEAP 8.3 in my personal PC running Ubuntu 18.04 LTS using a pre-compiled archive file that I got from my University. I have also exported the environment variable as shown in the installation video.

I have an example problem with user defined material routine with a working 'feap' executable. Running this works without any issues. Solution converges and I can visualize results also in the plot window. But, when I change the user material routine and recompile (using 'make') the makefile in the working directory, I get the following error.

Error:

-L/usr/X11R6/lib -lX11 -lm
/usr/bin/ld: cannot find -lX11
collect2: error: ld returned 1 exit status
makefile:45: recipe for target 'feap' failed
make: *** [feap] Error 1


and the part of the makefile that I think would be relevant is

[44]  $(FOBJ) $(ARFEAP)
[45]  ranlib $(ARFEAP)
[46]  $(FF) -o feap [44]  $(FOBJ) $(ARFEAP) \
[47]  $(LDOPTIONS)

where
[]                =  Line number in the makefile
FOBJ           =  list of local fortran subroutines
ARFEAP       =  Path to the pre-compiled archive
LDOPTIONS =  -L/usr/X11R6/lib -lX11 -lm

I am working with gcc-5 and gfortran-5 compilers.

Looking forward to your help!

Thank you and wish you a nice day!

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: Installation Problem: Error with -lX11
« Reply #1 on: November 12, 2019, 04:36:34 PM »
As the error say, it can not find the X11 library.  Try running
Code: [Select]
sudo apt-get install libX11-dev

Aravind27

  • New Member
  • *
  • Posts: 8
Re: Installation Problem: Error with -lX11
« Reply #2 on: November 13, 2019, 04:33:25 AM »
Hello,

Thanks a lot for replying!

Yes, installing libx11-dev solved the problem. But now I have run into another error when I am trying to 'make' the makefile of the same working example. The error is:

Error:

/usr/bin/ld: /home/mib/ls1/a_feap_bin/serial/tools_83s/Feap8_3g.a(***.o): relocation R_X86_64_32 against '.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/mib/ls1/a_feap_bin/serial/tools_83s/Feap8_3g.a(***.o): relocation R_X86_64_32S against '.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/mib/ls1/a_feap_bin/serial/tools_83s/Feap8_3g.a(***.o): relocation R_X86_64_32S against '.bss' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output

collect2: error: ld returned 1 exit status
makefile:45: recipe for target 'feap' failed
make: *** [feap] Error 1


where,

***.o is all the output files in the pre-compiled archive file Feap8_3g.a (So essentially I am getting this error for a lot of .o files).

/home/mib/ls1/a_feap_bin/serial/tools_83s is my FEAP installation directory. I have also exported the environment variable to hold this path before running 'make'.


Would be wonderful if you can help me out!

Thankyou. Have a good day!
« Last Edit: November 13, 2019, 04:39:50 AM by Aravind27 »

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: Installation Problem: Error with -lX11
« Reply #3 on: November 13, 2019, 08:07:32 AM »
As before, the error tells you what you need to do.  In this case, it is asking that the archive files be recompiled using the
Code: [Select]
-fPICoption flag. 

Before trying to rebuild the full archive you could check to see if this is only need on the final link by adding -fPIC after  "$(FF) -v" in main/makefile.

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: Installation Problem: Error with -lX11
« Reply #4 on: November 13, 2019, 10:31:14 AM »
One additional point.

I just did a clean install on a system running the Ubuntu 18.04 LTS.  I received no -fPIC errors at all.  You may want to consult the person that generated the archive to see what options they have used in building it and what options they are using in main/makefile.

Aravind27

  • New Member
  • *
  • Posts: 8
Re: Installation Problem: Error with -lX11
« Reply #5 on: November 22, 2019, 01:09:16 AM »
Dear Prof. S. Govindjee,

Thanks a lot for your help and also for taking the effort to install feap on the same version of Ubuntu.

I could solve the error and thought I'd share it here so that it could help someone else facing a similar problem.

Apparently, the archive file that I received was fine. The problem was with the default versions of gcc and gfortran that was called.

Running the following in the terminal worked for me:

ln -s /usr/bin/gcc-5.3.1 /usr/bin/gcc
ln -s /usr/bin/gfortran-5.3.1 /usr/bin/gfortran 


Thanks a lot! Have a good day.

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: Installation Problem: Error with -lX11
« Reply #6 on: November 22, 2019, 10:38:09 AM »
The other way to accomplish this without having to reconfigure your system is to set FF and CC in makefile.in to point to the version you want.

osman

  • Jr. Member
  • **
  • Posts: 13
Re: Installation Problem: Error with -lX11
« Reply #7 on: November 26, 2019, 06:16:18 AM »
Hi

I have just encountered the same issue while compiling FEAP 8.3 on UBUNTU 18.04 LTS. Here is my solution

- If you have given several unsuccessful trials already, it would be good to  type  'make clean' inside /ver83

- then just make the following change ( which is asked anyways) in the makefile.in

FFOPTFLAG = -02  -Wall -fPIC

That was all in my case and I managed to create the archive files and feap executable later on.

Best wishes,
Osman