Opened 8 months ago

Last modified 8 months ago

#69465 new defect

pdftk-java compilation fails: Unable to find a javac compiler

Reported by: chrisdiamand (Chris Diamand) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: pdftk-java

Description

Hi,

I'm trying to install pdftk-java on a clean installation (I tried port clean first, then wiped the whole installation and started again, but neither helped).

I'm running this:

# sudo port install pdftk-java
...
--->  Building pdftk-java
Error: Failed to build pdftk-java: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets if you believe there is a bug.
Error: Processing of port pdftk-java failed
--->  Some of the ports you installed have notes:
  openjdk11 has the following notes:
    If you want to make openjdk11 the default JDK, add this to shell profile:
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk11/Contents/Home

The pertinent bit of the build log is this:

:notice:build --->  Building pdftk-java
:debug:build Executing org.macports.build (pdftk-java)
:debug:build Environment: 
:debug:build CC_PRINT_OPTIONS='YES'
:debug:build CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/work/.CC_PRINT_OPTIONS'
:debug:build CPATH='/opt/local/include'
:debug:build DEVELOPER_DIR='/Library/Developer/CommandLineTools'
:debug:build JAVA_HOME='/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home'
:debug:build LIBRARY_PATH='/opt/local/lib'
:debug:build MACOSX_DEPLOYMENT_TARGET='14.0'
:debug:build SDKROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk'
:info:build Executing:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/work/pdftk-3.3.3" && ant jar 
:debug:build system:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/work/pdftk-3.3.3" && ant jar 
:info:build Buildfile: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/work/pdftk-3.3.3/build.xml
:info:build Trying to override old definition of task javac
:info:build compile:
:info:build     [mkdir] Created dir: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/work/pdftk-3.3.3/build/classes
:info:build BUILD FAILED
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/work/pdftk-3.3.3/build.xml:16: Unable to find a javac compiler;
:info:build com.sun.tools.javac.Main is not on the classpath.
:info:build Perhaps JAVA_HOME does not point to the JDK.
:info:build It is currently set to "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
:info:build Total time: 0 seconds
:info:build Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/work/pdftk-3.3.3" && ant jar 
:info:build Exit code: 1
:error:build Failed to build pdftk-java: command execution failed
:debug:build Error code: CHILDSTATUS 44585 1

Exporting JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk11/Contents/Home, either as root or before the sudo command has no effect - the log still thinks it's set to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home.

Installation of the openjdk11 dependency seems to have succeeded though, but I can't figure out why it's then being ignored by the pdftk-java build.

Thanks!

Attachments (1)

main.log (17.0 KB) - added by chrisdiamand (Chris Diamand) 8 months ago.
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/main.log

Download all attachments as: .zip

Change History (4)

Changed 8 months ago by chrisdiamand (Chris Diamand)

Attachment: main.log added

/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_textproc_pdftk-java/pdftk-java/main.log

comment:1 Changed 8 months ago by kencu (Ken)

how did this get set?

JAVA_HOME is set to "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

… looks like java PG is finding a java installation in there and trying to use it…

Last edited 8 months ago by kencu (Ken) (previous) (diff)

comment:2 Changed 8 months ago by chrisdiamand (Chris Diamand)

Thanks for the pointer - that's not anything I set, and I couldn't find any references to that directory in /opt/macports or anywhere else :(

And running /usr/libexec/java_home gave me the correct openjdk11 installation in /Library/Java/JavaVirtualMachines/openjdk11/Contents/Home, not /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home - but macports was still getting the latter. Maybe the version requirements specified by pdftk-java were causing it to favour that one.

However, I've now run the "Java Uninstall Tool" (which I assume pretty much does the steps listed here) - that directory is now gone, and pdftk-java builds!

I'm happy to close this bug then - although is there still a potential issue, in that macports is unable to use the JDK it installed itself during a build? I.e., in this case, pdftk-java pulled in openjdk11 as a dependency - macports goes to the trouble of downloading and installing it - but then leaves it to chance as to which JDK actually gets used for the dependent build?

comment:3 Changed 8 months ago by kencu (Ken)

certainly seems like there is some bug to be sorted out in the java PortGroup.

Note: See TracTickets for help on using tickets.