RFR: 8256012: Fix build of Monocle for Linux [v3]
John Neffenger
github.com+1413266+jgneff at openjdk.java.net
Fri Dec 11 20:48:11 UTC 2020
> This pull request fixes the error when building embedded JavaFX for Linux.
>
> The error occurs because `MonocleGLFactory.c` does not define the macro `__USE_GNU` before including the header file `dlfcn.h`. The two lines in the conditional group "`#ifndef ANDROID`" below have no effect because the header file has already been included at that point, and the header contains include guards to ignore subsequent attempts.
>
> MonocleGLFactory.c
> ...
> #include <EGL/egl.h>
> #include "eglUtils.h"
>
> #include "../PrismES2Defs.h"
>
> #include "com_sun_prism_es2_MonocleGLContext.h"
> #ifndef ANDROID
> #define __USE_GNU
> #include <dlfcn.h>
> #endif
> ...
>
> The `-H` option of `gcc` prints the name of each header file used. Its output shows that `egl.h` ends up including `dlfcn.h` indirectly, but without the required macro definition.
>
> $ grep -e 'EGL/egl.h' -e 'eglUtils.h' -e 'dlfcn.h' headers.log
> . opt/vc/include/EGL/egl.h
> ...... usr/include/dlfcn.h
> ....... usr/include/arm-linux-gnueabihf/bits/dlfcn.h
> . monocle/eglUtils.h
>
> For the proposed fix, I referred to the page of the *Linux Programmer's Manual* at "`man dlsym`" which states, "The `_GNU_SOURCE` feature test macro must be defined in order to obtain the definitions of `RTLD_DEFAULT` and `RTLD_NEXT` from `<dlfcn.h>`." I also used information in the following two Stack Overflow conversations:
>
> * ['RTLD_NEXT' undeclared][1]
> * [_GNU_SOURCE and __USE_GNU][2]
>
> [1]: https://stackoverflow.com/q/1777397
> [2]: https://stackoverflow.com/q/7296963
John Neffenger has updated the pull request incrementally with one additional commit since the last revision:
Move fix to the ARM build file instead of the code
-------------
Changes:
- all: https://git.openjdk.java.net/jfx/pull/350/files
- new: https://git.openjdk.java.net/jfx/pull/350/files/d3a8f0d0..2d044e75
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jfx&pr=350&range=02
- incr: https://webrevs.openjdk.java.net/?repo=jfx&pr=350&range=01-02
Stats: 10 lines in 2 files changed: 6 ins; 3 del; 1 mod
Patch: https://git.openjdk.java.net/jfx/pull/350.diff
Fetch: git fetch https://git.openjdk.java.net/jfx pull/350/head:pull/350
PR: https://git.openjdk.java.net/jfx/pull/350
More information about the openjfx-dev
mailing list