Open webisu opened 3 days ago
Do you need this through spack-stack? If you just need it for your own development copy of ip, then building with -DCMAKE_POSITION_INDEPENDENT_CODE=ON
should do the trick (I assume you're compiling a static library).
The goal is to make python call libwgrib2.so (import pywgrib2_s). This means that libraries that wgrib2 calls will have to be compiled with -fPIC.
On Fri, Nov 29, 2024 at 6:07 PM Alex Richert @.***> wrote:
Do you need this through spack-stack? If you just need it for your own development copy of ip, then building with -DCMAKE_POSITION_INDEPENDENT_CODE=ON should do the trick (I assume you're compiling a static library).
— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/NCEPLIBS-ip/issues/261#issuecomment-2508724624, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZV2W4JUEMQLILZM7MT2DDXR5AVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBYG4ZDINRSGQ . You are receiving this because you authored the thread.Message ID: @.***>
Have you already tried -DCMAKE_POSITION_INDEPENDENT_CODE=ON
for wgrib2? If that doesn't work then that's probably a cmake bug for wgrib2.
I got all the netcdf, hdf5, g2c, png, jasper, openjpeg, aec libraries to work. IP was the only exception. I can make wgrib2 when I turned off MAKE_SHARED_LIB in wgrib2.
On Mon, Dec 2, 2024 at 1:59 PM Alex Richert @.***> wrote:
Have you already tried -DCMAKE_POSITION_INDEPENDENT_CODE=ON for wgrib2? If that doesn't work then that's probably a cmake bug for wgrib2.
— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/NCEPLIBS-ip/issues/261#issuecomment-2512464147, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZX4SS4FRHSDGGJ7EPL2DSUYBAVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJSGQ3DIMJUG4 . You are receiving this because you authored the thread.Message ID: @.***>
To investigate further I'll need exact steps to reproduce the problem, please.
How I tell whether .a is relocatable: $ ar x libip_4.a $ gcc -shared -o libtest.so .o Complaints about -fPIC.
I built ip by: git clone "https://github.com/NOAA-EMC/NCEPLIBS-ip" cd NCEPLIB-ip edit CMakeLists.txt change option(OPENMP "Use OpenMP threading" OFF) to option(OPENMP "Use OpenMP threading" ON) mkdir build cd build make sudo make install
On Mon, Dec 2, 2024 at 2:56 PM Alex Richert @.***> wrote:
To investigate further I'll need exact steps to reproduce the problem, please.
— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/NCEPLIBS-ip/issues/261#issuecomment-2512642404, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZUY6JOKWLW6EXOSSN32DS3M5AVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJSGY2DENBQGQ . You are receiving this because you authored the thread.Message ID: @.***>
I don't see the cmake step-- are you using -DCMAKE_POSITION_INDEPENDENT_CODE=ON
? i.e., cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
?
No. So I have to make a non-default version of IP.
On Mon, Dec 2, 2024 at 3:54 PM Alex Richert @.***> wrote:
I don't see the cmake step-- are you using -DCMAKE_POSITION_INDEPENDENT_CODE=ON? i.e., cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON?
— Reply to this email directly, view it on GitHub https://github.com/NOAA-EMC/NCEPLIBS-ip/issues/261#issuecomment-2512808515, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIB7ZQFLYY6ITPJBK4P6ML2DTCJ5AVCNFSM6AAAAABSX2MFM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMJSHAYDQNJRGU . You are receiving this because you authored the thread.Message ID: @.***>
Correct, it'll require either explicit PIC with the above build option, or building the shared version.
Compile with -fPIC to get relocatable code. Want to make a (relocatable) python library that uses iplib.