Run error when link pgc++ in compile process

Hi PGI team,
I try to compile one of package, aslam_backend in Kalibr, build target was successful
but when I execute the python script(kalibr_calibrate_imu_camera) calling aslam_backend library will cause run failed, below are error message:

importing libraries
Traceback (most recent call last):
File “/home/lawry/kalibr_ws/devel/bin/kalibr_calibrate_imu_camera”, line 15, in
exec(compile(fh.read(), python_script, ‘exec’), context)
File “/home/lawry/kalibr_ws/src/Kalibr/aslam_offline_calibration/kalibr/python/kalibr_calibrate_imu_camera”, line 4, in
import kalibr_common as kc
File “/home/lawry/kalibr_ws/devel/lib/python2.7/dist-packages/kalibr_common/init.py”, line 35, in
exec(__fh.read())
File “”, line 3, in
File “/home/lawry/kalibr_ws/src/Kalibr/aslam_offline_calibration/kalibr/python/kalibr_common/ConfigReader.py”, line 8, in
import aslam_cv_backend as cvb
File “/home/lawry/kalibr_ws/devel/lib/python2.7/dist-packages/aslam_cv_backend/init.py”, line 35, in
exec(__fh.read())
File “”, line 6, in
File “/home/lawry/kalibr_ws/devel/lib/python2.7/dist-packages/aslam_backend/init.py”, line 35, in
exec(__fh.read())
File “”, line 5, in
ImportError: /home/lawry/pgi/linux86-64-llvm/19.4/lib/liblapack.so.0: undefined symbol: __get_size_of

Why use pgc++ compiler will cause the python link to “liblapack.so.0”?
How to configure make file to avoid this run error?


Thanks!

Hi Lawry

Why use pgc++ compiler will cause the python link to “liblapack.so.0”?

The pgc++ compiler wouldn’t add the Lapack library by default. It must be being added as part of the application’s link when creating the shared object. Something like “-llapack” on the link line.

How to configure make file to avoid this run error?

The symbol “__get_size_of” is coming from the PGI Fortran runtime library since Lapack is written in Fortran. Most likely in addition to adding Lapack to the link line, you’ll need the PGI Fortran runtime libraries as well.

Are you using pgc++ to create the shared object? If so, add “-pgf90libs” and the Fortran runtime libs will be added.

If you’re linking with another tool, you need to add them to you link flags. To see a list of libraries that we would add, you can use the command “pgc++ -dryrun -pgf90libs x.o”, where “-dryrun” shows the command the compiler driver would execute without actually executing them. From that with 19.4, you’d add something like:

-L/local/usr/pgi/linux86-64-llvm/19.4/lib/ -lpgf90rtl -lpgf90 -lpgf90_rpm1 -lpgf902 -lpgf90rtl -lpgftnrtl -lpgatm -lpgkomp -lomp

Hope this helps,
Mat

Hi Mat,
Thank your for your help!

The error “undefined symbol: __get_size_of” was fixed, but pop up another error…
ImportError: /home/lawry/kalibr_ws/devel/lib/libaslam_backend.so: undefined symbol: __builtin_ia32_vperm2f128_pd256
Is that also relates to pgi’s library? Could you give some hint and hope it would not cause you too much trouble.

Regards,
Lawry

Hi Lawry,

I believe this is a GNU AVX builtin intrinsic that the code must be calling. While we support some of these GNU extensions, this isn’t one of them.

Can the code be compiled so it doesn’t use builtin intrinsics?

-Mat

Hi Mat,
Yes, code could be compiled, but how to add builtin intrinsic into the compile process?
I have added “-Mfprelaxed=intrinsic” in build flag but still run error.
I’m not family with the build tool on linux , can you provide solution on this because I would like to accelerate calculation time in Kalibr.

Thanks,
Lawry

but how to add builtin intrinsic into the compile process

The flag to enable builtin functions, “-Mbuiltin”, is enabled by default. The problem here is that we don’t support this particular GNU extension so can’t be used by your program. You’ll need to update the source code itself to work around this issue.