Community
Participate
Working Groups
Open /org.eclipse.swt/Eclipse SWT/common/library/callback.c Uncomment #define DEBUG_CALL_PRINTS cd org.eclipse.swt/bin/library make clean ; ./build.sh -gtk3 install ./build.sh clean Cairo found, compiling SWT support for the cairo graphics library. libjawt.so found, the SWT/AWT integration library will be compiled. Cleaning up... make[1]: Entering directory `/data/4x_platform_workspace/eclipse.platform.swt/bundles/org.eclipse.swt/bin/library' rm -f *.o *.so make[1]: Leaving directory `/data/4x_platform_workspace/eclipse.platform.swt/bundles/org.eclipse.swt/bin/library' Cairo found, compiling SWT support for the cairo graphics library. libjawt.so found, the SWT/AWT integration library will be compiled. Building SWT/GTK+ for Architectures: linux x86_64 Building GTK3 bindings: gcc -O -Wall -fPIC -DSWT_VERSION=4942r5 -DLINUX -DGTK -I/usr/lib/jvm/java-11/include -I/usr/lib/jvm/java-11/include/linux -DJNI64 -c swt.c gcc -O -Wall -fPIC -DSWT_VERSION=4942r5 -DLINUX -DGTK -I/usr/lib/jvm/java-11/include -I/usr/lib/jvm/java-11/include/linux -DJNI64 -c -o c.o c.c gcc -O -Wall -fPIC -DSWT_VERSION=4942r5 -DLINUX -DGTK -I/usr/lib/jvm/java-11/include -I/usr/lib/jvm/java-11/include/linux -DJNI64 -c -o c_stats.o c_stats.c gcc -O -Wall -fPIC -DSWT_VERSION=4942r5 -DLINUX -DGTK -I/usr/lib/jvm/java-11/include -I/usr/lib/jvm/java-11/include/linux -DJNI64 `pkg-config --cflags gtk+-3.0 gtk+-unix-print-3.0` -DUSE_ASSEMBLER -c callback.c callback.c: In function 'callback': callback.c:1252:3: error: 'for' loop initial declarations are only allowed in C99 mode for (int i=0; i<argCount; i++) { ^ callback.c:1252:3: note: use option -std=c99 or -std=gnu99 to compile your code make: *** [callback.o] Error 1 *** GTK3 Build failed, aborting further actions.. Note: adding -std=c99 to the build.sh makes the compiler happy, but the resulting SWT library crashes if trying to open native File dialog, see bug 569853 comment 13. So the reverse patch https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174052/1/bundles/org.eclipse.swt/Eclipse+SWT+PI/gtk/library/build.sh is not an option.
Instead of just reverting the patch, it would be nice to figure the cause of the crash. I really doubt that compiler is to be blamed, rather I expect that it shuffled something a bit and uncovered some problem in SWT. I could do that... next year, haha, once I'm back from vacation. However, it would be nice if someone does it earlier :)
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174056
The code is in C. So you need to define all the variables at the start of a code block. Defining i at the start of the block should suffice for this problem instead of using -std=c99 flag. Attaching a patch now. @Andrey Can you check the patch whether you are getting any compilation errors?
(In reply to Alexandr Miloslavskiy from comment #1) > Instead of just reverting the patch, it would be nice to figure the cause of > the crash. I have no real C knowledge to pinpoint some compiler issues, so fixing a build was priority #1 for me. (In reply to Eclipse Genie from comment #2) > New Gerrit change created: > https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174056 Sravan has the solution, and I would never in life assume this change can cause C compiler error :-) (In reply to Sravan Kumar Lakkimsetti from comment #3) > > Can you check the patch whether you are getting any compilation errors? Thanks Sravan, unbelievable, it works fine with this change... I'm happy we have Java for the rest of the code :-)
(In reply to Alexandr Miloslavskiy from comment #1) > Instead of just reverting the patch, it would be nice to figure the cause of > the crash. I really doubt that compiler is to be blamed, rather I expect > that it shuffled something a bit and uncovered some problem in SWT. I've created bug 569874 for the crash.
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174056 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=f28297111a1dcd2964b3ef277254259dcd6311a0
OK, I'll have a look later.
Resolving now
Verified in Eclipse SDK Version: 2021-03 (4.19) Build id: I20210105-1800 OS: Linux, v.5.4.0-59-generic, x86_64 / gtk 3.24.20 Java version: 11.0.9.1