Bug 269034 - java/eclipse: fix build with clang 15
Summary: java/eclipse: fix build with clang 15
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Rene Ladan
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2023-01-18 20:18 UTC by Dimitry Andric
Modified: 2023-01-22 19:47 UTC (History)
2 users (show)

See Also:
jonc: maintainer-feedback+


Attachments
java/eclipse: fix build with clang 15 (5.30 KB, patch)
2023-01-18 20:19 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-01-18 20:18:58 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that java/eclipse failed to build with clang 15:

  [INFO]      [exec] Building GTK3 bindings:
  [INFO]      [exec] gmake[1]: Entering directory '/wrkdirs/usr/ports/java/eclipse/work/eclipse.platform.releng.aggregator-R4_24/eclipse.platform.swt.binaries/bundles/org.eclipse.swt.gtk.freebsd.amd64/tmpdir'
  ...
  [INFO]      [exec] cc -O -Wall -fPIC -DSWT_VERSION=4952r11    -DFREEBSD -DGTK -I`pkg-config --variable=prefix gtk+-3.0`/include -I/usr/local/openjdk11/include -I/usr/local/openjdk11/include/freebsd -DJNI64 -m64 -Werror `pkg-config --cflags gtk+-3.0 gtk+-unix-print-3.0` -c os.c
  [INFO]      [exec] os.c:10086:31: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
  [INFO]      [exec]         rc = (jint)((jint (*)())arg0)(arg1, arg2, arg3);
  [INFO]      [exec]                                      ^
  [INFO]      [exec] os.c:10098:31: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
  [INFO]      [exec]         rc = (jint)((jint (*)())arg0)(arg1, arg2);
  [INFO]      [exec]                                      ^
  [INFO]      [exec] os.c:10704:33: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
  [INFO]      [exec]         rc = (jlong)((jlong (*)())arg0)(arg1, arg2, arg3, arg4);
  [INFO]      [exec]                                        ^
  [INFO]      [exec] os.c:10716:33: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
  [INFO]      [exec]         rc = (jlong)((jlong (*)())arg0)(arg1, arg2, arg3, arg4, arg5, arg6);
  [INFO]      [exec]                                        ^
  [INFO]      [exec] os.c:10728:33: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
  [INFO]      [exec]         rc = (jlong)((jlong (*)())arg0)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
  [INFO]      [exec]                                        ^

These -Werror warnings are in code generated by JNIGenerator, so they cannot directly be fixed (at least not without hacking on JNIGenerator itself).

Instead we need to add -Wno-deprecated-non-prototype for clang 15 and higher. To achieve this, we have to pass CFLAGS to MAVEN_ENV, and adjust the gtk build.sh script to respect the CFLAGS setting in the environment.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-01-18 20:19:20 UTC
Created attachment 239563 [details]
java/eclipse: fix build with clang 15
Comment 2 Jonathan Chen 2023-01-22 00:54:35 UTC
The patch looks good.
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-01-22 18:58:50 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=55820d3f162a65b9d284f1a5541965733c415a36

commit 55820d3f162a65b9d284f1a5541965733c415a36
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-01-18 20:11:36 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-01-22 18:58:23 +0000

    java/eclipse: fix build with clang 15

    During an exp-run for llvm 15 (see bug 265425), it turned out that
    java/eclipse failed to build with clang 15:

      [INFO]      [exec] Building GTK3 bindings:
      [INFO]      [exec] gmake[1]: Entering directory '/wrkdirs/usr/ports/java/eclipse/work/eclipse.platform.releng.aggregator-R4_24/eclipse.platform.swt.binaries/bundles/org.eclipse.swt.gtk.freebsd.amd64/tmpdir'
      ...
      [INFO]      [exec] cc -O -Wall -fPIC -DSWT_VERSION=4952r11    -DFREEBSD -DGTK -I`pkg-config --variable=prefix gtk+-3.0`/include -I/usr/local/openjdk11/include -I/usr/local/openjdk11/include/freebsd -DJNI64 -m64 -Werror `pkg-config --cflags gtk+-3.0 gtk+-unix-print-3.0` -c os.c
      [INFO]      [exec] os.c:10086:31: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
      [INFO]      [exec]         rc = (jint)((jint (*)())arg0)(arg1, arg2, arg3);
      [INFO]      [exec]                                      ^
      [INFO]      [exec] os.c:10098:31: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
      [INFO]      [exec]         rc = (jint)((jint (*)())arg0)(arg1, arg2);
      [INFO]      [exec]                                      ^
      [INFO]      [exec] os.c:10704:33: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
      [INFO]      [exec]         rc = (jlong)((jlong (*)())arg0)(arg1, arg2, arg3, arg4);
      [INFO]      [exec]                                        ^
      [INFO]      [exec] os.c:10716:33: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
      [INFO]      [exec]         rc = (jlong)((jlong (*)())arg0)(arg1, arg2, arg3, arg4, arg5, arg6);
      [INFO]      [exec]                                        ^
      [INFO]      [exec] os.c:10728:33: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
      [INFO]      [exec]         rc = (jlong)((jlong (*)())arg0)(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
      [INFO]      [exec]                                        ^

    These -Werror warnings are in code generated by JNIGenerator, so they
    cannot directly be fixed (at least not without hacking on JNIGenerator
    itself).

    Instead we need to add -Wno-deprecated-non-prototype for clang 15 and
    higher. To achieve this, we have to pass CFLAGS to MAVEN_ENV, and adjust
    the gtk build.sh script to respect the CFLAGS setting in the
    environment.

    PR:             269034
    Approved by:    jonc@chen.org.nz (maintainer)
    MFH:            2023Q1

 java/eclipse/Makefile                         | 10 ++++++++--
 java/eclipse/files/patch-eclipse.platform.swt |  7 +++++--
 2 files changed, 13 insertions(+), 4 deletions(-)