Undefined symbols for architecture x86_64: "_GLOBAL_OFFSET_TABLE_" - gfortran

I have a problem compiling codes with gfortran (gcc 8.3.0_2 installed using Homebrew) on MacOS Mojave. It came up with an error message as written in the title of this post.
Would anyone please explain what went wrong and how to fix the problem. Thanks a ton!!
Adding flags -fno-PIC and -fno-PIE doesn't help.

Related

Trouble Installing Flutter on OSX

I followed the install instructions for Flutter on OSX, and ended up with this error:
"Dart_NewStringFromUTF8 expects argument 'str' to be valid UTF-8."
Checking the github issues, this one seems to be closed but was not helpful in resolving. I have no weird characters in my file path.
I cannot find anything else on it that will resolve this error, nor do I know what/where to check to find out what is causing this. Anyone else ran into this issue on OSX?
I was able to fix this error by running flutter in verbose mode:
flutter doctor -v
This gave me clues on where the issue was on my machine. There was a directory with a non UTF-8 character and that tripped up the installation process. Renaming that directory solved the error.

Error while compiling iOS app with openCV framework on real device

With latest open cv framework i am unable to compile code on IOS device. i am facing following error.
Undefined symbols for architecture arm64:
"_png_init_filter_functions_neon", referenced from:
_png_read_filter_row in opencv2(pngrutil.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Same app is able to compile for simulator but not for ios devices. Can any one tell me why i am facing this problem. Thanks in advance.
I had fixed this problem.The core of this problem is that we recompile some content in libpng,maybe it exits in other ios framework.Then it makes a conflict.Opncv 3.1 has 3rdparty in it's code.What you should do is find the lines 117-121 in libpng's pngpriv.h.Then just follow Iphone - device - linker error.
It appears that this commit fixes the issue, while still keeping NEON support for iOS devices:
https://github.com/opencv/opencv/commit/262a52f3063c50fbb1236e2cba2bd3c68f9979bb
Essentially, the clause that appends -DENABLE_NEON=ON to the cmake line was only applying to architectures beginning with "armv" (note the "v"); the above commit changes opencv/platforms/ios/build_framework.py to allow the cmake command to work with "arm64" as well.
Before:
if arch.startswith("armv"):
cmakecmd.append("-DENABLE_NEON=ON")
After:
if arch.startswith("armv") or arch.startswith("arm64"):
cmakecmd.append("-DENABLE_NEON=ON")
Diagnostic process, since it might be useful:
Found this by starting a script build.log before invoking python ../opencv/platforms/ios/build_framework.py ios and digging through output; arm_init.c was not built for arm64 (which is where png_init_filter_functions_neon was defined) but was for armv7 and armv7s. From there, looking through 3rdparty/libpng/CMakeLists.txt pointed at ENABLE_NEON not being set.
I faced the same problem as #shahzaib described. In simulator it works but in iPhone its not working and showing the same error.
Previously I manually added OpenCV 3.1 in my iOS project. Later I changed it and install the OpenCV library via cocoapod https://cocoapods.org/pods/OpenCV
And in cocoapod there is 3.1.0.1 version which fixed the issue.
pod 'OpenCV', '~> 3.1.0.1'

Linking Errors while integrating SKMaps.Framework

Getting these error while trying to integrate SKMaps framework
Undefined symbols for architecture x86_64:
"CRouteTestManager::calculateRoute(NGRouteInput const&, std::__1::shared_ptr<CRoute>&)", referenced from:
PoiTrackerTest::createRoute() in SKMaps(PoiTrackerTest.o)
"_gpTestRoutesManager", referenced from:
PoiTrackerTest::createRoute() in SKMaps(PoiTrackerTest.o)
createNavigationObject(int) in SKMaps(NavigationTest.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please help me resolve this error.
Environment :
Xcode 6.3.1, Mac OSX 10.10.3
Deployment Target iOS7.0
Supports Swift.
i was following this guide : http://developer.skobbler.com/getting-started/ios
and also added CoreMotion.framework as there were also linking errors related to that framework.
Cause of Linker Error
This appears to be the result of the linker flag -all_load, which may have been added to your project through a CocoaPod. In the rare case that you have a static library with nothing but categories defined then you need this flag. Otherwise, it can be safely removed from your build. See discussion here:
What does the -all_load linker flag do?
From a link in the comments section on that discussion you can see that this bug that previously required -all_load has been fixed since XCode 4.
Objective-C categories in static library
Probable Explanation
This framework has a bunch of tests defined inside, but their dependencies are not included in the framework. When the linker is forced to resolve and link all dependencies, it errors out because it cannot find them. Basically, the library should be cleaned up so that it doesn't contain these unnecessary symbols. The work around is to remove -all_load for the time being.
Faced with the same problem. Deleting -all_load flag did not help, so I continued to research and found a solution:
Despite the fact that Skobbler declares the need for linking the libc++ library, in reality you need to link libstdc++.6 library. Note that linking libstdc++ will not help.
P.S. Xcode 6.4, iOS SDK 8.4

How can I fix Xcode 4.6 LLVM compiler error?

I've just checked out a copy of WordPress for iOS from the Subversion Repository: http://iphone.svn.wordpress.org/trunk/
However trying to compile and run it on the 5.1 or 6.1 simulator gives me a weird error I've never seen before:
clang: error: no such file or directory: '/private/tmp/WordPress.build/WordPressComApiCredentials.m'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
I have already tired to clean the project and reset the simulator but that didn't help either. From other posts I understand that something about "clang" is set in the code - but I don't know what it is.
Could someone point me in the right direction?
Thanks in advance!

Xcode 4.6 causing libobold2d-ios.a not found error in Kobold2D

I'm getting the following error after upgrading Xcode to 4.6 and building my Kobold2D project:
ld: file not found: /Users/Jon/Library/Developer/Xcode/DerivedData/Kobold2D-
awxpgwvfoipnxpdyaptbdirnnfwq/Build/Intermediates/ArchiveIntermediates/Kodable-
iOS/BuildProductsPath/Release-iphoneos/libkobold2d-ios.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It happens only when building the IPA with product>archive. I can run directly on the device no problem. This leads me to believe its a distribution permissions setting.
I've done some research on the error here, and also reviewed similar questions on SO. I have an idea of what the problem is, but none of the solutions seem to fix the issue.
This only just happened with Xcode 4.6. I've been able to build IPAs before no problem, and even have the app in the App Store, so I don't know what changed to cause this.
I figured this out today, so I will answer it for anyone else that might have this problem.
Somehow the libkobold2d-ios.a file (along with a few others) were removed from the "link binary with libraries" section of build phases. I definitely didn't do that manually, so I don't know why they were missing, but when I added them back it worked.
A quick note - They will still show up as red, because they have to be built at compile time.

Resources