```> Task :linkDebugExecutableNative FAILED e: ...
# kotlin-native
m
Copy code
> Task :linkDebugExecutableNative FAILED
e: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld invocation reported errors

The /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld command returned non-zero exit code: 1.
output:
Undefined symbols for architecture x86_64:
  "_icalcomponent_new", referenced from:
      _libical_icalcomponent_new_wrapper836 in result.o
ld: symbol(s) not found for architecture x86_64

Execution failed for task ':linkDebugExecutableNative'.
> 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.
Currently trying to work with the libical library but when I try to use a function I constantly get an error that symbols are not defined. My ide knows these functions (I don’t 😅). I am starting to get a feeling these things are still too advanced for beginners. someone have a clue how I can fix it?
l
What linker flags are you using?
Can you post the def file?
m
Copy code
headers=/Users/maarten2000ha/Documents/Programming/Calendar/kotlin-native-Ical/src/nativeInterop/cinterop/libical/ical.h
headerFilter=/Users/maarten2000ha/Documents/Programming/Calendar/kotlin-native-Ical/src/nativeInterop/cinterop/libical/*
I dragged the .h files in a folder in the project. I have no clue how to make it dynamic to make it prettier and work on other machines. first time trying this out
l
The headers just tell Kotlin to expect some symbols. You need to also link against a binary to get the objects.
Either link against libical.a or libical.so depending on whether you want static or dynamic linking.
How do you plan to distribute this? Is it a library or final app? That will likely influence how you link.
m
The folder only has .h files, I have no clue how I can get the other files as well 😔.
I want to create some kind of library in kotlin native to work with ics standards. After I can use it in some app I want to create for myself.
l
Will this be mac only or iOS too?
m
probably all os’s, mac, linux, ios, android, windows.
l
In that case, I’d create a prebuilts folder in your project. Next create subfolders for headers, iosX64, iosArm64, macosArm64, etc. and put a precompiled binary in each.
You have a choice of static or dynamic linking (.a or .so). If you can use it, static linking is easy since it builds the binary into your binary.
h
do you use a m1 (arm) processor?
m
mac m1 yes
can’t I just copy the dylibs to a folder and use those to link. hopefully they will work for multiple systems.
h
then I guess, you only installed the arm version of libical and not the x64 version
l
You need separate binaries for each os/arch pair.