On Thu, 26 Nov 2020 19:32:28 GMT, John Neffenger 
<github.com+1413266+jgn...@openjdk.org> wrote:

>> I don't see any harm in this PR, but I wonder which toolchains are still not 
>> having `RTLD_NEXT` without specifying GNU_SOURCE.  Does it also work if you 
>> specify `-D__USE_GNU` to the compiler?
>
>> I don't see any harm in this PR, but I wonder which toolchains are still not 
>> having `RTLD_NEXT` without specifying GNU_SOURCE.
> 
> Thanks, Johan. I've been following the instructions in the [OpenJFX Wiki][1]. 
> I use the GCC cross-compiler installed by the repository's 
> [crosslibs-armv6hf.sh][2] script. Then I build for ARM using the repository's 
> [armv6hf.gradle][3] build file.
> 
>> Does it also work if you specify `-D__USE_GNU` to the compiler?
> 
> No, that prints the same error. The comments in the header file 
> `/usr/include/features.h` suggest that the macro `__USE_GNU` is for internal 
> use, while `_GNU_SOURCE` is defined by the user. I tried the user macro, and 
> it works!
> 
> So below is an alternative fix in the ARM build file:
> 
> diff --git a/buildSrc/armv6hf.gradle b/buildSrc/armv6hf.gradle
> index 05e3e83551..bd56dcf86c 100644
> --- a/buildSrc/armv6hf.gradle
> +++ b/buildSrc/armv6hf.gradle
> @@ -140,7 +140,7 @@ def iioCFlags = [extraCFlags,
>           ].flatten()
>  def iioLFlags = [extraLFlags].flatten()
> 
> -def es2EglfbCFlags = [extraCFlags, "-DIS_EGLFB", "-DLINUX"].flatten()
> +def es2EglfbCFlags = [extraCFlags, "-DIS_EGLFB", "-DLINUX", 
> "-D_GNU_SOURCE"].flatten()
>  def es2EglfbLFlags = [extraLFlags].flatten()
>  def es2MonocleCFlags = [extraCFlags, "-DIS_EGLFB", "-DLINUX"].flatten()
>  def es2MonocleLFlags = [extraLFlags].flatten()
> 
> It seems the [`_GNU_SOURCE` macro does a lot][4], so it's a question of 
> limiting its use to one C file or enabling it for the entire 
> `prism_es2_monocle` library. I'm fine with either solution.
> 
> [1]: 
> https://wiki.openjdk.java.net/display/OpenJFX/Cross+Building+for+ARM+Hard+Float
> [2]: 
> https://github.com/openjdk/jfx/blob/master/buildSrc/crosslibs/crosslibs-armv6hf.sh
> [3]: https://github.com/openjdk/jfx/blob/master/buildSrc/armv6hf.gradle
> [4]: https://stackoverflow.com/q/5582211

I think it is safer to use it as a flag for all monocle-es2 compilation then. 
It is also less intrusive as it doesn't require code changes, so it only 
affects specific builds.

-------------

PR: https://git.openjdk.java.net/jfx/pull/350

Reply via email to