makenek error in ubuntu 22.04

177 views
Skip to first unread message

Ajeesh Mohan T

unread,
Feb 29, 2024, 2:20:54 AM2/29/24
to Nek5000
Hi Neks,

I am trying to use Nek5000 in Ubuntu 22.04. As part of testing, I was trying to compile the tutorial cases, then the makenek failed with the following error.

/usr/bin/ld: /usr/local/lib/libmpich.a(allreduce.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [makefile:133: nek5000] Error 1

I tried recompiling with -fPIE by giving the -fPIE flag to makenek but it failed to understand the flag. I don't know where  I can specify the -fPIE flag.

It will be very helpful if anyone can give a solution or any insight to this problem.

Thank you in advance.

Ajeesh Mohan T

unread,
Mar 1, 2024, 2:33:03 AM3/1/24
to Nek5000
Hi Neks,

I have given -fPIE as well as the -fPIC option in core/makenek.inc at the compiler specification line and am now able to compile with -fPIE and  -fPIC.
Unfortunately, the makenek command still terminates with the same error, as given below.

mpif77 -fPIE -fPIC  -O2 -cpp -fdefault-real-8 -fdefault-double-8 -std=legacy  -DMPI -DUNDERSCORE -DGLOBAL_LONG_LONG -DTIMER -I/home/user/Desktop/Ajeesh_PhD/Codes/Nek5000/Nek5000-19.0/run/eddy_uv -I/home/user/Ajeesh_PhD/Codes/Nek5000/Nek5000-19.0/core -I./ -I /home/user/Ajeesh_PhD/Codes/Nek5000/Nek5000-19.0/core/experimental -o nek5000 /home/user/Ajeesh_PhD/Codes/Nek5000/Nek5000-19.0/core/drive.f /home/user/Desktop/Ajeesh_PhD/Codes/Nek5000/Nek5000-19.0/run/eddy_uv/eddy_uv.o libnek5000.a -L/home/user/Ajeesh_PhD/Codes/Nek5000/Nek5000-19.0/3rd_party/blasLapack -lblasLapack -L/home/user/Ajeesh_PhD/Codes/Nek5000/Nek5000-19.0/3rd_party/gslib/lib -lgs -Wl,--allow-multiple-definition

/usr/bin/ld: /usr/local/lib/libmpich.a(allreduce.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [makefile:133: nek5000] Error 1

Any help will be deeply appreciated.

Thank you in advance.

YuHsiang Lan

unread,
Mar 1, 2024, 11:07:51 AM3/1/24
to Nek5000
Hi,

Can you try to add those flags in makenek (Nek5000/bin/makenek)
  FFLAGS="-fPIE -fPIC"
  CFLAGS="-fPIE -fPIC"
and make a full clean with
  ~/Nek5000/bin/makenek clean
It will ask you whether recompile 3rd_party, type y and return

Hope this helps,
Yu-Hsiang
--

Stefan K.

unread,
Mar 1, 2024, 12:42:24 PM3/1/24
to Nek5000
It seems that your MPICH static lib was not built with -fPIC or -fPIE. This implies that it can only be used in non-PIE executables.
Please revert the changes you introduced and set in makenek:

USR_LFLAGS+=" -no-pie"

Then, just rerun makenek (make sure to clean). 

Hth,
Stefan

--
You received this message because you are subscribed to the Google Groups "Nek5000" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nek5000+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nek5000/dc503ffd-5573-4a04-9e2e-35eccc2e14a9n%40googlegroups.com.

Ajeesh Mohan T

unread,
Mar 4, 2024, 12:08:41 AM3/4/24
to Nek5000
Hi Yu-Hsiang and Stefan,

Sorry for the late reply, I was having some medical issues.

I tried the methods you suggested, after revoking all the changes I made. I have ensured cleaning in between each try.
Unfortunately, the error persists; also there is no information about these flags in the error.
I think the compiler is not detecting these flags when applied in this way.

I would be more than happy if you could share some more insights.

Thank you in advance,
Ajeesh

Ajeesh Mohan T

unread,
Mar 4, 2024, 12:46:33 AM3/4/24
to Nek5000
Hi all,

I tried implementing USR_LFLAGS+=" -no-pie" as suggested by Stefan, but in the core/makenek.inc file instead of bin/makenek.

I am happy to inform you that now the compilation is successful.

The core/makenek.inc file is being sourced in the nekconfig file which is being called from the makenek file.

Thank you Yu-Hsiang and Stefan, Thank you all for the help.

Regards,
Ajeesh

Stefan K.

unread,
Mar 4, 2024, 1:35:35 AM3/4/24
to Ajeesh Mohan T, Nek5000
You should never modify makenek.inc. Instead modify the makenek script. 

On 4 Mar 2024, at 06:46, Ajeesh Mohan T <tajees...@gmail.com> wrote:



Ajeesh Mohan T

unread,
Mar 4, 2024, 5:19:53 AM3/4/24
to Nek5000
Hi Stefan,

I tried placing the command in makenek script, at various locations; unfortunately, none of them worked.

As of now, the identified possible locations are either in the makenek.inc  or the nekconfig , before the config_nek command.

Thanks & Regards,
Ajeesh
Reply all
Reply to author
Forward
0 new messages