using levmar libraries on MacOS Mojave 10.14.2 results in compilation error - g++

I would like to use the levmar libraries on MacOS X Mojave. In order to compile the libraries I had to first compile the f2c libraries which goes without an error and then use that for the compilation of levmar libraries via cmake. All these compile without an error and also the crerated example demo program 'lmdemo' actually runs.
However when I try to compile the expfit.c example (which comes with the levmar download) using g++ I get an error:
Undefined symbols for architecture x86_64: "dgemm", referenced
from:
_dlevmar_trans_mat_mat_mult in liblevmar.a(misc.c.o) "dgeqrf", referenced from:
_dAx_eq_b_QR in liblevmar.a(Axb.c.o)
_dAx_eq_b_QRLS in liblevmar.a(Axb.c.o) "dgesvd", referenced from:
_dAx_eq_b_SVD in liblevmar.a(Axb.c.o)
_dlevmar_pseudoinverse in liblevmar.a(misc.c.o) "dgetrf", referenced from:
_dAx_eq_b_LU in liblevmar.a(Axb.c.o) "dgetrs", referenced from:
_dAx_eq_b_LU in liblevmar.a(Axb.c.o) "dorgqr", referenced from:
_dAx_eq_b_QR in liblevmar.a(Axb.c.o) "dpotf2", referenced from:
_dlevmar_chol in liblevmar.a(misc.c.o) "dpotrf", referenced from:
_dAx_eq_b_Chol in liblevmar.a(Axb.c.o) "dpotrs", referenced from:
_dAx_eq_b_Chol in liblevmar.a(Axb.c.o) "dsytrf", referenced from:
_dAx_eq_b_BK in liblevmar.a(Axb.c.o) "dsytrs", referenced from:
_dAx_eq_b_BK in liblevmar.a(Axb.c.o) "dtrtrs", referenced from:
_dAx_eq_b_QR in liblevmar.a(Axb.c.o)
_dAx_eq_b_QRLS in liblevmar.a(Axb.c.o) "sgemm", referenced from:
_slevmar_trans_mat_mat_mult in liblevmar.a(misc.c.o) "sgeqrf", referenced from:
_sAx_eq_b_QR in liblevmar.a(Axb.c.o)
_sAx_eq_b_QRLS in liblevmar.a(Axb.c.o) "sgesvd", referenced from:
_sAx_eq_b_SVD in liblevmar.a(Axb.c.o)
_slevmar_pseudoinverse in liblevmar.a(misc.c.o) "sgetrf", referenced from:
_sAx_eq_b_LU in liblevmar.a(Axb.c.o) "sgetrs", referenced from:
_sAx_eq_b_LU in liblevmar.a(Axb.c.o) "sorgqr", referenced from:
_sAx_eq_b_QR in liblevmar.a(Axb.c.o) "spotf2", referenced from:
_slevmar_chol in liblevmar.a(misc.c.o) "spotrf", referenced from:
_sAx_eq_b_Chol in liblevmar.a(Axb.c.o) "spotrs", referenced from:
_sAx_eq_b_Chol in liblevmar.a(Axb.c.o) "ssytrf", referenced from:
_sAx_eq_b_BK in liblevmar.a(Axb.c.o) "ssytrs", referenced from:
_sAx_eq_b_BK in liblevmar.a(Axb.c.o) "strtrs", referenced from:
_sAx_eq_b_QR in liblevmar.a(Axb.c.o)
_sAx_eq_b_QRLS in liblevmar.a(Axb.c.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit
code 1 (use -v to see invocation)
These seems to be coming from BLAS/LAPACK routine arent they? How come the 'lmdemo' example runs well?
g++ compiler gives this reult for the -v option:
Configured with:
--prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target:
x86_64-apple-darwin18.2.0 Thread model: posix InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
googleing the problem and use the solution of xcode-select --install did not resolve the problem.
Can anyone help me please?
Thanks
Z

Ok, so it seems that it is not enough to link the levmar (-llevmar) libraries when compiling but also the BLAS and LAPACK libraries (-lblas -llapack). After adding these links the example expfit.c compiles and runs as intended. I am n ot sure I understand this since the program expfit.c does not directly use any blas or lapack routines only levmar does. Does this mean levmar was compiled without blas or lapack? Hmmm...

Related

Can't build GCM with Protobuf in Xcode

Recently I've decided to integrate GCM to my project that already uses Google Protocol Buffers. Everything worked fine, sample was OK. But when I've tried to integrate GCM via CocoaPods to my project - I started receiving build errors:
Undefined symbols for architecture x86_64:
"_GSDK_PBLogicalRightShift32", referenced from:
_SerializedSize in libGcmLib.a(GCMSecureSocket.o)
"_OBJC_CLASS_$_GSDK_PBCodedOutputStream", referenced from:
objc-class-ref in libGcmLib.a(GCMSecureSocket.o)
"_OBJC_CLASS_$_GSDK_PBDescriptor", referenced from:
objc-class-ref in libGcmLib.a(GtalkCore.pb.o)
objc-class-ref in libGcmLib.a(GtalkExtensions.pb.o)
"_OBJC_CLASS_$_GSDK_PBGeneratedMessage", referenced from:
_OBJC_CLASS_$_GtalkHeartbeatPing in libGcmLib.a(GtalkCore.pb.o)
_OBJC_CLASS_$_GtalkHeartbeatAck in libGcmLib.a(GtalkCore.pb.o)
_OBJC_CLASS_$_GtalkErrorInfo in libGcmLib.a(GtalkCore.pb.o)
_OBJC_CLASS_$_GtalkSetting in libGcmLib.a(GtalkCore.pb.o)
_OBJC_CLASS_$_GtalkLoginRequest in libGcmLib.a(GtalkCore.pb.o)
_OBJC_CLASS_$_GtalkLoginResponse in libGcmLib.a(GtalkCore.pb.o)
_OBJC_CLASS_$_GtalkClose in libGcmLib.a(GtalkCore.pb.o)
...
"_OBJC_CLASS_$_GSDK_PBRootObject", referenced from:
_OBJC_CLASS_$_GtalkGtalkCoreRoot in libGcmLib.a(GtalkCore.pb.o)
_OBJC_CLASS_$_GtalkGtalkExtensionsRoot in libGcmLib.a(GtalkExtensions.pb.o)
"_OBJC_METACLASS_$_GSDK_PBGeneratedMessage", referenced from:
_OBJC_METACLASS_$_GtalkHeartbeatPing in libGcmLib.a(GtalkCore.pb.o)
_OBJC_METACLASS_$_GtalkHeartbeatAck in libGcmLib.a(GtalkCore.pb.o)
_OBJC_METACLASS_$_GtalkErrorInfo in libGcmLib.a(GtalkCore.pb.o)
_OBJC_METACLASS_$_GtalkSetting in libGcmLib.a(GtalkCore.pb.o)
_OBJC_METACLASS_$_GtalkLoginRequest in libGcmLib.a(GtalkCore.pb.o)
_OBJC_METACLASS_$_GtalkLoginResponse in libGcmLib.a(GtalkCore.pb.o)
_OBJC_METACLASS_$_GtalkClose in libGcmLib.a(GtalkCore.pb.o)
...
"_OBJC_METACLASS_$_GSDK_PBRootObject", referenced from:
_OBJC_METACLASS_$_GtalkGtalkCoreRoot in libGcmLib.a(GtalkCore.pb.o)
_OBJC_METACLASS_$_GtalkGtalkExtensionsRoot in libGcmLib.a(GtalkExtensions.pb.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I've assumed that this is because GCM library has ProtocolBuffers in it and it is conflicting with my Protobuf sources that I've got from here:
https://github.com/google/protobuf/tree/master/objectivec
I've also tried to build for the device and as a result receive similar error - with armv7 instead of x86_64. Also I must say, that sample project works fine, so I think that Protobuf is that main issue here.
Still, I have no idea how this could be resolved. Any thoughts?
Check if the architecture of libGcmLib.a and your target build architecture are the same.
You can check the architecture of .a file with command
otool -hv libGcmLib.a
Apprarently following objects are not built against x86_64 architecture.
GCMSecureSocket.o
GtalkCore.pb.o
...
How do you build libGcmLib.a static lib ? Review it.

Issues with MailCore2 and Undefined symbols for arm64

I have integrated MailCore2 into my Project as described on the projects gitHub-Page. I've done so using PODS and followed all their instructions regarding Standard C++ Compiler Settings, additional Linker-Flags etc.
While building for the actual device (not simulator) I get
Undefined symbols for architecture arm64:
"_res_9_ns_initparse", referenced from:
mailcore::MXRecordResolverOperation::main() in libMailCore-ios.a(MCMXRecordResolverOperation.o)
"_res_9_search", referenced from:
mailcore::MXRecordResolverOperation::main() in libMailCore-ios.a(MCMXRecordResolverOperation.o)
"_res_9_ns_parserr", referenced from:
mailcore::MXRecordResolverOperation::main() in libMailCore-ios.a(MCMXRecordResolverOperation.o)
"_res_9_ns_sprintrr", referenced from:
mailcore::MXRecordResolverOperation::main() in libMailCore-ios.a(MCMXRecordResolverOperation.o)
"_res_9_dn_expand", referenced from:
mailcore::MXRecordResolverOperation::main() in libMailCore-ios.a(MCMXRecordResolverOperation.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help, idea, hint or tipp is greatly appreciated!
We need to change the documentation of MailCore2 to match it.
You need to link with -lresolv (add it to "Other Flags" in the build settings).

Using Parse and Google Maps in the same app - conflict at linker flags -- iOS 7.1, Xcode 5.1

I have an app where first time I used PARSE. Then for second update, client requested GoogleMaps . When setup GMS, it said: " Choose your project, rather than a specific target, and open the Build Settings tab. In the Other Linker Flags section, add -ObjC. If these settings are not visible, change the filter in the Build Settings bar from Basic to All. "
If I set -ObjC to linker flags, I have this kind of errors from parse:
Undefined symbols for architecture i386: "_FBTokenInformationExpirationDateKey", referenced from:
-[PFFacebookTokenCachingStrategy cacheTokenInformation:] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy expirationDate] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy setExpirationDate:] in Parse(PFFacebookTokenCachingStrategy.o)
"_FBTokenInformationTokenKey", referenced from:
-[PFFacebookTokenCachingStrategy accessToken] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy setAccessToken:] in Parse(PFFacebookTokenCachingStrategy.o)
"_FBTokenInformationUserFBIDKey", referenced from:
-[PFFacebookTokenCachingStrategy facebookId] in Parse(PFFacebookTokenCachingStrategy.o)
-[PFFacebookTokenCachingStrategy setFacebookId:] in Parse(PFFacebookTokenCachingStrategy.o)
"OBJC_CLASS$_FBAppCall", referenced from:
objc-class-ref in Parse(PFFacebookAuthenticationProvider.o)
"OBJC_CLASS$_FBRequest", referenced from:
objc-class-ref in Parse(PFFacebookAuthenticationProvider.o)
"OBJC_CLASS$_FBSession", referenced from:
objc-class-ref in Parse(PFFacebookAuthenticationProvider.o)
"OBJC_CLASS$_FBSessionTokenCachingStrategy", referenced from:
_OBJC_CLASS_$_PFFacebookTokenCachingStrategy in Parse(PFFacebookTokenCachingStrategy.o)
"OBJC_METACLASS$_FBSessionTokenCachingStrategy", referenced from:
_OBJC_METACLASS_$_PFFacebookTokenCachingStrategy in Parse(PFFacebookTokenCachingStrategy.o)
ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I found a solution to do not add Facebook in app and to use this kind of flag: -force_load
And after using this, I have also error: ld: file not found: clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried different types of using this, like : -force_load - the same error -force_load pathOfFramework/ - the same error
It is possible to give me a solution for this ?
Thanks a lot !
The problem is that parse has classes that it doesn't load if it doesn't need. For example, it only imports the Facebook classes if FacebookSDK is installed. -ObjC loads all of these, but they are dependent on FacebookSDK. When it can't find the files it needs, it throws errors:
Change:
-ObjC
To:
-force_load $(PROJECT_DIR)/GoogleMaps.framework/GoogleMaps
Source: Here

Problems with adding inmobi SDK to my iOS project

I am using adMob mediation as my banner provider and it woks just fine. Now I want to add inmobi to the mediation and are following instructions but when trying building to my iPhone I get these errors?
Undefined symbols for architecture armv7:
"_SecPolicyCreateBasicX509", referenced from:
_getIMPublicKeyWithCert in libInMobiCommons-3.6.5.a(IMCommonUtilPrivate.o)
"_SecTrustCreateWithCertificates", referenced from:
_getIMPublicKeyWithCert in libInMobiCommons-3.6.5.a(IMCommonUtilPrivate.o)
"_SecTrustCopyPublicKey", referenced from:
_getIMPublicKeyWithCert in libInMobiCommons-3.6.5.a(IMCommonUtilPrivate.o)
"_SecKeyGetBlockSize", referenced from:
-[IMCommonUtil EncodeRSA:publicKey:] in libInMobiCommons-3.6.5.a(IMCommonUtilPrivate.o)
"_SecCertificateCreateWithData", referenced from:
_getIMPublicKeyWithCert in libInMobiCommons-3.6.5.a(IMCommonUtilPrivate.o)
"_SecKeyEncrypt", referenced from:
-[IMCommonUtil EncodeRSA:publicKey:] in libInMobiCommons-3.6.5.a(IMCommonUtilPrivate.o)
"_SecTrustEvaluate", referenced from:
_getIMPublicKeyWithCert in libInMobiCommons-3.6.5.a(IMCommonUtilPrivate.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have added the libAdapterInMobi.a to the "Linked frameworks and Libraries" and added the SDK in a folder called inMobi. I can't figure out what I am doing wrong, so if anyone can tell me or guide me I would be the happiest man alive! ;-)
Thanks in advance.
Have you added all the correct frameworks outlined at http://developer.inmobi.com/wiki/index.php?title=IOS.
It looks like you might not have linked the Security framework specifically?

Objective C Video Player lots of errors

So On the simulator It works all perfect. No errors, nothing
Now I want to put it on my iPod and I get some unknow errors and I dont't know how to fix them.
-I have the MediaPlayer.framework and it is included in my build
Here is the error:
ld: warning: ignoring file /Users/NAME/Desktop/XCode/PROJECT/MediaPlayer.framework/MediaPlayer, file was built for unsupported file format which is not the architecture being linked (armv7)
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_MPMoviePlayerViewController", referenced from:
objc-class-ref in MoviePlayViewController.o
"_MPMoviePlayerDidEnterFullscreenNotification", referenced from:
-[MoviePlayViewController viewDidLoad] in MoviePlayViewController.o
"_MPMoviePlayerWillExitFullscreenNotification", referenced from:
-[MoviePlayViewController viewDidLoad] in MoviePlayViewController.o
"_MPMoviePlayerPlaybackDidFinishNotification", referenced from:
-[MoviePlayViewController viewDidLoad] in MoviePlayViewController.o
"_MPMoviePlayerPlaybackDidFinishReasonUserInfoKey", referenced from:
-[MoviePlayViewController playbackFinished:] in MoviePlayViewController.o
"_MPMoviePlayerWillEnterFullscreenNotification", referenced from:
-[MoviePlayViewController viewDidLoad] in MoviePlayViewController.o
"_MPMoviePlayerDidExitFullscreenNotification", referenced from:
-[MoviePlayViewController viewDidLoad] in MoviePlayViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anyone tell me what the error means and what I have to check? :)
Thanks
The only thing whcih is understandable for me is: unsupported file format.
It can't find the MediaPlayer.framework I believe is the problem. You need to update your Library Header Search Path in the build settings. It is looking for it on your desktop I believe.
You may need to add it to your target, relink it, or just make sure its pointing in the correct place.