New to kotlin, wanna build kotlin from source and ...
# getting-started
h
New to kotlin, wanna build kotlin from source and see how it works(eg: compiler or so), but I get problem when I try to build on my Mac OS, is there any tutorial in detail about build kotlin from source code?
👍 2
n
kevinofneu: There is only a readme https://github.com/JetBrains/kotlin/blob/master/ReadMe.md#building but it should work most of time )
d
If you have more specific question than “I have a problem” we might be able to answer.
h
When I use
ant -f build.xml
, I got unresolved error,
Copy code
[javac2] /Users/kevin/Workspace/github/kotlin/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/util/javacListUtils.kt:42:60: error: unresolved reference: JavacList
   [javac2]     if (valuePairs == null || valuePairs.isEmpty()) return JavacList.nil()
   [javac2]                                                            ^
   [javac2] /Users/kevin/Workspace/github/kotlin/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/util/javacListUtils.kt:45:18: error: unresolved reference: JavacList
   [javac2]     var result = JavacList.nil<T>()
   [javac2]                  ^
   [javac2] /Users/kevin/Workspace/github/kotlin/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/util/javacListUtils.kt:57:33: error: unresolved reference: JavacList
   [javac2] internal operator fun <T : Any> JavacList<T>.plus(other: JavacList<T>): JavacList<T> {
   [javac2]                                 ^
   [javac2] /Users/kevin/Workspace/github/kotlin/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/util/javacListUtils.kt:57:58: error: unresolved reference: JavacList
   [javac2] internal operator fun <T : Any> JavacList<T>.plus(other: JavacList<T>): JavacList<T> {
   [javac2]                                                          ^
   [javac2] /Users/kevin/Workspace/github/kotlin/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/util/javacListUtils.kt:57:73: error: unresolved reference: JavacList
   [javac2] internal operator fun <T : Any> JavacList<T>.plus(other: JavacList<T>): JavacList<T> {
   [javac2]
n
did
ant -f update_dependencies.xml
completed successfully ?
h
update_dependencies succeed
n
Sometimes it could happen that dependency jars become broken during downloading. So maybe it worth to delete content of
ideaSDK
folder and try to update dependencies ons again.
h
OK,I will try later
thx
unfortunately,still with error, detail screenshot:

http://7xr586.com1.z0.glb.clouddn.com/images/qsf6v.jpg

d
Have you also run ant dist and do you have the three versions of Java installed? I would guess it might be dist related given that it’s failing to find something that should be within the project.
n
Are there any warnings about
tools.jar
in the beginnig of build process? Are you sure that
JAVA_HOME
points to JDK not JRE?
h
In my .zshrc:
Copy code
export JAVA_HOME="/Library/Java/Home"
export JDK_16="/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
export JDK_18="/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home"
export JDK_17="/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home"
export PATH="$JAVA_HOME/bin:$JDK_16/bin:$JDK_17/bin:$JDK_18/bin:$PATH"
export ANT_OPTS="-Xmx1024m -XX:MaxPermSize=512m"
Is that ok?
There is no warnings about
tools.jar
in the beginnig of build process
n
hm… try to point all of this Java Paths to
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
because all unresolved references I see in you sreenshot are parts of
tools.jar
of JDK
h
I shall have a try, thanks
@nicolay.mitropolsky @dalexander thank u guys, finally succeed!
May be I should post a blog about this procedure.
d
Glad it finally worked, do you know what made the difference? It might be valuable to have a walkthrough, the readme is a little bit dense sometimes
h
The Java environment on my computer is cracked, eventhough the environment variables are correctly setted, when it comes to build process, there are errors, may be I should checked it more carefaully. So it may be better if there are more detailed building process which can be used to check which parts are going wrong.