votingworks/electionguard-kotlin-multiplatform

task egklib:linkDebugTestNative failing in Intellij, works from command line gradle

JohnLCaron opened this issue · 3 comments

./gradlew clean assemble

works

./gradlew clean assemble > build.txt
++ Using Vector Intrinsics
/home/snake/dev/github/electionguard-kotlin-multiplatform/hacllib/libhacl/src/Lib_Memzero0.c: In function ‘Lib_Memzero0_memzero’:
/home/snake/dev/github/electionguard-kotlin-multiplatform/hacllib/libhacl/src/Lib_Memzero0.c:45:6: warning: #warning "Your platform does not support any safe implementation of memzero -- consider a pull request!" [-Wcpp]
   45 |     #warning "Your platform does not support any safe implementation of memzero -- consider a pull request!"
      |      ^~~~~~~
w: /home/snake/dev/github/electionguard-kotlin-multiplatform/egklib/src/nativeMain/kotlin/electionguard/publish/ConsumerJson.kt: (239, 49): Unnecessary non-null assertion (!!) on a non-null receiver of type (PlaintextBallot) -> Boolean
w: /home/snake/dev/github/electionguard-kotlin-multiplatform/egklib/src/nativeMain/kotlin/electionguard/publish/ConsumerJson.kt: (265, 49): Unnecessary non-null assertion (!!) on a non-null receiver of type (EncryptedBallot) -> Boolean

(also see attached output)

build.txt

but building from IntelliJ (Ctrl-F9) fails with "cannot find -lhacl" :

...
> Task :egklib:linkDebugTestNative
e: /home/snake/.konan/dependencies/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/x86_64-unknown-linux-gnu/bin/ld.gold invocation reported errors
The /home/snake/.konan/dependencies/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/x86_64-unknown-linux-gnu/bin/ld.gold command returned non-zero exit code: 1.
output:
/home/snake/.konan/dependencies/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/x86_64-unknown-linux-gnu/bin/ld.gold: error: cannot find -lhacl
> Task :egklib:linkDebugTestNative FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':egklib:linkDebugTestNative'.
> Compilation finished with errors
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 58s

To run single test from command line (pwd github/electionguard-kotlin-multiplatform)

./gradlew :egklib:nativeTest --tests "electionguard.publish.RunElectionRecordConvertTest.runElectionRecordConvertRoundtrip"

Theres a lot of trouble with the way we are handling the hacl library, in particular it seems to always build it, or at least take a long time to decide it doesnt need to.

We should conside putting it into a separate repo, and only link against it from the eg repo.

hacl removed