Open damiand2 opened 3 days ago
It's a static library, so in your NativeReference item you need to set Kind=Static:
<NativeReference Include="taplinkx.xcframework">
<Kind>Static</Kind>
<SmartLink>True</SmartLink>
<ForceLoad>False</ForceLoad>
</NativeReference>
Can you try that and see if it works for you?
@rolfbjarne - thanks for your answer. Unfortunately after changing to static i get the same errors as when consuming raw static library - 'undefined symbols for architecture arm64'. Attached build log. msbuild.zip
There can be any number of reasons for those failures:
What are the instructions to use this library from an Xcode project?
@rolfbjarne - documentation states "The J2ObjC library is used for converting the Java source code into Objective C, there are some dependency library and header which are to be included in the build settings". I will try to add them to the macos and let you know if this changes anything
hi again @rolfbjarne :)
i managed to install and configure missing dependencies on macos, now when i try to build app i get error:
clang++ exited with code 1: Apple clang version 16.0.0 (clang-1600.0.26.3) Target: arm64-apple-darwin23.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch arm64 -dead_strip -exported_symbols_list obj/Debug/net8.0-ios/ios-arm64/device-builds/iphone14.7-18.0.1/mtouch-symbols.list -force_load C:/Users/xxx/source/repos/MobileFacilityApp/Taplinx.iOS/bin/Debug/net8.0-ios/Taplinx.iOS.resources/taplinkx.xcframework/ios-arm64/libTapLinxLibrary.a -platform_version ios 14.0.0 18.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk -mllvm -enable-linkonceodr-outlining -o /Users/xxx/Library/Caches/Xamarin/mtbs/builds/MobileFacilityApp/4b2d803b751cc60ac63dbbddcfa799750f94e1d224e1ea40cfbb762cddb9f7e0/obj/Debug/net8.0-ios/ios-arm64/nativelibraries/MobileFacilityApp -L/Users/xxx/Projects/j2objc-2.7/lib/ -L/usr/lib/swift -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -framework Security -liconv -licucore -lz -ljre_emul -ljre_util /Users/xxx/Library/Caches/Xamarin/mtbs/builds/MobileFacilityApp/4b2d803b751cc60ac63dbbddcfa799750f94e1d224e1ea40cfbb762cddb9f7e0/obj/Debug/net8.0-ios/ios-arm64/nativelibraries/aot-output/arm64/aot-instances.dll.o /Users/xxx/Library/Caches/Xamarin/mtbs/builds/MobileFacilityApp/4b2d803b751cc60ac63dbbddcfa799750f94e1d224e1ea40cfbb762cddb9f7e0/obj/Debug/net8.0-ios/ios-arm64/nativelibraries/aot-output/arm64/System.Private.CoreLib.dll.o "/Users/xxx/Library/Caches/Xamarin/mtbs/builds/MobileFacilityApp/4b2d803b751cc60ac63dbbddcfa799750f94e1d224e1ea40cfbb762cddb9f7e0/C:/Program Files/dotnet/packs/Microsoft.iOS.Runtime.ios-arm64.net8.0_18.0/18.0.8303/runtimes/ios-arm64/native/libxamarin-dotnet-debug.a" "/Users/xxx/Library/Caches/Xamarin/mtbs/builds/MobileFacilityApp/4b2d803b751cc60ac63dbbddcfa799750f94e1d224e1ea40cfbb762cddb9f7e0/C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.ios-arm64/8.0.10/runtimes/ios-arm64/native/libSystem.Globalization.Native.a" "/Users/xxx/Library/Caches/Xamarin/mtbs/builds/MobileFacilityApp/4b2d803b751cc60ac63dbbddcfa799750f94e1d224e1ea40cfbb762cddb9f7e0/C:/Program Files/dotnet/packs duplicate symbol '_tapLinxLibrary' in: C:/Users/xxx/repos/MobileFacilityApp/Taplinx.iOS/bin/Debug/net8.0-ios/Taplinx.iOS.resources/taplinkx.xcframework/ios-arm64/libTapLinxLibrary.a[16](TL_NTAG_223DNA.o) C:/Users/xxx/source/repos/MobileFacilityApp/Taplinx.iOS/bin/Debug/net8.0-ios/Taplinx.iOS.resources/taplinkx.xcframework/ios-arm64/libTapLinxLibrary.a[14](TL_UltralightAES.o) C:/Users/xxx/source/repos/MobileFacilityApp/Taplinx.iOS/bin/Debug/net8.0-ios/Taplinx.iOS.resources/taplinkx.xcframework/ios-arm64/libTapLinxLibrary.a[3](TL_DESFireEV2.o) C:/Users/xxx/source/repos/MobileFacilityApp/Taplinx.iOS/bin/Debug/net8.0-ios/Taplinx.iOS.resources/taplinkx.xcframework/ios-arm64/libTapLinxLibrary.a[22](TL_NTAG_223DNA_SD.o) C:/Users/xxx/source/repos/MobileFacilityApp/Taplinx.iOS/bin/Debug/net8.0-ios/Taplinx.iOS.resources/taplinkx.xcframework/ios-arm64/libTapLinxLibrary.a[21](TL_DESFireEV3.o) C:/Users/xxx/source/repos/MobileFacilityApp/Taplinx.iOS/bin/Debug/net8.0-ios/Taplinx.iOS.resources/taplinkx.xcframework/ios-arm64/libTapLinxLibrary.a[20](TL_NTAG_224DNA_SD.o) C:/Users/xxx/source/repos/MobileFacilityApp/Taplinx.iOS/bin/Debug/net8.0-ios/Taplinx.iOS.resources/taplinkx.xcframework/ios-arm64/libTapLinxLibrary.a[18](TL_NTAG_224DNA.o) ld: 1 duplicate symbols clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Using nm on libTapLinxLibrary.a and grepping for _tapLinxLibrary i get 7 references: ---------------- D _tapLinxLibrary ---------------- D _tapLinxLibrary ---------------- D _tapLinxLibrary ---------------- D _tapLinxLibrary ---------------- D _tapLinxLibrary ---------------- D _tapLinxLibrary ---------------- D _tapLinxLibrary libTapLinxLibrary.a:MFClassic-5e42ba37eb30d20b01f915d605184521.o: no symbols
Try setting SmartLink=True
and ForceLoad=false
in your NativeReference item:
<NativeReference Include="libTapLinxLibrary.a">
<Kind>Static</Kind>
<SmartLink>True</SmartLink>
<ForceLoad>False</ForceLoad>
<IsCxx>False</IsCxx>
<Frameworks>Security.framework</Frameworks>
<LinkerFlags>-lz -L "/Users/damiandekoszczak/Projects/j2objc-2.7/lib/" -ljre_emul -ljre_util -v</LinkerFlags>
<!--<Frameworks>libiconv.tbd libicucore.tbd libz.tbd Security.framework</Frameworks>-->
<!--<LinkerFlags>-L "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/" -L "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos" -Wl,-rpath -Wl,@executable_path/Frameworks</LinkerFlags>-->
</NativeReference>
Apple platform
iOS
Framework version
net8.0-*
Affected platform version
.NET 8.0.403
Description
Steps to Reproduce
as described in descroption section
Did you find any workaround?
no workaround - when using raw static library with
I get different errors:
and the list goes on...
Build logs
msbuild.zip