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

Add RFC 102 text: Embedding resource files into libgdal #10913

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rouault
Copy link
Member

@rouault rouault commented Oct 1, 2024

@sgillies
Copy link
Contributor

sgillies commented Oct 1, 2024

@rouault I'm using CPLFindFile() to detect whether a GDAL install is inside a Python package: https://github.com/rasterio/rasterio/blob/df409de086efa437fef2b66b4e0d2e1e387fe474/rasterio/_env.pyx#L250. Could that function be updated to search in libgdal? Or should I depend on not using this option?

@rouault
Copy link
Member Author

rouault commented Oct 1, 2024

Could that function be updated to search in libgdal?

no, embedded resources are not easily discoverables as sub-files. That would involve complicated low-level compiler/OS-specific trick

Or should I depend on not using this option?

Well, the intent is that your GDAL builds for Rasterio/Fiona binary wheels do use the new CMake option EMBED_RESOURCE_FILES=ON, and probably also USE_ONLY_EMBEDDED_RESOURCE_FILES=ON, since it is unlikely users would want to tune the default resource files, and that you ultimately get rid of the use of CPLFindFile()

@rouault
Copy link
Member Author

rouault commented Oct 1, 2024

FYI @Maxxen w.r.t proj.db embedding

@eschnett
Copy link
Contributor

eschnett commented Oct 1, 2024

This feature could easily be implemented in Perl or Python with some makefile support, generating a C source file from a binary that can then be #included whenever #embed is not available.

We have been using this feature in the Einstein Toolkit for many years (hence Perl) in the Formaline thorn. This code does many other things as well; the actual code is in the makeblob.pl and makemetablob.pl Perl files in the src/util directory.

One important thing at the time (decades ago) was to ensure that the generated source files are not too large since certain compilers would run out of memory with large literal arrays. That may or may not be necessary any more.

@rouault
Copy link
Member Author

rouault commented Oct 1, 2024

This feature could easily be implemented in Perl or Python with some makefile support

yes, that's what I mention in the "alternatives" paragraph. But I don't want to implement both C23 #embed support, and older tricks. Too painful too maintain. Let's go to the future straight ahead.

One important thing at the time (decades ago) was to ensure that the generated source files are not too large since certain compilers would run out of memory with large literal arrays. That may or may not be necessary any more.

GCC 15dev #embed unoptimized implementation shows that's still a concern. CLang 19 #embed implementation uses collaboration between the pre-processor and later stages of the compilation to have time and RAM efficient embedding.

@jjimenezshaw
Copy link
Contributor

Is there going to be a similar option only in PROJ? (Without complling GDAL)

@rouault
Copy link
Member Author

rouault commented Oct 2, 2024

Is there going to be a similar option only in PROJ? (Without complling GDAL)

yes

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 this pull request may close these issues.

4 participants