openjpeg
openjpeg copied to clipboard
getenv is not allowed in certain cases causing linking issues.
getenv is not allowed in certain cases causing linking issues. This fix should be pushed to the openjpeg group. Thanks to Chris for the fix.
Patch is at:
- http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=f8d299c;hp=8e8831a02f172490d7b175e54c7d15814acacea4
Can you give more details why getenv() would cause issues ? This is conformant with C89
Well the original statement was about a specific linking issue. I am guessing this is some kind of hardened libc implementation. I could not find a specific one line reproducer, but basically you cannot use getenv safely from a multithreaded application, see for instance first link in google: http://www.club.cc.cmu.edu/~cmccabe/blog_the_setenv_fiasco.html
Before this gets into an infinite thread (bad pun intended), I understand that the root issue is the call to setenv
, while openjpeg library makes no such call, the application level could make one such call.
getenv() is not available when targetting Universal Windows Platform.
https://docs.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps
@Tryum Would the suggested fix at http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=f8d299c;hp=8e8831a02f172490d7b175e54c7d15814acacea4 work for UWP ? If not, can you propose something ?
I think it would fix it, I just wrote a similar patch to use openjpeg through vcpkg ( Microsoft/vcpkg#208 )
@Tryum Just add a look at https://github.com/Microsoft/vcpkg/pull/208 and can't see how it relates to getenv.
Anyone please submit a pull request
The issue I linked doesn't relate to getenv, just to openjpeg. I'm using openjpeg through vcpkg. I'll send a pull request of my fix once I'm sure I fixed my UWP issue.
@Tryum any update ?
Not working on that subject nor the company anymore... I can't remember how it was finally solved. Sorry.
Quick google search reveal:
- https://gitlab.freedesktop.org/gstreamer/cerbero/-/blob/1c7f523a649753351293510d6711647374f62e0c/recipes/orc/0001-orc-Implement-a-windows-helper-for-getenv.patch
Who has access to UWP to test a patch ?