ylikx / forpy

Forpy - use Python from Fortran

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ifort linking error on linux machine

lkampoli opened this issue · comments

Dear Elias,
thanks for your valuable and useful project!

I would like to use forpy in my code in order to use some machine learning algorithm. My code is compiled with ifort.
So, while compiling and linking forpy with gfortran is ok, when I try with ifort it is a bit more problematic and I cannot successfully link it. I tried to disable lto also in ifort with -fno-fat-lto-objects but I still get an error:

In particular when I run:

ifort intro_to_forpy.F90 forpy_mod.o python3-config --ldflags

ld: /home/lk/intel/oneapi/intelpython/python3.7/lib/python3.7/config-3.7m-x86_64-linux-gnu/libpython3.7m.a(posixmodule.o): in function os_forkpty': (.text.unlikely+0x2307): undefined reference to forkpty'
ld: /home/lk/intel/oneapi/intelpython/python3.7/lib/python3.7/config-3.7m-x86_64-linux-gnu/libpython3.7m.a(posixmodule.o): in function os_openpty': (.text.unlikely+0x25e2): undefined reference to openpty'

Have you encountered such issue?

Thank you,
Lorenzo

Hi,

It seems that you are trying to link with the libraries of the Intel Python distribution. I don't have experience with that, but according to https://stackoverflow.com/questions/4491350/undefined-reference-to-forkpty
you need to link against libutil (option -lutil)