Hello Everyone,
I am trying to build Lammps using CMake with the ScaFaCoS package using the option
-D DOWNLOAD_SCAFACOS=yes
and towards the end of the compilation, I get the following ScaFaCoS related errors during linking wherein it recommends using the “-fPIC” flag and recompile.
Check below for more details.
My OS is Ubuntu-18.04 LTS. The compilers that I am using are:
GNU Fortran (Ubuntu 4.8.5-4ubuntu8) 4.8.5, and,
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
The LAMMPS version is stable release from October 29 2020.
I am wondering where I should make the change in the Fortran compiler flags “FCFLAGS” variable to resolve this error.
Any guidance in this regard shall be very helpful. Thanks.
Warm regards,
Vaibhav.
[100%] Linking CXX executable lmp
/usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(fmm_cbindings.o): relocation R_X86_64_32S against .bss' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(fmm_tune.o): relocation R_X86_64_32 against symbol
__mp_wrapper_MOD_mp_allnodes’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(mp_wrapper.o): relocation R_X86_64_32 against .rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(cfmm_tune.o): relocation R_X86_64_32 against symbol
__mp_wrapper_MOD_mp_allnodes’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(fmm.o): relocation R_X86_64_32 against .rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(getcjpa.o): relocation R_X86_64_32 against
.rodata’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(getneighbors.o): relocation R_X86_64_32S against .rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(pvlist.o): relocation R_X86_64_32 against
.rodata’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(get_fmmec_0d.o): relocation R_X86_64_32S against .rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(get_fmmec_3d.o): relocation R_X86_64_32S against
.rodata’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(get_fmmec_1d.o): relocation R_X86_64_32S against .rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(get_fmmec_2d.o): relocation R_X86_64_32S against
.rodata’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(fmmmopnp00.o): relocation R_X86_64_32 against .rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(fmmgradtp00.o): relocation R_X86_64_32 against
.rodata’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(fmmoopnp00.o): relocation R_X86_64_32 against .rodata' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: scafacos_build-prefix/lib/libfcs_fmm.a(caladdr2.o): relocation R_X86_64_32 against
.data’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(stop.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libgfortran.a(close.o): relocation R_X86_64_32 against
.rodata.str1.8’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(file_pos.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libgfortran.a(open.o): relocation R_X86_64_32 against
.rodata.str1.8’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(transfer.o): relocation R_X86_64_32S against .rodata.bswap_array' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libgfortran.a(unit.o): relocation R_X86_64_32 against
.rodata.str1.8’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(unix.o): relocation R_X86_64_32 against symbol [email protected]@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libgfortran.a(write.o): relocation R_X86_64_32 against
.rodata.limits.12228’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(string_intrinsics.o): relocation R_X86_64_32S against .bss.zero_length_string' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libgfortran.a(compile_options.o): relocation R_X86_64_32 against
.rodata.str1.1’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(environ.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: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libgfortran.a(error.o): relocation R_X86_64_32 against
.rodata.str1.1’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(main.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libgfortran.a(memory.o): relocation R_X86_64_32 against
.rodata.str1.1’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(format.o): relocation R_X86_64_32S against .rodata.format_lex.part.3' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libgfortran.a(list_read.o): relocation R_X86_64_32S against
.rodata.eat_separator’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(read.o): relocation R_X86_64_32S against .rodata.masks.11891' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libgfortran.a(random.o): relocation R_X86_64_32 against symbol
[email protected]@GLIBC_2.2.5’ can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/…/…/…/x86_64-linux-gnu/libgfortran.a(backtrace.o): relocation R_X86_64_32 against `.rodata.str1.1’ 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
CMakeFiles/lmp.dir/build.make:132: recipe for target ‘lmp’ failed
make[2]: *** [lmp] Error 1
CMakeFiles/Makefile2:546: recipe for target ‘CMakeFiles/lmp.dir/all’ failed
make[1]: *** [CMakeFiles/lmp.dir/all] Error 2
Makefile:129: recipe for target ‘all’ failed
make: *** [all] Error 2