Build error with iOS 11.4, SDK 0.8


#1

Seeing the following linking errors with SDK 0.8. Project builds fine with SDK 0.7.1, but simply swapping out the framework for SDK 0.8 generates the following errors:

Undefined symbols for architecture x86_64:
“oc::tGwaFqz3::addWeakTracker(std::__1::unique_ptr<oc::Tracker, std::__1::default_deleteoc::Tracker >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, int, oc::t0iAWyGp*, oc::xH1ms5LR*, bool)”, referenced from:
l3694 in Structure
“oc::tGwaFqz3::trajectorySimilarity(std::__1::shared_ptroc::eo1xpH1n const&, std::__1::shared_ptroc::eo1xpH1n const&, double, double)”, referenced from:
l3693 in Structure
“oc::tGwaFqz3::tGwaFqz3(oc::tGwaFqz3::stt09zCX const&)”, referenced from:
l3694 in Structure
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Have followed directions here https://medium.com/@jianshi_94445/setting-up-structure-sdk-in-swift-with-xcode9-for-using-structure-sensor-d93313320db3 with no joy.

Have checked framework with lipo -info and looks like it does gave the correct architecture, so assume it is missing an additional framework somewhere.

Project is Swift 11.3, 4.1


#2

Sorry it has taken me so long to reply. We have noted this issue to our developers and will be addressing this issue as soon as we can, if an easy solution presents itself. Once we do, we will update the Structure SDK on our downloads page, as well on here on the forums.

We appreciate your patience!


#3

Hi @anthony.monaco - any possibility you could make the previous stable build available?
I have only recently purchased a structure sensor, and have no access to a functioning SDK given that 0.8 is broken… your website doesn’t appear to list previous versions.
So, for now… I’m dead in the water…

Thanks,


#4

Sure!

Could you give us a little more details about the issues you have been having, @teg? Details like iOS device used and iOS version would be fantastic. Thanks!


#5

Thanks Anthony - at the moment I havent even gotten a device involved, I just couldnt build at all. Same error as Andy above…


#6

Hmm, well just to let you know, using Swift with our Objective-C based SDK isn’t directly supported in the sense that we aren’t going to directly test our SDK to be used with Swift.

It seems the post you are following has not yet been updated for the Structure SDK 0.8. I would reach directly out to the creator of the Medium post to see if they has any suggestions as to get it to work with the newest version of the SDK.

To clarify my reply to Andy, if there is a simple bug or issue with our SDK that prevents it from being used with Swift 4, we will make a fix.

I would also take a look at the following pages for more information about how the Structure SDK can work with Swift:

Hope this helps!


#7

I’ve been using Swift 4.x since February with both SDK 0.71 & 0.8 and the latest iOS SDK. I see no difference between building an app using Swift or Objective-C. My Swift port on available on github is written for Swift 4.0. It will run on Swift 4.1 but requires about 6 minor changes to get it to compile using Swift 4.1.


#8

After further investigation looks to be something with project build settings and paths to frameworks. Unsure right now exactly which change I made fixed the issue, but something in the Bridging-Header.h and/or in the Target Build Settings.

Have a look at the project linked here, Will there be Structure SDK written in Swift 4?, and take a close look at where yours differs, especially around the Linking section.

In the end I basically recreated the Build Settings from that project in my own, tweaking where I needed to get my project building again. Best guess is it’s be something to do with LD_RUNPATH_SEARCH_PATHS and similar.


#9

Good to hear you got it going. The project https://github.com/n6xej/RRStructureScannerSwift4 is the one I wrote and am still use as the base for my Swift based projects. I think I have the path to the StructureSDK framework set, even thought I don’t include it, so it might have been looking in the wrong place.


#10

I’m currently hitting the same error while trying to integrate the Structure SDK in my app. An interesting variation is that my project isn’t using Swift in any way and is completely written in Objective-C, but makes use of the React Native framework (written in Obj-C and C++). I have tried to tweak the configuration of my XCode project, even directly merged chunks of the pbxproj file from the examples into mine, but I can’t seem to find the right setting to make it build. Could you share more informations on what you had to do to make it work ?


#11

@andy.warwick Could you provide us with an idea of which build settings you had to tweak to get your Swift project to build?


#12

Hi Anthony and others, apologies for delay in replying.

Unsure exactly which settings I tweaked, but best guess is either the LD_RUNPATH_SEARCH_PATHS, the FRAMEWORK_SEARCH_PATHS or the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES.

For reference, Build Settings changed from defaults are:

//:configuration = Debug
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
TARGETED_DEVICE_FAMILY = 2
IPHONEOS_DEPLOYMENT_TARGET = 11.4
OTHER_LDFLAGS = -ObjC -weak_framework RevealServer
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks
INFOPLIST_FILE = Info.plist
INFOPLIST_PREFIX_HEADER = Scripts/Versions/versions.h
INFOPLIST_PREPROCESS = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) $(SRCROOT) $(PROJECT_DIR)/Frameworks
CODE_SIGN_IDENTITY = iPhone Developer
CODE_SIGN_STYLE = Automatic
VERSIONING_SYSTEM = apple-generic
OTHER_CFLAGS = -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) HAS_LIBCXX=1
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage
OTHER_SWIFT_FLAGS = -DDEBUG -Xfrontend -debug-time-function-bodies -Xfrontend -warn-long-function-bodies=300 -Xfrontend -warn-long-expression-type-checking=200 -Xfrontend -debug-time-compilation -Xfrontend -print-stats
SWIFT_OBJC_BRIDGING_HEADER = Core/OurAppName-Bridging-Header.h
SWIFT_VERSION = 4.2

//:configuration = Release
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
TARGETED_DEVICE_FAMILY = 2
IPHONEOS_DEPLOYMENT_TARGET = 11.4
OTHER_LDFLAGS =
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks
INFOPLIST_FILE = Info.plist
INFOPLIST_PREFIX_HEADER = Scripts/Versions/versions.h
INFOPLIST_PREPROCESS = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) $(SRCROOT) $(PROJECT_DIR)/Frameworks
CODE_SIGN_IDENTITY = iPhone Developer
CODE_SIGN_STYLE = Automatic
VERSIONING_SYSTEM = apple-generic
OTHER_CFLAGS =
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) HAS_LIBCXX=1
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage
SWIFT_OBJC_BRIDGING_HEADER = Core/OurAppName-Bridging-Header.h
SWIFT_VERSION = 4.2

The RevealServer mentioned in OTHER_LDFLAGS is another framework, so doubt that has any effect; refers to https://revealapp.com/


#13

Found this link that may help (then again, may not); it’s all still a bit voodoo the whole Framework thing… https://www.mulle-kybernetik.com/weblog/2015/how_to_embed_a_framework_in_a.html


#14

Be sure you are linking libc++, libstdc++ has been deprecated for sometime and was finally removed in Xcode 10


#15

Just checked and am linking libc++, but—from memory—was at some point linking the older libstdc++; perhaps that was the fix?