Skip to content

cross-platform I/Q Makefile#233

Open
edoput wants to merge 4 commits into
awslabs:mainfrom
edoput:main
Open

cross-platform I/Q Makefile#233
edoput wants to merge 4 commits into
awslabs:mainfrom
edoput:main

Conversation

@edoput
Copy link
Copy Markdown

@edoput edoput commented May 21, 2026

Dear all,

I am building I/Q on Linux and found that the makefile assumes macos specific paths.

This commit sources the correct environment variables for the build process in the makefile from isabelle itself, making the makefile portable between macos and linux.

Description of changes:

Environment variables like JEDIT_DIR or JEDIT_JAR are documented in isabelle getenv itself and can be sourced from there. This commit changes the makefile to do so and, as a result, makes the makefile portable between linux and macos.

I have used AI to make these changes but I confirm that it works on my linux machine. This is the current output of the debug recipe. As you can see it sources correctly paths such as JAVA_HOME from isabelle getenv -b JAVA_HOME

sh-5.2$ ISABELLE_HOME=/app/ make debug
Build configuration:
  PLUGIN_DIR    = /home/edoput/repo/AutoCorrode/iq
  ISABELLE_HOME = /app/
  JEDIT_JAR     = /app/contrib/jedit-20250215/jedit5.7.0-patched/jedit.jar
  JAVA_HOME     = /app/contrib/jdk-21.0.6/x86_64-linux
  SCALA_HOME    = /app/contrib/scala-3.3.4
  SCALAC        = /app/contrib/scala-3.3.4/bin/scalac
  SCALA         = /app/contrib/scala-3.3.4/bin/scala
  ISABELLE_JAR  = /app/lib/classes/isabelle.jar
  SCALA_PARSER_JAR = /app/contrib/scala-3.3.4/lib/scala-parser-combinators_3-2.4.0.jar
  XZ_JAR        = /app/contrib/xz-java-1.10/lib/xz-1.10.jar
  ZSTD_JAR      = /app/contrib/zstd-jni-1.5.6-8/zstd-jni-1.5.6-8.jar
  JAVA          = /app/contrib/jdk-21.0.6/x86_64-linux/bin/java
  JAR           = /app/contrib/jdk-21.0.6/x86_64-linux/bin/jar
  BUILD_DIR     = /home/edoput/repo/AutoCorrode/iq/build
  CLASSES_DIR   = /home/edoput/repo/AutoCorrode/iq/build/classes
  JAR_FILE      = /home/edoput/repo/AutoCorrode/iq/build/iq_plugin.jar
  INSTALL_DIR   = /.isabelle/Isabelle2025-2/jedit/jars
  SCALA_SOURCES = src/ErrorCodes.scala src/Extended_Query_Operation.scala src/IQCapabilities.scala src/IQExploreDockable.scala src/IQLogDockable.scala src/IQNormalization.scala src/IQOptions.scala src/IQPlugin.scala src/IQProtocol.scala src/IQSecurity.scala src/IQServer.scala src/IQUISettings.scala src/IQUtils.scala src/IRClient.scala
  RESOURCE_FILES = resources/dockables.xml resources/plugin.props
  TEST_SOURCES  = test/IQArgumentUtilsTest.scala test/IQLineOffsetUtilsTest.scala test/IQUtilsPathResolutionTest.scala src/test/scala/IQNormalizationTest.scala src/test/scala/IQSecurityTest.scala src/test/scala/IQServerAuthTest.scala src/test/scala/IQUISettingsTest.scala

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@hanno-becker hanno-becker added the bug Something isn't working label May 29, 2026
Copy link
Copy Markdown
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @edoput! I tested it on Mac and Linux and it works. One should error out early if the Isabelle binary is not found, but this can be follow-up.

@hanno-becker
Copy link
Copy Markdown
Contributor

The CI failures in ip-test are unrelated and attempted to be addressed in #234

Comment thread iq/Makefile
Comment thread iq/Makefile
Copy link
Copy Markdown
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second look, noted a probably unintentional change in the scala flags. Can you restore the original, and while at it also add a check if the Isabelle binary has been found, and otherwise nudge the user to set ISABELLE_HOME appropriately?

Comment thread iq/Makefile Outdated
ISABELLE_BIN ?= $(if $(wildcard $(ISABELLE_HOME)/bin/isabelle),$(ISABELLE_HOME)/bin/isabelle,isabelle)
ifeq ($(wildcard $(ISABELLE_BIN)),)
$(error Isabelle binary not found at $(ISABELLE_BIN). \
Set ISABELLE_HOME correctly, e.g. make ISABELLE_HOME=/path/to/Isabelle/bin)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ISABELLE_HOME is assumed to be the root directory here, not bin

Comment thread iq/Makefile
ZSTD_JAR := $(firstword $(wildcard $(ISABELLE_HOME)/contrib/zstd-jni-*/lib/zstd-jni-*.jar))
ISABELLE_JAR ?= $(ISABELLE_HOME)/lib/classes/isabelle.jar
JAVA_HOME ?= $(shell $(ISABELLE) getenv -b JAVA_HOME 2>/dev/null)
ISABELLE_BIN ?= $(if $(wildcard $(ISABELLE_HOME)/bin/isabelle),$(ISABELLE_HOME)/bin/isabelle,isabelle)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This renames $ISABELLE to $ISABELLE_BIN but does not adjust all usages, specifically make test below.

Copy link
Copy Markdown
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor issues still need fixing, see comments

Edoardo Putti added 3 commits June 1, 2026 11:00
This sources the correct environment variables for the build process in
the makefile from isabelle itself.
also changes the error message to reflect the correct semantics of
ISABELLE_HOME as the base directory, not the binaries directory
@edoput
Copy link
Copy Markdown
Author

edoput commented Jun 1, 2026

I should have addressed the last issues. The isabelle binary is only addressed using ISABELLE_BIN and I have introduced a check that it is a real command.

In the test command ISABELLE was only used in one test.

$(ISABELLE_BIN) scala \
                -classpath "$(CLASSES_DIR):$(TEST_CLASSES_DIR)" \
                IQNormalizationTest

While the rest of the recipe uses a different pattern.

JAVA_HOME="$(JAVA_HOME)" PATH="$(JAVA_HOME)/bin:$$PATH" $(SCALA)

Which one is appropriate and should be kept?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants