Skip to content

build instructions? #291

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

Closed
venkatperi opened this issue Mar 18, 2018 · 17 comments
Closed

build instructions? #291

venkatperi opened this issue Mar 18, 2018 · 17 comments

Comments

@venkatperi
Copy link
Contributor

Can you please add building instructions? There's a lot of inter project dependencies (e.g. swing depends on jvm8).

@jcornaz
Copy link
Contributor

jcornaz commented Mar 18, 2018

This is regular gradle build. You can use ./gradlew build to build everything. If you want to build only one module you can type: ./gradew :kotlinx-coroutines-swing:build (swing in this case). This would build any dependency first.

Just make sure you have a valid JAVA_HOME. (I have no problem with JDK 8)

@venkatperi
Copy link
Contributor Author

The original issue was caused by IntelliJ's build (imported from Gradle).

However:
$ ./gradlew build throws the following error, even on a clean VM (docker run --rm -it openjdk:8 bash)

> Configure project :
Using Kotlin compiler version: 1.2.21


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred starting process 'command 'null/bin/java''
> Could not start 'null/bin/java'

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'null/bin/java''
        at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:222)
        at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:202)
        at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:342)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
        at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'null/bin/java'
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
        at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
        ... 4 more
Caused by: java.io.IOException: Cannot run program "null/bin/java" (in directory "/kotlinx.coroutines"): error=2, No such file or directory
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 6 more
Caused by: java.io.IOException: error=2, No such file or directory
        ... 7 more

@jcornaz
Copy link
Contributor

jcornaz commented Mar 19, 2018

"Could not start 'null/bin/java'" is a typical issue happening when JAVA_HOME is not set.

# Find the JDK
find /usr/lib/jvm/java-1.x.x-openjdk

# Set JAVA_HOME
export JAVA_HOME="path to the jdk"

# Verify (should print the path to the jdk)
echo $JAVA_HOME

# Try again
./gradlew build

@venkatperi
Copy link
Contributor Author

Forgot to mention I verified JAVA_HOME was set:

root@55edb2697f0b:/# echo $JAVA_HOME
/docker-java-home
lrwxrwxrwx 1 root root 33 Mar 14 11:09 /docker-java-home -> /usr/lib/jvm/java-8-openjdk-amd64
lrwxrwxrwx 1 root root   20 Nov  1 14:17 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64

@venkatperi
Copy link
Contributor Author

This fails as well:

root@55edb2697f0b:/kotlinx.coroutines# echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64/

$ git clone https://github.com/Kotlin/kotlinx.coroutines
$ cd kotlinx.coroutines
$ ./gradlew build

@jcornaz
Copy link
Contributor

jcornaz commented Mar 20, 2018

What does $JAVA_HOME/bin/java -version return ?

@fvasco
Copy link
Contributor

fvasco commented Mar 20, 2018

Use this Dockerfile to replace the issue

FROM openjdk:8
WORKDIR /home
RUN git clone https://github.com/Kotlin/kotlinx.coroutines .
RUN ./gradlew build -x test

Error:

:kotlinx-coroutines-core:jdk16Test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred starting process 'command 'null/bin/java''
> Could not start 'null/bin/java'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 5m 21s
25 actionable tasks: 25 executed
The command '/bin/sh -c ./gradlew build -x test' returned a non-zero code: 1

See

executable = "$System.env.JDK_16/bin/java"

@venkatperi
Copy link
Contributor Author

root@9ba151b4bc7b:/# java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-1~deb9u1-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Btw, JDK_16 is undefined per previous post. Could be the issue.

@venkatperi
Copy link
Contributor Author

skipping task jdk16Test fixes the build

@jcornaz
Copy link
Contributor

jcornaz commented Mar 20, 2018

So yes, I agree the readme should tell to define JDK_16.

@venkatperi
Copy link
Contributor Author

venkatperi commented Mar 20, 2018 via email

@venkatperi
Copy link
Contributor Author

Here's a pull request: #294

@fvasco
Copy link
Contributor

fvasco commented Mar 21, 2018

Why running gradle with -x test executes jdk16Test?

@venkatperi
Copy link
Contributor Author

While -x test will skip tests, the offending code is executed during grade's configure phase, hence the error.

@fvasco
Copy link
Contributor

fvasco commented Mar 21, 2018

No, there is no reason to execute null/bin/java in configuration phase.
It is a dependency of build phase instead of test phase

(Please reopen this issue)

@venkatperi
Copy link
Contributor Author

Gradle is failing during its config phase where it tries to create tasks (and their properties). I've created a new pull request to fail if JDK_16 is not set. #296

@fvasco
Copy link
Contributor

fvasco commented Mar 21, 2018

Switch dependency fix the issue

-build.dependsOn moreTest
+test.dependsOn moreTest

gradle build -x test works

elizarov pushed a commit that referenced this issue Mar 22, 2018
streetsofboston pushed a commit to IntrepidPursuits/kotlinx.coroutines that referenced this issue Apr 20, 2018
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

4 participants