building LIGGGHTS as a shared library

Submitted by ljc on Sat, 07/28/2018 - 11:43

When I want to build my LIGGGHTS to be a shared library, I always got this problem. And I have install MPICH as the tutorials, but the problem is still exist. I am a new learner of liggghts, I will very appreciate if you can help me

AttachmentSize
Image icon wei_xin_tu_pian_20180728173345.jpg24.21 KB

ljc | Sat, 08/04/2018 - 06:49

Thank you very much for your suggestion, I have tried auto, but it still have some problem I do not know how to solve them.
make[1]: Entering directory '/home/ljc/LIGGGHTS-PUBLIC/src/Obj_auto'
Makefile:815: *** 'Could not obtain VTK_MAJOR_VERSION. As AUTOINSTALL_VTK is not set to "ON" we cannot continue'。 停止。
make[1]: Leaving directory '/home/ljc/LIGGGHTS-PUBLIC/src/Obj_auto'
Makefile.shlib:62: recipe for target 'auto' failed
make: *** [auto] Error 2

arnom's picture

arnom | Wed, 08/08/2018 - 11:26

What operating system are you using and did you install vtk? If yes, how did you install it?

DCS team member & LIGGGHTS(R) core developer

tjleps | Mon, 12/10/2018 - 17:42

When you use makefile.auto for the first time it generates makefile.user. If you haven't installed and don't intend to use VTK in your application, change the line:
USE_VTK = "ON"
to:
USE_VTK = "OFF"
and recompile

Nathan | Sun, 12/09/2018 - 02:51

Hi Arnom,

I tried to build shared library for LIGGGHTS3.20, following the guidance given in Manual.

make makeshlib
make -f Makefile.shlib fedora

Following error is shown:

/usr/bin/ld: angle.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
angle.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [shlib] Error 1
make[1]: Leaving directory `/home/.../LIGGGHTS3.20_LBM/src/Obj_shlib_fedora'
make: *** [fedora] Error 2

Do you have any ideas about this issue ?

Thank you

Nathan,

arnom's picture

arnom | Mon, 12/17/2018 - 10:29

Edit the MAKE/Makefile.fedora file and add a -fPIC to your CCFLAGS and LINKFLAGS. Make sure to do a make clean-fedora and recompile.

DCS team member & LIGGGHTS(R) core developer

Michelle Phan | Mon, 03/25/2019 - 23:28

Hi Arnom,
I am new to LIGGGHTS and computer modelling. I have the same problem as above to build the shared library. Could you please give me a specific guide? I am not sure what you mean "add a -fPIC" ? In my Makefile.fedora , CCFLAGS = -02\ and LINKFLAGS = -02 , so does it mean I should change it to CCFLAGS = -02\ -fPIC and LINKFLAGS = -02 fPIC ?
Thank you

Michelle Phan | Mon, 03/25/2019 - 23:26

Hi Arnom,
I am new to LIGGGHTS and computer modelling. I have the same problem as above to build the shared library. Could you please give me a specific guide? I am not sure what you mean "add a -fPIC" ? In my Makefile.fedora , CCFLAGS = -02\ and LINKFLAGS = -02 , so does it mean I should change it to CCFLAGS = -02\ -fPIC and LINKFLAGS = -02 fPIC ?
Thank you