Ben Lancaster
05/18/2021, 2:31 PMMyProject
├── Library
├── Library-common
├── Library-submodule
└── Library-submodule-with-cinterops # has a cinterop def for a native dependency, let's call it Foo
The idea is that Library depends on Library-submodule
and Library-submodule-with-cinterops
, both of which depend on Library-common
. All is working fine, with the exception of the Library-submodule-with-cinterops
. I can build that module in isolation, which generates the .aar, .framework files, and .klibs, but when I build Library
, the linker fails with the following:
The /Applications/Xcode <http://11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld> command returned non-zero exit code: 1.
output:
ld: framework not found Foo
I’m not sure why -framework Foo
is being added to the ld
command (executed as part of :Library:linkReleaseFrameworkApple
), I’m guessing I need to tell the linker where to find it, but I’m not sure how to go about it. Does anyone have any pointers for how I might fix it?Ben Lancaster
05/19/2021, 11:17 AMLibrary-submodule-with-cinterops
is defined as a dependency of commonMain
like so:
api project(":Libary-submodule-with-cinterops")
If I add the following to the framework
options in `Library/build.gradle`:
export project(':Libary-submodule-with-cinterops')
I get the following output during :Library:linkDebugFrameworkApple
(snipped for brevity):
> Task :Library:linkDebugFrameworkApple FAILED
w: Following libraries are specified to be exported with -Xexport-library, but not included to the build:
/path/to/MyProject/Library-submodule-with-cinterops/build/libs/apple/main/Library-submodule-with-cinterops-cinterop-Foo.klib
Included libraries:
<-- snip -->
/path/to/MyProject/Library-submodule-with-cinterops/build/classes/kotlin/apple/main/Library-submodule-with-cinterops.klib
/path/to/MyProject/Library-submodule-with-cinterops/build/classes/kotlin/apple/main/Library-submodule-with-cinterops-cinterop-Foo.klib
<-- snip -->
e: /Applications/Xcode <http://11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld> invocation reported errors
The /Applications/Xcode <http://11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld|11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld> command returned non-zero exit code: 1.
output:
ld: framework not found Foo