Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to build on Windows (troubles with Cygwin) #22

Open
VladimirAlexiev opened this issue Sep 17, 2024 · 1 comment
Open

how to build on Windows (troubles with Cygwin) #22

VladimirAlexiev opened this issue Sep 17, 2024 · 1 comment

Comments

@VladimirAlexiev
Copy link

VladimirAlexiev commented Sep 17, 2024

$  uname
CYGWIN_NT-10.0-22631

I tried the instructions https://atextor.de/owl-cli/main/snapshot/index.html#building-from-source and have these troubles:

SDKMAN

$ sdk install java 17.0.8-graal

Stop! java 17.0.8-graal is not available. Possible causes:
 * 17.0.8-graal is an invalid version
 * java binaries are incompatible with your platform
 * java has not been released yet

Tip: see all available versions for your platform:

  $ sdk list java

I did that and got:

================================================================================
Available Java Versions for Exotic
================================================================================
 Vendor        | Use | Version      | Dist    | Status     | Identifier
--------------------------------------------------------------------------------
No versions available for your platform at this time.
================================================================================

Line endings

$ ./gradlew
./gradlew: line 2: $'\r': command not found
./gradlew: line 18: $'\r': command not found
./gradlew: line 64: $'\r': command not found
./gradlew: line 66: $'\r': command not found
./gradlew: line 69: $'\r': command not found
./gradlew: line 71: $'while\r': command not found
./gradlew: line 73: [: missing `]'
./gradlew: line 74: $'do\r': command not found
ls: cannot access './gradlew'$'\r': No such file or directory
./gradlew: line 79: syntax error near unexpected token `newline'
'/gradlew: line 79: `      *)    app_path=$APP_HOME$link ;;

This is an EOL (line endings) compatibility issue.
git converts the files to \r\n on checkout.
I often use d2u to fix such issues.

The suggested fix is:

$ git config --global -e
# edit [core] section and set autocrlf=input
# then verify with:
$ git config --get core.autocrlf
input

gradlew.bat

I decided to try the build from cmd rather than bash:

set JAVA_HOME=d:\graalvm
gradlew.bat

It gave some warnings about deprecated features, but was successful.
The complete build scan is at https://scans.gradle.com/s/nmmtoraixpzcu

running owl-cli

> java -jar cli\build\libs\owl-cli-snapshot.jar --version
owl-cli version: snapshot build date: 2024-09-17 19:15:41

> move /y cli\build\libs\owl-cli-snapshot.jar c:\prog\bin

I currently use Temurin 22 (installed with scoop), but owl-cli seems to run ok.

java -version
openjdk version "22" 2024-03-19
OpenJDK Runtime Environment Temurin-22+36 (build 22+36)
OpenJDK 64-Bit Server VM Temurin-22+36 (build 22+36, mixed mode, sharing)

I think it needs graalvm-17 only for the build process, because it fails to run with it:

>set JAVA_HOME=d:\graalvm

>d:\graalvm\bin\java -version
java version "17.0.12" 2024-07-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 17.0.12+8.1 (build 17.0.12+8-LTS-jvmci-23.0-b41)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 17.0.12+8.1 (build 17.0.12+8-LTS-jvmci-23.0-b41, mixed mode, sharing)

>d:\graalvm\bin\java c:\prog\bin\owl-cli-snapshot.jar -version
Error: Could not find or load main class c:\prog\bin\owl-cli-snapshot.jar
Caused by: java.lang.ClassNotFoundException: c:\prog\bin\owl-cli-snapshot.jar
@VladimirAlexiev VladimirAlexiev changed the title build troubles on Cygwin how to build on Windows (troubles with Cygwin) Sep 17, 2024
@atextor
Copy link
Owner

atextor commented Sep 18, 2024

Hi @VladimirAlexiev, thanks for the effort & the infos. I've never tried the build with Cygwin, I just now that some people use SDKMAN! with WSL. You are correct, a GraalVM JDK is only required for the build if a native executable (.exe) should be built, which, for regular builds is the default - the native executable should ease use after all.

Related:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants