Re: building openjdk-7 on kfreebsd-amd64

2012-03-21 Thread Georgi Naplatanov

On 03/20/2012 04:07 PM, Steven Chamberlain wrote:

The executable was linked with:


gcc-4.6 -o /«PKGBUILDDIR»/build/openjdk.build-boot/bin/java -Xlinker -O1 
-Xlinker -version-script=../../../java/main/java/mapfile-amd64   -Xlinker -z 
-Xlinker defs -Wl,-Bsymboli
c-functions -L/«PKGBUILDDIR»/build/openjdk.build-boot/lib/amd64 
-Wl,-soname=lib.so  -Wl,-z,relro -L 
/«PKGBUILDDIR»/build/openjdk.build-boot/lib/amd64/jli  -Wl,--allow-shlib-unde
fined -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64/jli -Wl,-rpath 
-Wl,\$ORIGIN/../jre/lib/amd64/jli \
 /«PKGBUILDDIR»/build/openjdk.build-boot/tmp/java/java/obj64/main.o 
-lpthread  -ljli -lz-ldl -lc


And I think something like this is missing from there for it to work:


-Wl,-rpath -Wl,\$ORIGIN/../lib/amd64




Hi Steven.

I don't have much experience with C++ programing, but I tried to link 
java (manually after the error).



gcc-4.6 -o /«PKGBUILDDIR»/build/openjdk.build-boot/bin/java -Xlinker -O1 
-Xlinker -version-script=../../../java/main/java/mapfile-amd64 
-Xlinker -z -Xlinker defs -Wl,-Bsymbolic-functions 
-L/«PKGBUILDDIR»/build/openjdk.build-boot/lib/amd64 -Wl,-soname=lib.so 
-Wl,-z,relro -L /«PKGBUILDDIR»/build/openjdk.build-boot/lib/amd64/jli 
-Wl,--allow-shlib-undefined -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64/jli 
-Wl,-rpath -Wl,\$ORIGIN/../jre/lib/amd64/jli 
«PKGBUILDDIR»/build/openjdk.build-boot/tmp/java/java/obj64/main.o 
-lpthread  -ljli -lz-ldl -lc -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64


but no luck, the error is the same when java starts:

Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.

Best regards
Georgi


--
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4f69c2ac.9090...@oles.biz



Re: building openjdk-7 on kfreebsd-amd64

2012-03-21 Thread Steven Chamberlain
On 21/03/12 11:59, Georgi Naplatanov wrote:
 gcc-4.6 -o /«PKGBUILDDIR»/build/openjdk.build-boot/bin/java -Xlinker -O1
 -Xlinker -version-script=../../../java/main/java/mapfile-amd64 -Xlinker
 -z -Xlinker defs -Wl,-Bsymbolic-functions
 -L/«PKGBUILDDIR»/build/openjdk.build-boot/lib/amd64 -Wl,-soname=lib.so
 -Wl,-z,relro -L /«PKGBUILDDIR»/build/openjdk.build-boot/lib/amd64/jli
 -Wl,--allow-shlib-undefined -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64/jli
 -Wl,-rpath -Wl,\$ORIGIN/../jre/lib/amd64/jli
 «PKGBUILDDIR»/build/openjdk.build-boot/tmp/java/java/obj64/main.o
 -lpthread  -ljli -lz-ldl -lc -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64
 
 but no luck, the error is the same when java starts:
 
 Error: could not find libjava.so
 Error: Could not find Java SE Runtime Environment.

Hi Georgi,

Thanks for trying it.  Could you please show the output of 'file' and
'ldd' on the linked binary?

You also could try removing this part, which looks like a mistake, from
the compiler flags:

-Wl,-soname=lib.so

That and some other interesting stuff is mentioned at
http://old.nabble.com/patches-for-native-jdk6-on-amd64-td14009995.html

Thanks,
Regards,
-- 
Steven Chamberlain
ste...@pyro.eu.org


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4f69c7f9.3070...@pyro.eu.org



Re: building openjdk-7 on kfreebsd-amd64

2012-03-21 Thread Steven Chamberlain
On 21/03/12 12:22, Steven Chamberlain wrote:
 Thanks for trying it.  Could you please show the output of 'file' and
 'ldd' on the linked binary?

objdump -p would give some useful info too.

Regards,
-- 
Steven Chamberlain
ste...@pyro.eu.org


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4f69c8e3.6000...@pyro.eu.org



Re: building openjdk-7 on kfreebsd-amd64

2012-03-21 Thread Georgi Naplatanov



On 03/21/2012 02:22 PM, Steven Chamberlain wrote:

Thanks for trying it.  Could you please show the output of 'file' and
'ldd' on the linked binary?

You also could try removing this part, which looks like a mistake, from
the compiler flags:

-Wl,-soname=lib.so

That and some other interesting stuff is mentioned at
http://old.nabble.com/patches-for-native-jdk6-on-amd64-td14009995.html



Hi Steven.

I linked java binary without -Wl,-soname=lib.so.

# gcc-4.6 -o 
/root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/bin/java -Xlinker 
-O1 -Xlinker -version-script=../../../java/main/java/mapfile-amd64 
-Xlinker -z -Xlinker defs -Wl,-Bsymbolic-functions 
-L/root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/lib/amd64 
-Wl,-z,relro -L 
/root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/lib/amd64/jli 
-Wl,--allow-shlib-undefined -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64/jli 
-Wl,-rpath -Wl,\$ORIGIN/../jre/lib/amd64/jli 
/root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/tmp/java/java/obj64/main.o 
-lpthread  -ljli -lz-ldl -lc -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64


and the error is still there:

Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.

# file /root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/bin/java
/root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/bin/java: ELF 
64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked 
(uses shared libs), for GNU/kFreeBSD 8.1.0, 
BuildID[sha1]=0xb6ff1777060aa9ed1de4b25c72d620ee56e9842a, not stripped


# ldd /root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/bin/java
libpthread.so.0 = /lib/x86_64-kfreebsd-gnu/libpthread.so.0 
(0x000801249000)
libjli.so = 
/root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/bin/../lib/amd64/jli/libjli.so 
(0x000801467000)
libz.so.1 = /usr/lib/x86_64-kfreebsd-gnu/libz.so.1 
(0x000801674000)
libdl.so.2 = /lib/x86_64-kfreebsd-gnu/libdl.so.2 
(0x00080188a000)
libc.so.0.1 = /lib/x86_64-kfreebsd-gnu/libc.so.0.1 
(0x000801a8f000)

/lib/ld-kfreebsd-x86-64.so.1 (0x01021000

# objdump -p /root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/bin/java

/root/jdk/openjdk-7-7~u3-2.1/build/openjdk.build-boot/bin/java: file 
format elf64-x86-64-freebsd


Program Header:
PHDR off0x0040 vaddr 0x00400040 paddr 
0x00400040 align 2**3

 filesz 0x01f8 memsz 0x01f8 flags r-x
  INTERP off0x0238 vaddr 0x00400238 paddr 
0x00400238 align 2**0

 filesz 0x001d memsz 0x001d flags r--
LOAD off0x vaddr 0x0040 paddr 
0x0040 align 2**21

 filesz 0x08cc memsz 0x08cc flags r-x
LOAD off0x0da8 vaddr 0x00600da8 paddr 
0x00600da8 align 2**21

 filesz 0x0278 memsz 0x0288 flags rw-
 DYNAMIC off0x0dd0 vaddr 0x00600dd0 paddr 
0x00600dd0 align 2**3

 filesz 0x0210 memsz 0x0210 flags rw-
NOTE off0x0258 vaddr 0x00400258 paddr 
0x00400258 align 2**2

 filesz 0x0044 memsz 0x0044 flags r--
EH_FRAME off0x07fc vaddr 0x004007fc paddr 
0x004007fc align 2**2

 filesz 0x002c memsz 0x002c flags r--
   STACK off0x vaddr 0x paddr 
0x align 2**3

 filesz 0x memsz 0x flags rw-
   RELRO off0x0da8 vaddr 0x00600da8 paddr 
0x00600da8 align 2**0

 filesz 0x0258 memsz 0x0258 flags r--

Dynamic Section:
  NEEDED   libpthread.so.0
  NEEDED   libjli.so
  NEEDED   libz.so.1
  NEEDED   libdl.so.2
  NEEDED   libc.so.0.1
  RPATH 
$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli:$ORIGIN/../lib/amd64

  INIT 0x00400550
  FINI 0x004007c8
  HASH 0x004002a0
  GNU_HASH 0x004002e0
  STRTAB   0x00400398
  SYMTAB   0x00400308
  STRSZ0x00e6
  SYMENT   0x0018
  DEBUG0x
  PLTGOT   0x00600fe8
  PLTRELSZ 0x0030
  PLTREL   0x0007
  JMPREL   0x00400520
  RELA 0x00400508
  RELASZ   0x0018
  RELAENT  0x0018
  VERDEF   0x00400490
  VERDEFNUM0x0002
  VERNEED  0x004004c8
  VERNEEDNUM   0x0002
  VERSYM   0x0040047e

Version 

Re: building openjdk-7 on kfreebsd-amd64

2012-03-20 Thread Steven Chamberlain
On 20/03/12 12:43, Georgi Naplatanov wrote:
 ... last week something happened to
 kfreebsd-amd64 (unstable) and the build process of openjdk-7 gave
 another error even with dpkg-buildpackage which worked before. The log
 file is here -
 http://os.oles.biz/openjdk/openjdk-7_7~u3-2.1-3_kfreebsd-amd64.build.gz

Hi,

I wonder if this could be to do with the library rpath for
j2sdk-image/jre/bin/java;  it is set to be able to find libjli only.


Full explanation:

/«PKGBUILDDIR»/build/bootstrap/jdk1.6.0/bin/java -version
Error: could not find libjava.so

Where /«PKGBUILDDIR»/build/bootstrap/jdk1.6.0 is symlink to
/«PKGBUILDDIR»/build/bootstrap/icedtea

Then /«PKGBUILDDIR»/build/bootstrap/icedtea is a symlink to
/«PKGBUILDDIR»/build/openjdk.build-boot/j2sdk-image/

And the binary is where it should be, at
/«PKGBUILDDIR»/build/openjdk.build-boot/j2sdk-image/bin/java

 RUNPATH for: /«PKGBUILDDIR»/build/openjdk.build-boot/j2sdk-image/jre/bin/java
  0x0001 (NEEDED) Shared library: [libpthread.so.0]
  0x0001 (NEEDED) Shared library: [libjli.so]
  0x0001 (NEEDED) Shared library: [libz.so.1]
  0x0001 (NEEDED) Shared library: [libdl.so.2]
  0x0001 (NEEDED) Shared library: [libc.so.0.1]
  0x000f (RPATH)  Library rpath: 
 [$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli]

So the rpath first expands to
/«PKGBUILDDIR»/build/openjdk.build-boot/j2sdk-image/jre/lib/amd64/jli

And libjli is indeed at
/«PKGBUILDDIR»/build/openjdk.build-boot/j2sdk-image/jre/lib/amd64/jli/libjli.so

 RUNPATH for: 
 /«PKGBUILDDIR»/build/openjdk.build-boot/j2sdk-image/jre/lib/amd64/jli/libjli.so
  0x0001 (NEEDED) Shared library: [libdl.so.2]
  0x0001 (NEEDED) Shared library: [libc.so.0.1]
  0x0001 (NEEDED) Shared library: [libz.so.1]
  0x0001 (NEEDED) Shared library: [libpthread.so.0]
  0x000f (RPATH)  Library rpath: [$ORIGIN:$ORIGIN/..]

If libjli.so now tried to load libjava.so, it would be looking in the
right place now (/jli/../)

But if the main executable tried to load libjava.so, its rpath is set
only to the /jli subdir where it is not found.


The executable was linked with:

 gcc-4.6 -o /«PKGBUILDDIR»/build/openjdk.build-boot/bin/java -Xlinker -O1 
 -Xlinker -version-script=../../../java/main/java/mapfile-amd64   -Xlinker -z 
 -Xlinker defs -Wl,-Bsymboli
 c-functions -L/«PKGBUILDDIR»/build/openjdk.build-boot/lib/amd64 
 -Wl,-soname=lib.so  -Wl,-z,relro -L 
 /«PKGBUILDDIR»/build/openjdk.build-boot/lib/amd64/jli  -Wl,--allow-shlib-unde
 fined -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64/jli -Wl,-rpath 
 -Wl,\$ORIGIN/../jre/lib/amd64/jli \
 
 /«PKGBUILDDIR»/build/openjdk.build-boot/tmp/java/java/obj64/main.o -lpthread  
 -ljli -lz-ldl -lc

And I think something like this is missing from there for it to work:

 -Wl,-rpath -Wl,\$ORIGIN/../lib/amd64


But I don't have a build environment to try this on right now.  And
wouldn't know where/how to make this change either...

Regards,
-- 
Steven Chamberlain
ste...@pyro.eu.org


-- 
To UNSUBSCRIBE, email to debian-bsd-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/4f688f28.9040...@pyro.eu.org