lockss / lockss-daemon

Classic LOCKSS System (LOCKSS 1.x)
BSD 3-Clause "New" or "Revised" License
59 stars 14 forks source link

Building the test framework fails on OS X #10

Closed ubermichael closed 2 years ago

ubermichael commented 4 years ago

Describe the issue here.

I am attempting to build the test framework on OS X, but the build is failing.

Expected behavior

Successful build, and the ability to run one or more daemons in the test framework.

Actual behavior.

This is the error message the results from running ant btf.

i18n-generate-bundles:
     [echo] Generating i18n message bundles in /Users/michael/Desktop/lockss-daemon/src
     [echo] Generating bundle from ./src/i18n/keys.pot
[gettext-generate-default] Generating default po file: msginit --no-translator -i ./src/i18n/keys.pot -o /var/folders/yw/15k1ds9n1q5dqr16h777sl040000gn/T/default1929771498442754363.po
[gettext-generate-default] msgfmt --java2 -d ./classes -r org.lockss.i18n.Messages /var/folders/yw/15k1ds9n1q5dqr16h777sl040000gn/T/default1929771498442754363.po
[gettext-generate-default] msgfmt returned 1

BUILD FAILED
/Users/michael/Desktop/lockss-daemon/build.xml:1174: The following error occurred while executing this line:
/Users/michael/Desktop/lockss-daemon/build.xml:3641: Build failed

Running the msgfmt statement above produces this error message:

$  msgfmt --java2 -d ./classes -r org.lockss.i18n.Messages /var/folders/yw/15k1ds9n1q5dqr16h777sl040000gn/T/default1929771498442754363.po
msgfmt: Java compiler not found, try installing gcj or set $JAVAC
msgfmt: compilation of Java class failed, please try --verbose or set $JAVAC

Steps to reproduce the problem.

Run ant btf in environment configured according to the README.

Specifications:

  1. Version of the daemon
  2. Hash of branch (if applicable)

I'm using the master branch fd8e8957032a200aca604cdec0dde4ec8ea5482f

  1. Operating system

Mac OS X 10.15

$ java -version
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
$ echo $JAVAC
/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/javac
  1. Hardware

MacBook Pro.

tlipkis commented 4 years ago

Hi Michael.

I've never seen this. Is javac on your path? I'm suspicious because the output of java -version suggests it's running a java from the jre, not the jdk. (I don't know anything about $JAVAC - that's apparently something that msgfmt supports.)

ubermichael commented 4 years ago

Hi Tom. How can I check that it's running in the JDK and not the JRE? I only have OpenJDK 1.7 installed, but that might include a JRE.

tlipkis commented 4 years ago

If you've only installed the jdk my guess is probably wrong. But ... Does 'javac -version' display a version number?

ubermichael commented 4 years ago

$ javac -version javac 1.7.0_71

ubermichael commented 4 years ago

I removed all the java vms and jdks and installed JDK 1.7 from Oracle's archives.

$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

$ javac -version
javac 1.7.0_80

Compiling the test framework still gives the same error.

[gettext-generate-default] msgfmt --java2 -d ./classes -r org.lockss.i18n.Messages /var/folders/yw/15k1ds9n1q5dqr16h777sl040000gn/T/default9219667401988485081.po
[gettext-generate-default] msgfmt returned 1

$ msgfmt --java2 -d ./classes -r org.lockss.i18n.Messages /var/folders/yw/15k1ds9n1q5dqr16h777sl040000gn/T/default9219667401988485081.po
msgfmt: Java compiler not found, try installing gcj or set $JAVAC
msgfmt: compilation of Java class failed, please try --verbose or set $JAVAC
tlipkis commented 4 years ago

Drat. Well, the whole i18n mechanism is optional (and there are no language bundles defined anyway). It's supposed to skip it automatically if gettext doesn't run; I'm guessing the invocation it uses as a test (just display the version number) does work, and I have no idea why the real invocation doesn't work. As a workaround, you can force it to be skipped with 'ant btf -Dgettext.checked=true'. If that works, make a file ~/.lockssprops with the line 'gettext.checked=true' and you won't need to include it on the command line.

tlipkis commented 4 years ago

Btw, you can use Java 8. The only reason not to is if you're developing plugins that include Java code, and any of your production machines are running Java 7. Java 8 is also ok (better, even) on production machines.

ubermichael commented 4 years ago

ant btf -Dgettext.checked=true worked and the test framework is starting up right now. Hopefully all goes well from there.