Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile code to be relocatable. #261

Open
webisu opened this issue Nov 29, 2024 · 12 comments · May be fixed by #262
Open

Compile code to be relocatable. #261

webisu opened this issue Nov 29, 2024 · 12 comments · May be fixed by #262

Comments

@webisu
Copy link

webisu commented Nov 29, 2024

Compile with -fPIC to get relocatable code. Want to make a (relocatable) python library that uses iplib.

@AlexanderRichert-NOAA
Copy link
Contributor

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).

@webisu
Copy link
Author

webisu commented Dec 2, 2024 via email

@AlexanderRichert-NOAA
Copy link
Contributor

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.

@webisu
Copy link
Author

webisu commented Dec 2, 2024 via email

@AlexanderRichert-NOAA
Copy link
Contributor

To investigate further I'll need exact steps to reproduce the problem, please.

@webisu
Copy link
Author

webisu commented Dec 2, 2024 via email

@AlexanderRichert-NOAA
Copy link
Contributor

I don't see the cmake step-- are you using -DCMAKE_POSITION_INDEPENDENT_CODE=ON? i.e., cmake .. -DCMAKE_POSITION_INDEPENDENT_CODE=ON?

@webisu
Copy link
Author

webisu commented Dec 2, 2024 via email

@AlexanderRichert-NOAA
Copy link
Contributor

Correct, it'll require either explicit PIC with the above build option, or building the shared version.

@webisu
Copy link
Author

webisu commented Dec 3, 2024 via email

@AlexanderRichert-NOAA
Copy link
Contributor

I'd be open to changing the default if it doesn't have a significant impact on performance. In the case of, say, g2c, I would have expected that it would have the same issue. Which version of ip are you using, is this the head of develop?

@webisu
Copy link
Author

webisu commented Dec 4, 2024 via email

@AlexanderRichert-NOAA AlexanderRichert-NOAA linked a pull request Dec 4, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants