From 99316263d5185edf982a90a05270860bc2bab8c9 Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Wed, 5 Jul 2017 11:50:00 +0300 Subject: [PATCH] [samples][csvparser] exclude zopen function on macos for some resons with -O0 build fails with absence of definition zopen function on macos nming /usr/lib shows that there're no libraries defining this symbol, drfined by the way in /usr/include/stdio.h --- .../csvparser/src/main/c_interop/stdio.def | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/samples/csvparser/src/main/c_interop/stdio.def b/samples/csvparser/src/main/c_interop/stdio.def index 9ab64a05ed5..9d3f962a475 100644 --- a/samples/csvparser/src/main/c_interop/stdio.def +++ b/samples/csvparser/src/main/c_interop/stdio.def @@ -1,2 +1,26 @@ headers = stdio.h stdlib.h string.h excludeDependentModules.osx = true + +/** + * TODO: should be fixed in more natural way. + * zopen is Darwin specific function declared in stdio.h, but it seems definition for this function + * disappeared in annals of history. + * This declaration defined under __DARWIN_C_LEVEL >= __DARWIN_C_FULL + * To change __DARWIN_C_LEVEL it's enough to define _ANSI_SOURCE + * > echo "#include " | clang -D_ANSI_SOURCE -dM -xc -E - | grep DARWIN + * #define __DARWIN_C_ANSI 010000L + * #define __DARWIN_C_FULL 900000L + * #define __DARWIN_C_LEVEL __DARWIN_C_ANSI + * But there is an issue in c interop tool [KT-18946]: + * with compilerOpts=-D_ANSI_SOURCE + * :csvparser:genStdioInteropStubsException in thread "main" java.lang.Error: /var/folders/cx/q7hktzd16l59d7g3pqc5ggfr0000gp/T/tmp957622261795996282.c:1:10: fatal error: could not build module 'Darwin' + * at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:131) + * at org.jetbrains.kotlin.native.interop.indexer.ModulesMap.(Utils.kt:381) + * at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.getFilteredHeaders(Utils.kt:466) + * at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:368) + * at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:356) + * at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:34) + * at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processLib(main.kt:397) + * at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.main(main.kt:34) + */ +excludedFunctions.osx = zopen \ No newline at end of file