Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 194158 - Compilation of dev-java/java-gnome-4.0.4 fails - unrecognized command line option "-Wno-int-to-pointer-cast"
Summary: Compilation of dev-java/java-gnome-4.0.4 fails - unrecognized command line op...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
: 224707 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-09-29 02:32 UTC by onox
Modified: 2011-01-19 03:30 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description onox 2007-09-29 02:32:57 UTC
Cannot compile dev-java/java-gnome-4.0.4 because gcc complains about unrecognized commandline option. The same thing happened with 4.0.3.

JAVA    BindingsGenerator
JAVAC   src/bindings/*.java, generated/bindings/*.java
CP      tmp/bindings/typeMapping.properties
JAR     tmp/gtk-4.0.jar
JAVAH   tmp/include/*.h
MKDIR   tmp/objects/org/gnome/glib
GCC     src/bindings/org/gnome/glib/GObject.c
cc1: error: unrecognized command line option "-Wno-int-to-pointer-cast"
cc1: error: unrecognized command line option "-Wno-pointer-to-int-cast"
make: *** [build-java] Error 1
 * 
 * ERROR: dev-java/java-gnome-4.0.4 failed.
 * Call stack:
 *   ebuild.sh, line 1654:   Called dyn_compile
 *   ebuild.sh, line 990:   Called qa_call 'src_compile'
 *   ebuild.sh, line 44:   Called src_compile
 *   java-gnome-4.0.4.ebuild, line 35:   Called die
 * 
 * Compilation of java-gnome failed
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/tmp/portage/dev-java/java-gnome-4.0.4/temp/build.log'.
 * 
!!! When you file a bug report, please include the following information:
GENTOO_VM=sun-jdk-1.5  CLASSPATH="" JAVA_HOME="/opt/sun-jdk-1.5.0.12"
JAVACFLAGS="-source 1.4 -target 1.4" COMPILER=""
and of course, the output of emerge --info

Portage 2.1.3.9 (hardened/x86/2.6, gcc-3.4.6, glibc-2.3.6-r5, 2.6.22-hardened-r6 i686)
=================================================================
System uname: 2.6.22-hardened-r6 i686 Intel(R) Pentium(R) M processor 1600MHz
Timestamp of tree: Sat, 29 Sep 2007 01:50:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p15-r1
dev-java/java-config: 1.3.7, 2.0.33-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 2.0.0_rc4-r1
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.14
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.22-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-mtune=i686 -O2 -pipe -fforce-addr -msse2"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-mtune=i686 -O2 -pipe -fforce-addr -msse2"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache collision-detect distlocks metadata-transfer parallel-fetch sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox"

Reproducible: Always
Comment 1 Petteri Räty (RETIRED) gentoo-dev 2007-09-29 16:46:16 UTC
(In reply to comment #0)
> MKDIR   tmp/objects/org/gnome/glib
> GCC     src/bindings/org/gnome/glib/GObject.c
> cc1: error: unrecognized command line option "-Wno-int-to-pointer-cast"
> cc1: error: unrecognized command line option "-Wno-pointer-to-int-cast"
> make: *** [build-java] Error 1
>  * 

I guess java-gnome needs >=gcc-4.0 so we might need to package.mask this in the hardened profiles or something. toolchain please advice
Comment 2 Kevin F. Quinn (RETIRED) gentoo-dev 2007-09-29 22:10:26 UTC
`-Wno-int-to-pointer-cast (C only)'
     Suppress warnings from casts to pointer type of an integer of a
     different size.

`-Wno-pointer-to-int-cast (C only)'
     Suppress warnings from casts from a pointer to an integer type of a
     different size.

I can't see how it's beneficial to suppress these warnings (I'm guessing they hide warnings about 32-bit code that'll fail when built for 64-bit for example), but that aside you could just strip those flags from the java-gnome build as all it'll do is cause the warnings to be issued during the build - removing these flags won't affect code generation.

The only way these options might make a difference to whether the build succeeds or not, is if the build also specifies -Werror.

It might be useful to ask upstream why they have set these flags.
Comment 3 Andrew Cowie 2007-10-24 07:59:33 UTC
Hi,

The flags are set because, as ever, GCC warnings are to advise of behaviour that is probably wrong unless you're doing in on purpose and know what you're doing. We're doing it on purpose and know why we did it.

[It's not that the code would failure on 64 bit, by the way. It's fine there. The situation the warning traps, however, is casting Java longs (which are 64-bit [safe]) to pointers on a 32-bit machine. The warnings are disabled because the code performs as expected & intended on both Linux and Solaris]

If you remove those flags you'll get about 4 zillion warnings during build output. That's not very helpful either to develoers, hackers, or packagers, so I don't anyone in the java-gnome community will be interested in supporting GCC 3.x but hey, it's Open Source. You never know. [If someone wants to contact my company because they need support for a peculiar custom environment they are welcome to do so].

To be honest, the bug here is that hardened doesn't have >=gcc-4. What's up with that? (/me knows nothing about hardened, sorry).

AfC
Comment 4 onox 2007-10-24 13:43:18 UTC
The reason is that the toolchain needs to be modified to support PIE and SSP. SSP needs to be backported to gcc-4.x. Package manager says:

# Mask off gcc-4 for all hardened arches until SSP is sorted out (i.e.
# backport for gcc-4.0 and 4.0/4.1 rigged for SSP support in the C
# library).  After that, may still need to be masked on x86 as some
# PIC assembler that worked pre-4 fails post-4, e.g. bug #104966).

See http://www.gentoo.org/proj/en/hardened/hardened-toolchain.xml
Comment 5 Kevin F. Quinn (RETIRED) gentoo-dev 2007-10-24 21:32:55 UTC
If you have "4 zillion warnings" how can you possibly be sure that all occurrences are indeed functioning correctly?  Sounds like wishful thinking to me.  Far better, surely, to fix the code so that you don't use integer types to store pointers.  In C the correct way to store untyped pointers is to use 'void *', which is always guaranteed to be correct.  What you're really doing by setting the flag is hiding the fact that you're using the wrong type in the first place.

Anyway, the simplest way to deal with this issue is simply for the ebuild to edit out use of those flags from the custom perl configure script when the system compiler doesn't support them - a simple sed operation, conditional on whether the flags are supported or not:

inherit flag-o-matic
...
# Strip flags from custom configure script when not supported by the
# system compiler - these flags are only valid from gcc-4.1 onwards.
test-flag-CC "-Wno-pointer-to-int-cast" &&
    sed -i -e 's/-Wno-int-to-pointer-cast//' \
           -e 's/-Wno-pointer-to-int-cast//' \
        ${S}/configure

Untested, as I don't use Gnome, but the idea is surely clear enough - check before deploying!

BTW, the reason hardened doesn't have >=gcc-4 in the tree is really down to lack of resource - it's ready in overlay just hasn't been merged yet by the toolchain maintainer.
Comment 6 Andrew Cowie 2007-10-24 22:44:33 UTC
(In reply to comment #5)
> If you have "4 zillion warnings" how can you possibly be sure that all
> occurrences are indeed functioning correctly?

Because they all arise from *exactly* the same situation, and that situation has been vetted: casting (void*) [as it is in C] to (jlong) [as we store it opaquely in Java], and vice versa.

As this has been well tested on different distributions, validated across multiple architectures, and reviewed by several GCC hackers who contribute to the upstream project, I think we'll just carry on.

> store pointers.  In C the correct way to store untyped pointers

We're not storing them in C. It's just casting as we cross the JNI boundary. *ALL* the information originates from, and is used, C side; we just happen to store some bits in Java.

> I don't use GNOME

Nice.

> the reason hardened doesn't have >=gcc-4 in the tree is really down to
> lack of resource - it's ready in overlay

Then instead of messing further with the ebuild, it would seem that the right resolution is to make this bug depend on whichever bug is open pending hardened merging their GCC 4 code to the Portage tree.

AfC
Comment 7 Kevin F. Quinn (RETIRED) gentoo-dev 2007-11-01 22:11:02 UTC
If the system compiler is gcc-3, it's trivial for the ebuild to filter out the gcc-4-only flags from the custom configure script - I fail to see why that's so bad (or indeed why you're objecting to that, Andrew - I'm talking about modifying the Gentoo ebuild, not asking you to modify your code).
Comment 8 Mark Loeser (RETIRED) gentoo-dev 2008-04-01 02:28:49 UTC
I don't see how gcc-porting can help in this situation...
Comment 9 Serkan Kaba (RETIRED) gentoo-dev 2008-12-21 20:04:48 UTC
*** Bug 224707 has been marked as a duplicate of this bug. ***
Comment 10 Miroslav Šulc gentoo-dev 2011-01-19 03:30:14 UTC
not in tree anymore