Bug 713709

Summary: gcj for 32 bits on x86_64 searches zlib.so at a wrong location
Product: [Fedora] Fedora Reporter: Jean-Pierre André <jean-pierre.andre>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-04 10:11:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jean-Pierre André 2011-06-16 10:30:30 UTC
Description of problem:
gcj for 32 bits on x86_64 searches zlib.so at a wrong location

Version-Release number of selected component (if applicable):
gcc-java-4.6.0-7.fc15.x86_64.rpm

How reproducible:
Always

Steps to Reproduce:
1. Write a simple java program foo.java
2. Compile by gcj -m32 -march=i386 --main=foo -o foo foo.java
3.
  
Actual results:
/usr/bin/ld: skipping incompatible /usr/lib64/libz.so when searching for -lz
/usr/bin/ld: cannot find -lz

Expected results:
Should link with no error

Additional info:

The 32-bit libz.so is searched in /usr/lib (before trying /usr/lib64), but libz.so is in /lib
This can be fixed by setting a symbolic link :
ln -s /lib/libz.so.1.2.5 /usr/lib/libz.so
(this bug also existed in fc14)

Comment 1 Jakub Jelinek 2011-08-04 10:11:07 UTC
Not sure what you are doing, but it works just fine for me.
To compile 32-bit Java programs using gcj successfully you obviously need to have 32-bit libgcj-devel installed, but if you do
yum install libgcj-devel.i686
then zlib-devel.i686 is installed as a dependency and that package contains the /usr/lib/libz.so symlink.

Comment 2 Jean-Pierre André 2011-08-04 16:55:30 UTC
> To compile 32-bit Java programs using gcj successfully you obviously
> need to have 32-bit libgcj-devel installed,

Ok I see, I did have the libgcj-devel.x86_64, but the need for the i386 was not obvious to me : libgcj requires libz.so.1 which is satisfied by zlib as a symlink in /lib, so no package pumps the i386 variant of libgcj-devel.

Thanks. Now I know.