kyonifer / koma

A scientific computing library for Kotlin. https://kyonifer.github.io/koma
Other
270 stars 23 forks source link

'cblas.h' not found when building in Mac Os x #53

Closed IsmailAfiff closed 6 years ago

IsmailAfiff commented 6 years ago

Command ./gradlew build produces this error on mac

Task :koma-core-cblas:compileKonanCblasMacbook FAILED
Exception in thread "main" java.lang.Error: /var/folders/wz/xhlg5g6n1c785tsbryqp0yyh0000gn/T/tmp7098207755916076298.c:1:10: fatal error: 'cblas.h' file not found
        at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:137)
        at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:898)
        at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:888)
        at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:56)
        at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:307)
        at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:38)
        at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:100)
        at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:29)

I try to modify buildscripts/cblas.def into

headers=cblas.h
compilerOpts = -I/usr/include/x86_64-linux-gnu -I/usr/local/opt/openblas/include
linkerOpts = -L/usr/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/opt/openblas/lib -lblas

and buildscripts/lapacke.def into

headers=lapacke.h
compilerOpts = -I/usr/local/opt/lapack/include
linkerOpts = -L/usr/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/opt/lapack/lib -llapacke

but no result, any idea?

IsmailAfiff commented 6 years ago

Turns out there is another cblas.def and lapacke.def file inside koma-core/native-cblas which needs to be updated also. After that building works fine

kyonifer commented 6 years ago

Sorry for the confusion. The def files in buildscripts are remnants from the pre-multiplatform build system (before kotlin/native supported multiplatform) and aren't actually being used by anything. I removed them in cbacd1eb09622764ce155be57dfd2fff5a2c363e.