daemonblade / freebsd-eclipse

Tools to build Eclipse port for FreeBSD
3 stars 3 forks source link

JVM not found #1

Closed daemonblade closed 5 years ago

daemonblade commented 5 years ago

Sometimes ./eclipse fails with JVM not found.

This can happen on a system where the command previously succeeded. The obvious hypothesis is that there's an uninitialised variable somewhere that's being used.

Code of interest is in: rt.equinox.framework/features/org.eclipse.equinox.executable.feature/library

daemonblade commented 5 years ago

eclipseCommon.c: line 297 stat("/usr/local/bin/java") is returning weird stuff:

(lldb) p stats
(stat) $4 = {
  st_dev = 657218906713206
  st_ino = 98669
  st_nlink = 18446744069414584320
  st_mode = 766
  st_padding0 = 23704
  st_uid = 0
  st_gid = 271559000
  st_padding1 = 0
  st_rdev = 1545370940
  st_atim = (tv_sec = 0, tv_nsec = 1551640299)
  st_mtim = (tv_sec = 772753000, tv_nsec = 20871)
  st_ctim = (tv_sec = 49, tv_nsec = 8796093043200)
  st_birthtim = (tv_sec = 0, tv_nsec = 1545370940)
  st_size = 0
  st_blocks = 0
  st_blksize = 0
  st_flags = 0
  st_gen = 0
  st_spare = ([0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0, [7] = 0, [8] = 0, [9] = 0)

Almost as if alignment is off?

Compared to a 1 liner C-program:

(lldb) p s
(stat) $0 = {
  st_dev = 1858276762505014390
  st_ino = 153020
  st_nlink = 1
  st_mode = 33133
  st_padding0 = 0
  st_uid = 0
  st_gid = 0
  st_padding1 = 0
  st_rdev = 18446744073709551615
  st_atim = (tv_sec = 1553466110, tv_nsec = 271559000)
  st_mtim = (tv_sec = 1545370940, tv_nsec = 0)
  st_ctim = (tv_sec = 1551640299, tv_nsec = 772753000)
  st_birthtim = (tv_sec = 1545370940, tv_nsec = 0)
  st_size = 20871
  st_blocks = 49
  st_blksize = 20992
  st_flags = 2048
  st_gen = 0
  st_spare = ([0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0, [7] = 0, [8] = 0, [9] = 0)
}
mizhka commented 5 years ago

Issue is lack of version of stat symbol in eclipse1900.so. Solution (i'm not sure it's appropriate) is to add "-lc" as argument for LD command in make*.mak (https://github.com/daemonblade/freebsd-eclipse/blob/master/java-eclipse/files/patch-rt.equinox.framework#L391). My version is FreeBSD 13-CURRENT with ino64, so "stat" from eclipse_xxx.so tried to call compat11.stat, when "stat" from binary made correct call.

It works fine after fix.

daemonblade commented 5 years ago

I compared my patches for the make_linux.mak and it looks like I tried to be too clever. I've simplified it and it appears to work. I'll be committing it once I finished full build.

Thanks for pointing me in the right direction!

daemonblade commented 5 years ago

Fixed by https://github.com/daemonblade/freebsd-eclipse/commit/faeea7403f7370aeb22b84fed735204f8e90c60f