Adam Cooper
09/17/2022, 6:23 AM/usr/lib
and /usr/include
. My program is able to build just fine on this distro.
I'm trying to build on Ubuntu, which uses {/usr/lib,/usr/include}/x86_64-linux-gnu
. I have my compiler options defined in a .def:
compilerOpts.linux = -I/usr/include -I/usr/include/x86_64-linux-gnu
linkerOpts.linux = -L /usr/lib -L/usr/lib/x86_64-linux-gnu -lpthread -lssl -lcrypto
My executable is defined in build.gradle.kts
as follows:
binaries {
executable {
// Use system C libraries
val sysRoot = "/"
val libgccRoot = File("/lib/gcc/x86_64-linux-gnu/").takeIf { it.exists() }
?: File("/lib/gcc/x86_64-pc-linux-gnu/")
// Use the most recent GCC available on the host
val libgccPath = file("${libgccRoot.absolutePath}/${libgccRoot.list()!!.last()}")
val overriddenProperties =
"targetSysRoot.linux_x64=$sysRoot;libGcc.linux_x64=$libgccPath"
val compilerArgs = "-Xoverride-konan-properties=$overriddenProperties"
this.freeCompilerArgs += listOf(compilerArgs)
this.entryPoint = "opstopus.deploptopus.main"
this@binaries.findTest("debug")?.let { it.freeCompilerArgs += listOf(compilerArgs) }
}
}
On Ubuntu, I consistently get this error:
/root/.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 open //usr/lib/crt1.o: No such file or directory
/root/.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 open //usr/lib/crti.o: No such file or directory
/root/.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 open //usr/lib/crtn.o: No such file or directory
I confirmed that all 3 of these object files are in /usr/lib/x86_64-linux-gnu
on Ubuntu. Why is it only searching in /usr/lib
?Adam Cooper
09/17/2022, 6:26 AM