CFDEM Compilation problem - Cannot find -llagrangianCFDEM-PUBLIC-3.0.x -llmp_ubuntuVTK6

Submitted by AndresMM on Fri, 05/26/2017 - 10:17

Hi everybody,

I am having problems compiling CFDEM on an Ubuntu 14.04 virtual machine in a server.

- I installed and compiled OpenFOAM-3.0.x(commit from versionH) and LIGGGHTS. Both compiled without errors and I can execute examples for both of them. I compiled LIGGGHTS "on its own" without using the cfdemCompLIG command. The compilation of LIGGGHTS was done using the ubuntuVTK6 makefile. I also changed the $CFDEM_LIGGGHTS_MAKEFILE_NAME to ubuntuVTK6 since I think cfdem uses this field to look for a executable. I linked the VTK libraries where it was necessary.

- When I try to compile CFDEM (cfdemCompCFDEM) I get the following errors

During the compilation of liblagrangianCFDEM-Public-3.0.x:
/usr/bin/ld: cannot find -llmp_ubuntuVTK6

And during the compilation of the solvers:
/usr/bin/ld: cannot find -llagrangianCFDEM-PUBLIC-3.0.x

As I understand it, the lagrangian library is made using the lmp_ubuntuVTK6 library, so the first error causes the second one.

- The liblmp_ubuntuVTK6.a library should be located in /root/LIGGGHTS/LIGGGHTS-PUBLIC/SRC (I assume this after looking in my local machine with a working CFDEM installation).

-During which step is this library supposed to be created?
The problem lies in that the library has not been made. Does this take place during the compilation of LIGGGHTS or CFDEM?
Furthermore, there is an application "lmp_ubuntuVTK6" in /root/LIGGGHTS/LIGGGHTS-PUBLIC/SRC, and LIGGGHTS works so I can not imagine it lies on the LIGGGHTS compilation. I have also looked everywhere for "liblmp_ubuntuVTK6.a" and it is nowhere to be found, so that could rule out a false path.

I have uploaded the output of cfdemSysTest and cfdemCompCFDEM. If other logs are necessary, I can upload them.

Cheers,
A

AttachmentSize
Plain text icon cfdemcompcfdem.txt345.96 KB
Plain text icon cfdemsystest.txt3.87 KB

AndresMM | Fri, 05/26/2017 - 10:54

Apparently all that was needed was

cfdemCleanCFDEM
cfdemCompCFDEMall

The "liblmp_ubuntuVTK6.a" library was created in /LIGGGHTS/LIGGGHTS-PUBLIC/SRC

However now the second errors remains:

/usr/bin/ld: cannot find -llagrangianCFDEM-PUBLIC-3.0.x

(This library should be in /OpenFOAM/root-3.0.x/platforms/linux64GccDPInt32Opt/lib)

This comes from another error during its creation:
/usr/bin/ld: /root/LIGGGHTS/LIGGGHTS-PUBLIC/src/liblmp_ubuntuVTK6.a(angle.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

So I assume this compiling flag must be included somewhere, the question is where?
probably in compileCFDEMcoupling_src.sh (cfdemCompCFDEMsrc) in .../src/lagrangian/cfdemParticle/etc?

AndresMM | Fri, 05/26/2017 - 13:06

I found the problem.

The -fPIC flag had to be added to the Makefile of LIGGGHTS in two places.

I used the Makefile.UbuntuVTK6 and added -fPIC ONLY to the SHFLAGS field. I forgot to add it to the CCFLAGS field.

In short, if you are having troubles not finding:
-llagrangianCFDEM-PUBLIC-3.0.x
-llmp_ubuntuVTK6

Make sure your flags in your Makefile for LIGGGHTS are adequately setup:
------------------------
CC = mpic++
CCFLAGS = -O2 \
-funroll-loops -fstrict-aliasing -Wall -Wno-unused-result -fPIC
SHFLAGS = -fPIC
------------------------
Also do not forget to link your VTK and MPI libraries

Make sure you are referencing your Makefile in the $CFDEM variables (check this in your ~/.bashrc file), as well as the location of the additional libraries and the path to them.

then
cfdemCleanCFDEM
cfdemCompCFDEMall

It should work now