From edf3708515934a294dea78ad4e5db8a290361b91 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 11 Nov 2016 16:40:10 +0700 Subject: [PATCH] build: fix linking tests on Linux runtime now requires "-lm" --- backend.native/tests/build.gradle | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 0b8e1853bf4..8c0a4dc09fc 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -86,6 +86,7 @@ abstract class KonanTest extends DefaultTask { return project.isLinux() } + // TODO: stop copy-pasting protected String linkDl() { if (linux()) { return "-ldl" @@ -95,6 +96,15 @@ abstract class KonanTest extends DefaultTask { } } + protected String linkM() { + if (linux()) { + return "-lm" + } + else { + return "" + } + } + protected String rdynamic() { if (linux()) { return "-rdynamic" @@ -110,7 +120,7 @@ class UnitKonanTest extends KonanTest { def testC = sourceS.absolutePath.replace(".kt.S", "-test.c") project.execClang { commandLine "clang", "${testC}", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}", - "-o", "${exe.absolutePath}", linkDl(), rdynamic() + "-o", "${exe.absolutePath}", linkDl(), linkM(), rdynamic() } } } @@ -119,7 +129,7 @@ class RunKonanTest extends KonanTest { void compileTest(File sourceS, File runtimeS, File exe) { project.execClang { commandLine "clang", "-DRUN_TEST", "${runtimeS.absolutePath}", "${sourceS.absolutePath}", "${mainC}", - "-o", "${exe.absolutePath}", linkDl(), rdynamic() + "-o", "${exe.absolutePath}", linkDl(), linkM(), rdynamic() } } }