-
Notifications
You must be signed in to change notification settings - Fork 457
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
Fix support of posix_memalloc for Linux #648
Conversation
@@ -225,6 +225,8 @@ CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) | |||
include(TestLargeFiles) | |||
OPJ_TEST_LARGE_FILES(OPJ_HAVE_LARGEFILES) | |||
|
|||
set(CMAKE_REQUIRED_DEFINITIONS -D_POSIX_C_SOURCE=200112L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please set that only for minimal setup (only for posix_memalloc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a cmake expert. How can I set that definition only for the posix_memalloc test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use unset
when done
I updated the patch (and also fixed the commit message). |
Patch updated because of commit 38ffbbe. |
@stweil, |
@mayeut: It should be fixed now. The failure only occurred when building thirdparty code, too. |
Next iteration: Windows does not provide unistd.h. |
Ping? I think this request can be pulled. |
posix_memalign is only declared conditionally in stdlib.h, so add one of the possible definitions to get the declaration. Signed-off-by: Stefan Weil <sw@weilnetz.de>
@stweil seems that reverting the fix for tiff broke the build. Can you merge the new master branch in to check that all tests are OK ? |
@mayeut, obviously the rebased patch passes all checks. |
That's really bad, the official reference is actually missing from http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_memalign.html. Is the Linux implementation a bit too restrictive ? |
I am ready to merge thie PR until I understand the comment about |
fseeko, ftello have the same requirements as posix_memalign to get declared. In the current git master, the compiler complains about missing declarations for those functions. The patch fixes that problem, too. |
@stweil that is stlighty incorrect. |
On my 64 bit Debian GNU Linux, _FILE_OFFSET_BITS is not set (in src/lib/openjp2/opj_config_private.h). Therefore I get these compiler messages:
Extract from the man page of fseeko:
So defining one of _FILE_OFFSET_BITS, _POSIX_C_SOURCE or _XOPEN_SOURCE fixes the compiler warnings. Maybe _FILE_OFFSET_BITS is set on 32 bit Linux. Then the definition of _POSIX_C_SOURCE is not needed for fseeko, but it won't harm. |
Fix support of posix_memalloc for Linux
@stweil Thanks. Merged. |
posix_memalloc is only declared conditionally in stdlib.h,
so add one of the possible definitions to get the declaration.
Signed-off-by: Stefan Weil sw@weilnetz.de