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

Rationale for having the PROJ_LIB compile time string tested last #2399

Closed
Matioupi opened this issue Oct 28, 2020 · 6 comments
Closed

Rationale for having the PROJ_LIB compile time string tested last #2399

Matioupi opened this issue Oct 28, 2020 · 6 comments

Comments

@Matioupi
Copy link

Hello,
I've seen a few issues about the PROJ lib environment variable / compilte time variable, I hope it's not a duplicate.

is there a rationale (that I missed) for having the PROJ_LIB compile time preprocessor variable tested at the very end of the sequence of default path search ?

#ifdef PROJ_LIB

I would personnaly prefer to give priority to the library hard-coded value if there is one defined at compile time.
If I understand current implementation (and observed behaviour), it's the opposite : the hardcoded internal path is tested in very last position and actually skipped if a PROJ_LIB environment variable is present.

What about adding a compile time switch to either build a proj lib with priority to compile time hard-coded value, or use the current implementation ?

@rouault
Copy link
Member

rouault commented Oct 28, 2020

I'm afraid people will never agree on the order into which things are tested. A rationale for PROJ_LIB env var having precedence on the compile time hardcoded value is that sometimes installation is moved away from its installation prefix (like Conda-based installs I believe)

@Matioupi
Copy link
Author

I agree this will probably never reach a consensus. That's why I was proposing (and can do a PR for this) a compile time switch to propose both behaviour :

When building the lib targetting a system wide installation (usually unix environment philosphy) , then I agree that the PROJ_LIB env var priority is better, but when building the lib in order to integrate it as a part of a specific piece of software (as many MS Windows software do), I would prefer that a later install of another software using PROJ do not interfer with my software (e.g. when installing OSGEO4W the variable get set and this can mess up other instances of the dll) And this is a real world scenario that I actually faced.

@jmckenna
Copy link
Contributor

jmckenna commented Oct 28, 2020

Agreed @Matioupi in fact I recently mentioned a similar issue on the gdal-dev list when testing GDAL 3.1.4 release candidate (with PROJ-master) on Windows. +1

@rouault
Copy link
Member

rouault commented Dec 2, 2020

#2476 is an attempt at addressing this issue. Please check that it works as intended

@Matioupi
Copy link
Author

Matioupi commented Dec 2, 2020

I will test that, thanks !

@rouault
Copy link
Member

rouault commented Jan 6, 2021

@Matioupi any feedback on PR #2476 ?

@kbevers kbevers closed this as completed in 9488b26 Feb 7, 2021
kbevers added a commit that referenced this issue Feb 7, 2021
Add build time option to make PROJ_LIB env var tested last (fixes #2399)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants