Metaio App in Unity3D not building from XCode - xcode

I am trying to build an augmented reality app built in Unity3d using the Metaio Unity SDK. The app uses a CAD model as a target upon which it augments stuff. It looks for something like the reference CAD model in the real world and then latches onto that. In XCode, I add, from Libraries, the metaiosdk file (not metaiosdk.framework) to the Link Binaries to Libraries section. I also add the libxml2.dylib framework. When I build, I fail with tons of errors. The errors all claim that "directory not found for option '-L/..." for Metaio framework. When I search "search paths" in Build Settings and delete them all (per this SO answer), I go down to only one error, saying that there is no Metaio Framework. When I add the whole SDK folder to the project and redo the previous steps, including having to delete search paths for libraries and headers again, I then get an error saying that -liPhone-lib library was not found. I reimport that library, following the instructions from this Metaio Helpdesk post, at which point I then re-delete the search paths for libraries and headers (or else I get about 30 errors again). Then when I build I get only one error, saying that "'Unity/GlesHelper.h' was not found." I am at a loss, as Google turns up no results for "GlesHelper.h" (in this context). What am I doing wrong? Does the SDK need to be inside the Unity project and the Unity Project inside the folder of the XCode project? Is it the opposite way around? Do I need to import the example scenes and not just the scene I am using? Thank you for the help!
EDIT: Here is an example of the erros I get before deleting the search Library Paths in Build Settings:
d: warning: directory not found for option
'-L"/Users/capture/Desktop/iMacXC2/Libraries"' Undefined symbols for
architecture armv7:
"_CIDetectorAccuracy", referenced from:
__ZNWwTeFvdBdVkDNRXNPUfEgifAKsRnrNYugVMtgpHhPUMqd in metaiosdk(xhvKRhZZTIhPZZYtqieHqfH) "_OBJC_CLASS_$_CIDetector",
referenced from:
objc-class-ref in metaiosdk(xhvKRhZZTIhPZZYtqieHqfH) "_kSecReturnRef", referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_CIDetectorAccuracyLow",
referenced from:
__ZNWwTeFvdBdVkDNRXNPUfEgifAKsRnrNYugVMtgpHhPUMqd in metaiosdk(xhvKRhZZTIhPZZYtqieHqfH) "_kSecMatchPolicy", referenced
from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_kSecMatchLimitOne",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_kSecMatchLimit", referenced
from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_kSecClass", referenced
from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLWrite", referenced from:
_darwinssl_send in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLGetBufferedReadSize", referenced from:
_Curl_darwinssl_data_pending in metaiosdk(libcurl_la-curl_darwinssl.o) "_kSecClassIdentity",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLClose", referenced from:
_Curl_darwinssl_close in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLSetSessionOption",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o)
"_SSLGetNumberSupportedCiphers", referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLCreateContext",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLSetProtocolVersionMax",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SecItemCopyMatching",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o)
"_SSLGetNegotiatedProtocolVersion", referenced from:
_darwinssl_connect_step2 in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLSetProtocolVersionMin",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLGetSessionState",
referenced from:
_Curl_darwinssl_check_cxn in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLSetEnabledCiphers",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SecPolicyCreateSSL",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o)
"_SecIdentityCopyCertificate", referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLSetPeerID", referenced
from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLGetNegotiatedCipher",
referenced from:
_darwinssl_connect_step2 in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLSetPeerDomainName",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLRead", referenced from:
_darwinssl_recv in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLSetIOFuncs", referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLHandshake", referenced
from:
_darwinssl_connect_step2 in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLCopyPeerTrust",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLGetSupportedCiphers",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o)
"_SecCertificateCopySubjectSummary", referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_SSLSetConnection",
referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) "_CIDetectorTypeFace",
referenced from:
__ZNWwTeFvdBdVkDNRXNPUfEgifAKsRnrNYugVMtgpHhPUMqd in metaiosdk(xhvKRhZZTIhPZZYtqieHqfH) "_SSLSetCertificate", referenced
from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o)
"_SecTrustGetCertificateCount", referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o)
"_SecTrustGetCertificateAtIndex", referenced from:
_darwinssl_connect_common in metaiosdk(libcurl_la-curl_darwinssl.o) ld: symbol(s) not found for
architecture armv7 clang: error: linker command failed with exit code
1 (use -v to see invocation)
And then after I delete the Library Search Paths, I get this:
Ld
/Users/capture/Library/Developer/Xcode/DerivedData/Unity-iPhone-glogufgfblmcyzasljopkkqcjtso/Build/Products/iMac.app/iMac
normal armv7
cd /Users/capture/Desktop/iMacXC2
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
-L/Users/capture/Library/Developer/Xcode/DerivedData/Unity-iPhone-glogufgfblmcyzasljopkkqcjtso/Build/Products
-F/Users/capture/Library/Developer/Xcode/DerivedData/Unity-iPhone-glogufgfblmcyzasljopkkqcjtso/Build/Products
-filelist /Users/capture/Library/Developer/Xcode/DerivedData/Unity-iPhone-glogufgfblmcyzasljopkkqcjtso/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/iMac.LinkFileList
-dead_strip -weak_framework CoreMotion -weak-lSystem -stdlib=libstdc++ -fobjc-link-runtime -miphoneos-version-min=7.1 /Users/capture/Desktop/iMacXC2/Libraries/metaiosdk -lxml2 -framework
Foundation -framework UIKit -framework OpenGLES -framework QuartzCore
-framework OpenAL -liconv.2 -liPhone-lib -framework AudioToolbox -framework CFNetwork -framework MediaPlayer -framework CoreLocation -framework SystemConfiguration -weak_framework iAd -framework CoreMedia -framework CoreVideo -weak_framework AVFoundation -framework
CoreGraphics -weak_framework CoreMotion -weak_framework GameKit
-Xlinker -dependency_info -Xlinker /Users/capture/Library/Developer/Xcode/DerivedData/Unity-iPhone-glogufgfblmcyzasljopkkqcjtso/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/iMac_dependency_info.dat
-o /Users/capture/Library/Developer/Xcode/DerivedData/Unity-iPhone-glogufgfblmcyzasljopkkqcjtso/Build/Products/iMac.app/iMac
ld: library not found for -liPhone-lib clang: error: linker command
failed with exit code 1 (use -v to see invocation)
And after I re-import the missing library, I just continue on that pattern of get errors for Library Search Paths, have to reimport Library, repeat, over and over, until reaching the above image where I need Unity/GlesHelper.h, at which point I am at a loss.

You are right, you do need Unity Pro, but it looks like you missed some steps from the Metaio Getting Started with Unity page. You need to drag in the metaioSDK as you have done, but you also need to add frameworks for:
libc++.dylib
libxml2.2.dylib (you did this one)
Security.framework
CoreImage.framework (SDK 5.5 and newer)

Metaio requires a Unity pro license because it is a plugin, and it will fail to launch without said license. I was attempting to compile without a license. (Lesson learned)

Related

Linking error when building OpenGL app on Mac with command line

I am new to building command line on Mac. While working on a cross-platform app using OpenGL, IMGui, and GLFW, I keep getting linking errors:
Undefined symbols for architecture x86_64:
"__glfwCreateContextEGL", referenced from:
__glfwPlatformCreateWindow in libGLFW.a(cocoa_window.o)
"__glfwCreateContextNSGL", referenced from:
__glfwPlatformCreateWindow in libGLFW.a(cocoa_window.o)
"__glfwCreateContextOSMesa", referenced from:
__glfwPlatformCreateWindow in libGLFW.a(cocoa_window.o)
"__glfwInitEGL", referenced from:
__glfwPlatformCreateWindow in libGLFW.a(cocoa_window.o)
"__glfwInitNSGL", referenced from:
__glfwPlatformCreateWindow in libGLFW.a(cocoa_window.o)
"__glfwInitOSMesa", referenced from:
__glfwPlatformCreateWindow in libGLFW.a(cocoa_window.o)
"__glfwPlatformCreateMutex", referenced from:
_glfwInit in libGLFW.a(init.o)
"__glfwPlatformCreateTls", referenced from:
_glfwInit in libGLFW.a(init.o)
"__glfwPlatformDestroyMutex", referenced from:
_terminate in libGLFW.a(init.o)
"__glfwPlatformDestroyTls", referenced from:
_terminate in libGLFW.a(init.o)
"__glfwPlatformGetTls", referenced from:
_glfwDestroyWindow in libGLFW.a(window.o)
__glfwRefreshContextAttribs in libGLFW.a(context.o)
_glfwMakeContextCurrent in libGLFW.a(context.o)
_glfwExtensionSupported in libGLFW.a(context.o)
_glfwGetCurrentContext in libGLFW.a(context.o)
_glfwSwapInterval in libGLFW.a(context.o)
_glfwGetProcAddress in libGLFW.a(context.o)
...
"__glfwPlatformLockMutex", referenced from:
__glfwInputError in libGLFW.a(init.o)
"__glfwPlatformSetTls", referenced from:
__glfwInputError in libGLFW.a(init.o)
_glfwInit in libGLFW.a(init.o)
"__glfwPlatformUnlockMutex", referenced from:
__glfwInputError in libGLFW.a(init.o)
"__glfwTerminateNSGL", referenced from:
__glfwPlatformTerminate in libGLFW.a(cocoa_init.o)
"__glfwUpdateDisplayLinkDisplayNSGL", referenced from:
-[GLFWWindowDelegate windowDidChangeScreen:] in libGLFW.a(cocoa_window.o)
I am linking to the Cocoa, CoreVideo, and IOKit frameworks. Any idea what I'm missing?
Hello might have found your error while doing something similar you forgot to link it to a few libs that are required...
"g++ -o test main.c libGLEW.a libglfw3.a -framework opengl -framework Cocoa -framework IOKit"
source: https://web.eecs.umich.edu/~sugih/courses/eecs487/glfw-howto/
I had a similar issue to you when trying to build GLFW on my own. It seems as though when building GLFW you're not including all files needed.
The following macOS-specific files are needed in the current version of GLFW when building:
src/cocoa_init.m
src/cocoa_joystick.m
src/cocoa_monitor.m
src/cocoa_window.m
src/cocoa_time.c
src/posix_thread.c
src/nsgl_context.m
src/egl_context.c
src/osmesa_context.c
src/posix_module.c
For you specifically, make sure egl_context.c,
nsgl_context.m, and
posix_thread.c are included.

Linking error - Undefined symbols for architecture x86_64 on OSX

The following is returned when trying to compile part of a project under OSX:
gcc -g -pipe -L/Projects/export buf_test.o buf.o -framework CoreFoundation -o buf_test
Undefined symbols for architecture x86_64:
"___assert_rtn", referenced from:
_init in buf.o
_get in buf.o
_put in buf.o
"___sprintf_chk", referenced from:
_test in buf_test.o
"___strcpy_chk", referenced from:
_test_data_copy in buf_test.o
___inline_strcpy_chk in buf_test.o
"_exit", referenced from:
start in crt1.10.6.o
"_printf", referenced from:
_test in buf_test.o
"_puts", referenced from:
_test in buf_test.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Help would be much appreciated!
Turns out it was a library naming conflict with the standard libraries -- I had a library called libSystem.a in /Projects/export which was masking libSystem.dylib from being found.

Linking glib in XCode

I have a strange issue, that may be obvious, but is really not clear for me at the moment :
I'm making a Quartz Composer plugin.
I have an XCode workspace based which includes a custom library. This library is compiling the poly2tri-c delaunay triangulation library, which is linking against glib.
I have no trouble with compiling my library, but the plugin itself doesn't want to compile and throw these errors :
Undefined symbols for architecture i386:
"p2t_cdt_new(_GPtrArray*)", referenced from:
-[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] in libhOzVector.a(hOzPolygons.o)
"p2t_cdt_free(CDT_)", referenced from:
-[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] in libhOzVector.a(hOzPolygons.o)
"p2t_point_new_dd(double, double)", referenced from:
-[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] in libhOzVector.a(hOzPolygons.o)
"p2t_cdt_triangulate(CDT_)", referenced from:
-[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] in libhOzVector.a(hOzPolygons.o)
"p2t_cdt_get_triangles(CDT_)", referenced from:
-[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] in libhOzVector.a(hOzPolygons.o)
"p2t_triangle_get_point(_P2tTriangle, int)", referenced from:
-[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] in libhOzVector.a(hOzPolygons.o)
"_g_ptr_array_add", referenced from:
-[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] in libhOzVector.a(hOzPolygons.o)
"_g_ptr_array_new", referenced from:
-[hOzPolygon2D triangulationWithRefineSteps:holes:steinerPoints:] in libhOzVector.a(hOzPolygons.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Here is the pic of the compiler messages :
And of my links :
I usually have these messages when I forget to link against a lib, but here I'm linking against glib in the library itself and in the plugin project.
Any ideas on what's wrong ?
Thank you !
Well, after some "esoteric" research, I finally found what was wrong : XCode was just not automatically including the c files in the target membership...

Undefined Symbols when trying to compile RtAudio

I'm trying to use RtAudio and RtMidi together. I have in the same folder RtAudio.cpp, RtAudio.h, RtHelper.h, RtMidi.cpp and RtMidi.h as well as 2 test programs, midiprobe.cpp and audioprobe.cpp.
Compiling midiprobe with the default command works, but when I try to do the same for audioprobe to test RtAudio, I get the errors.
Here is what I use to compile:
g++ -Wall -D__MACOSX_CORE__ -o audioprobe audioprobe.cpp RtAudio.cpp -framework CoreAudio -lpthread
And these are the errors:
Undefined symbols for architecture x86_64:
"_CFRelease", referenced from:
RtApiCore::getDeviceInfo(unsigned int)in cc89M9Ki.o
"_CFStringGetCString", referenced from:
RtApiCore::getDeviceInfo(unsigned int)in cc89M9Ki.o
"_CFStringGetLength", referenced from:
RtApiCore::getDeviceInfo(unsigned int)in cc89M9Ki.o
"_CFStringGetSystemEncoding", referenced from:
RtApiCore::getDeviceInfo(unsigned int)in cc89M9Ki.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
I'm quite new to this sort of stuff (mostly had frameworks ready-made till now) and haven't been able to figure this out yet. Since it's the default example, I'm really lost as to what to do next...
Thanks in advanced.
The missing symbols are in the CoreFoundation framework - you need to add:
-framework CoreFoundation
to your command line.

trying to compile vlc for iphone5 (ios6 , armv7 armv7s, iphoneos6.0) , got this error

Ld
build/MobileVLC.build/Release-iphoneos/MobileVLC.build/Objects-normal/armv7s/VLC
normal armv7s
cd /Users/looneydoodle/projects/MobileVLC
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/opt/local/bin:/opt/local/sbin:/Users/looneydoodle/.rbenv/shims:/Users/looneydoodle/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin"
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2
-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk
-L/Users/looneydoodle/projects/MobileVLC/build/Release-iphoneos -L/Users/looneydoodle/projects/MobileVLC/External/MobileVLCKit -L/Users/looneydoodle/projects/MobileVLC/External/MediaLibraryKit -F/Users/looneydoodle/projects/MobileVLC/build/Release-iphoneos -filelist /Users/looneydoodle/projects/MobileVLC/build/MobileVLC.build/Release-iphoneos/MobileVLC.build/Objects-normal/armv7s/VLC.LinkFileList
-dead_strip -Wl,-no_pie -miphoneos-version-min=6.0 -framework Foundation -framework UIKit -framework CoreGraphics -framework
OpenGLES -framework AudioToolbox -framework QuartzCore -liconv -lz
/Users/looneydoodle/projects/MobileVLC/ImportedSources/VLCKit/build/Release-iphoneos/libMobileVLCKit.a
/Users/looneydoodle/projects/MobileVLC/ImportedSources/MediaLibraryKit/build/Release-iphoneos/libMobileMediaLibraryKit.a
-lsqlite3 -lstdc++.6 -lbz2 -lxml2 -framework CoreData -framework CoreText -framework MediaPlayer -o
/Users/looneydoodle/projects/MobileVLC/build/MobileVLC.build/Release-iphoneos/MobileVLC.build/Objects-normal/armv7s/VLC
ld: warning: ignoring file
/Users/looneydoodle/projects/MobileVLC/ImportedSources/VLCKit/build/Release-iphoneos/libMobileVLCKit.a,
file was built for archive which is not the architecture being linked
(armv7s):
/Users/looneydoodle/projects/MobileVLC/ImportedSources/VLCKit/build/Release-iphoneos/libMobileVLCKit.a
Undefined symbols for architecture armv7s:
"_VLCMediaTracksInformationType", referenced from:
-[MLParsingOperation mediaDidFinishParsing:] in libMobileMediaLibraryKit.a(MLFileParserQueue.o)
"_VLCMediaTracksInformationVideoWidth", referenced from:
-[MLParsingOperation mediaDidFinishParsing:] in libMobileMediaLibraryKit.a(MLFileParserQueue.o)
"_VLCMediaTracksInformationVideoHeight", referenced from:
-[MLParsingOperation mediaDidFinishParsing:] in libMobileMediaLibraryKit.a(MLFileParserQueue.o)
"_OBJC_CLASS_$_VLCMedia", referenced from:
objc-class-ref in MVLCMovieViewController.o
objc-class-ref in libMobileMediaLibraryKit.a(MLFileParserQueue.o)
objc-class-ref in libMobileMediaLibraryKit.a(MLThumbnailerQueue.o)
"_OBJC_CLASS_$_VLCMediaPlayer", referenced from:
objc-class-ref in MVLCMovieViewController.o "_VLCMediaTracksInformationAudioChannelsNumber", referenced from:
-[MLParsingOperation mediaDidFinishParsing:] in libMobileMediaLibraryKit.a(MLFileParserQueue.o)
"_VLCMediaTracksInformationAudioRate", referenced from:
-[MLParsingOperation mediaDidFinishParsing:] in libMobileMediaLibraryKit.a(MLFileParserQueue.o)
"_VLCMediaTracksInformationTypeAudio", referenced from:
-[MLParsingOperation mediaDidFinishParsing:] in libMobileMediaLibraryKit.a(MLFileParserQueue.o)
"_OBJC_CLASS_$_VLCMediaThumbnailer", referenced from:
objc-class-ref in libMobileMediaLibraryKit.a(MLThumbnailerQueue.o)
"_OBJC_CLASS_$_VLCTime", referenced from:
objc-class-ref in MVLCMovieGridViewCell.o
objc-class-ref in MVLCMovieTableViewCell.o "_VLCMediaTracksInformationTypeVideo", referenced from:
-[MLParsingOperation mediaDidFinishParsing:] in libMobileMediaLibraryKit.a(MLFileParserQueue.o) ld: symbol(s) not
found for architecture armv7s collect2: ld returned 1 exit status
** BUILD FAILED **
The following build commands failed: Ld
build/MobileVLC.build/Release-iphoneos/MobileVLC.build/Objects-normal/armv7s/VLC
normal armv7s (1 failure)
Any idea how to compile the MobileVLCKit to armv7 ?

Resources