Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 857528 - dev-java/jna-5.11.0 fails to build: error: ‘alloca’ bound is unknown
Summary: dev-java/jna-5.11.0 fails to build: error: ‘alloca’ bound is unknown
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: werror
  Show dependency tree
 
Reported: 2022-07-10 21:26 UTC by Jonathan Lovelace
Modified: 2023-01-14 00:26 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
dev-java:jna-5.11.0:20220710-210803.log (dev-java:jna-5.11.0:20220710-210803.log,11.82 KB, text/x-log)
2022-07-10 21:26 UTC, Jonathan Lovelace
Details
emerge-info.txt (emerge-info.txt,8.83 KB, text/plain)
2022-07-10 21:27 UTC, Jonathan Lovelace
Details
patch based on the suggestion by Jonathan Lovelace (jna-gcc10.patch,342 bytes, patch)
2022-09-15 13:21 UTC, ilovekiruna
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Lovelace 2022-07-10 21:26:29 UTC
Created attachment 790934 [details]
dev-java:jna-5.11.0:20220710-210803.log

=dev-java/jna-5.11.0 (and also 5.10.0) fails to build. The relevant snippet from the build log is as follows:

native:                                                
     [exec] x86_64-pc-linux-gnu-gcc -O2 -pipe -march=core2 -mtune=generic -fno-unwind-tables -fno-asynchronous
-unwind-tables -fomit-frame-pointer -Wall -Wno-unused -Wno-parentheses -fPIC  -O2 -fno-omit-frame-pointer -fno
-strict-aliasing  -D_REENTRANT -DHAVE_PROTECTION -I"/usr/lib64/icedtea8/jre/../include" -I"/usr/lib64/icedtea8/jre/../include/linux" -I"/var/tmp/portage/dev-java/jna-5.11.0/work/jna-5.11.0/build/headers" -I/include -DJNA
_JNI_VERSION='"6.1.3"' -DCHECKSUM='"147a998f0cbc89681a1ae6c0dd121629"' -I/usr/lib64/libffi/include  -Wno-unkno
wn-warning-option -Werror -Wno-clobbered -Wno-unused-variable -c dispatch.c -o /var/tmp/portage/dev-java/jna-5
.11.0/work/jna-5.11.0/build/native-linux-x86-64/dispatch.o  
     [exec] In file included from dispatch.h:33,                                                                   [exec]                  from dispatch.c:30:
     [exec] dispatch.c: In function ‘dispatch_direct’:
     [exec] dispatch.c:1795:23: error: ‘alloca’ bound is unknown [-Werror=alloca-larger-than=]
     [exec]  1795 |             args[i] = alloca(data->cif.arg_types[i]->size);
     [exec]       |                       ^~~~~~
     [exec] dispatch.c:1821:23: error: ‘alloca’ bound is unknown [-Werror=alloca-larger-than=]
     [exec]  1821 |             args[i] = alloca(data->cif.arg_types[i]->size);
     [exec]       |                       ^~~~~~
     [exec] dispatch.c: At top level:
     [exec] cc1: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended t
o silence earlier diagnostics
     [exec] cc1: all warnings being treated as errors
     [exec] distcc[557] ERROR: compile dispatch.c on localhost failed
     [exec] make: *** [Makefile:463: /var/tmp/portage/dev-java/jna-5.11.0/work/jna-5.11.0/build/native-linux-x
86-64/dispatch.o] Error 1

BUILD FAILED
/var/tmp/portage/dev-java/jna-5.11.0/work/jna-5.11.0/build.xml:791: exec returned: 2

I found https://stackoverflow.com/a/68865783, which claims that in version 5.5.0 this is/was caused by the use of -Werror in the Makefile and the new alloca warning in GCC 10, and that this should be fixed in 5.6.0. My reading of the Makefile suggests that the logic to turn off this warning in $LOC_CC_OPTS isn't working properly, perhaps because it's testing for GCC by testing whether $CC exactly equals "gcc", and when I used sed in post_src_prepare() in /etc/portage/env to add -Wno-alloca-larger-than to the "non-GCC" case, the build succeeded.
Comment 1 Jonathan Lovelace 2022-07-10 21:27:05 UTC
Created attachment 790937 [details]
emerge-info.txt
Comment 2 ilovekiruna 2022-08-11 10:46:01 UTC
There seems to be an upstream bug for compilation with GCC-10 (https://github.com/java-native-access/jna/issues/1244). Upstream already released a patch (https://github.com/java-native-access/jna/pull/1245).
Comment 3 ilovekiruna 2022-09-15 13:21:36 UTC
Created attachment 805348 [details, diff]
patch based on the suggestion by Jonathan Lovelace
Comment 4 Kristian Duus Østergaard 2023-01-14 00:26:16 UTC
(In reply to ilovekiruna from comment #3)
> Created attachment 805348 [details, diff] [details, diff]
> patch based on the suggestion by Jonathan Lovelace

The patch works