I am using std::experimental::filesystem with Xcode 9.0 beta. The compiler phase completes OK but the linker complains of undefined symbols:
std::experimental::filesystem::v1::path::__filename() const
std::experimental::filesystem::v1::path::__filename() const
std::experimental::filesystem::v1::path::__stem() const
std::experimental::filesystem::v1::__status(std::experimental::filesystem::v1::path const&, std::__1::error_code*)
I am also using std::experimental::filesystem::canonical(), but the linker isn't complaining about that being missing.
How can I configure the project to include these missing references?
UPDATE:
I have been experimenting with a simpler program. If I just use canonical() then the linker complains that it is missing.
I can use std::experimental::optional - everything compiles, links and runs OK. But 'optional' is a template and so probably doesn't involve a library.
Are you compiling with any -std= option ("C++ Language Dialect" option in Xcode)?
Related
I know there are tons of questions regarding this issue, but i didn't come up with solution.
We have in my project (react-native) a static library: let's call it externalLib_v1.1r.a that we added manually to my project. It always worked fine. It's a security library and we have no access to the source code.
With the new version of Flipper, that comes with latest versions of react-native, i have the following issue when building with Xcode:
duplicate symbol 'fileExists(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)' in:
/Users/myuser/project/myproject/ios/externalLib_v1.1r.a(utility.o)
/Users/myuser/Library/Developer/Xcode/DerivedData/proj-duwrxsmkbkccvdfykaajqslcqijq/Build/Products/Debug-iphonesimulator/Flipper/libFlipper.a(ConnectionContextStore.o)
ld: 1 duplicate symbol for architecture x86_64
There are 2 methods (1 inside externalLib_v1.1r.a and 1 inside ConnectionContextStore.cpp (Flipper)) with the same name.
If i manually rename the fileExists method inside the Flipper Pod it all works...
Is there a way to avoid this workaround?
Note: I have the -ObjC flag in "Other Linker Flags" of my project.
After some editing my Xcode 5.1.0 source files I suddenly get this linker error:
0 0x1059b5f93 __assert_rtn + 144
1 0x105a1d7f5 ld::tool::OutputFile::compressedOrdinalForAtom(ld::Atom const*) + 281
2 0x105a1e469 ld::tool::OutputFile::addDyldInfo(ld::Internal&, ld::Internal::FinalSection*, ld::Atom const*, ld::Fixup*, ld::Fixup*, ld::Fixup*, ld::Atom const*, ld::Atom const*, unsigned long long, unsigned long long) + 2261
3 0x105a14496 ld::tool::OutputFile::generateLinkEditInfo(ld::Internal&) + 1322
4 0x105a0f952 ld::tool::OutputFile::write(ld::Internal&) + 116
5 0x1059b6c40 main + 1012
A linker snapshot was created at:
/tmp/keytech PLM-2014-03-05-101905.ld-snapshot
ld: Assertion failed: (0 && "dylib not assigned ordinal"), function compressedOrdinalForAtom, file /SourceCache/ld64/ld64-236.3/src/ld/OutputFile.cpp, line 3454.
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have absolute no idea what this means?
I already tried to:
Delete the derived data folder
Clean Files and build files
Cosed and reopen Xcode
Made sure no Linker Optimizer are active: No dead Code Stripping, No Link Time Optimization.
I also have excluded some of my latest changed code. With no result.
Googleing the error did not find any useful information.
Does anybody have an idea?
In my case the linker error was gone after I switched in the Build Settings "OSX Deployment Target" from "10.7" to "10.8".
This looks like an open bug at llvm, which has been passed to Apple (and is therefore in a black hole).
No other information appears to be available so you need to step back in your development (via git) to figure out what triggered it, and then contribute any information you glean to llvm (via the bug reporter).
Not an answer, but I don't believe there is an answer to this issue...
I had this bug for a while.
The way I eventually fixed it was by trying to compile in Xcode 4.6
Once I tweaked my project to compile there, I got the much more helpful error:
Undefined symbols for architecture x86_64:
"_Gestalt", referenced from:
_GetOS in main.o
that led me to adding the coreservices framework (which was required by a third party framework I was adding), and from there, my project compiled just fine on xcode 5 & 6
so - that may not be the framework you need, but the approach may help you.
I ran into this too, but only for release builds. By process of elimination, I was able to get the release builds working by setting the Link-Time Optimization build setting to NO (LLVM_LTO = NO) under Apple LLVM – Code Generation.
I am working on an OpenCV-based project on Xcode 5.02, OS X 10.9.
My OpenCV was installed using homebrew.
I get the following error
Undefined symbols for architecture x86_64:
"cv::namedWindow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)"
I have added Header Search Paths /usr/local/include nonrecursive and /usr/local/include/opencv2 nonrecursive;
I have added Library Search Paths /usr/local/lib;
I have added all .dylib file under /usr/local/Cellar/opencv/2.4.3/lib to the project.
From what I can see, you are trying to run an Objective-C++ project, right? I presume that because cv::nameWindow is a c++ function of OpenCV.
You can have a look on this question, where I had a similar issue and solved it configuring the project properly.
This error means your XCode project is not finding the cv::namedWindow function. Are u sure OpenCV is properly installed in your PC? Can you run the C++ opencv functions from a standard c++ project? If so, the problem is just about your project configuration.
I have a symbol that is being referenced in an Xcode dynamic library target, but it is not defined there. I NEED this symbol to be undefined. This is because it will be compiled differently in each process that includes it (based upon some compile time defines).
The dynamic library target in Xcode that fails to link because it contains a reference to this symbol (which is not unexpected), but I know that the symbol will be available at run time. I will be compiling this function into each target that the common library is linked to.
I am trying to get the linker to mark this particular symbol for dynamic lookup at run time.
I have been able to get it to link if I specify "-undefined dynamic_lookup" as one of the "Other Linker Flags" in my Xcode project. The problem is that I don't want to go that far. I know that only 1 symbol is supposed to be undefined. I want all the rest of the symbols to generate errors if they are left as undefined (I want to avoid a run time missing symbol error basically).
I found a ld linker option that seems like it should do what I need (from ld man page):
-U symbol_name
Specified that it is ok for symbol_name to have no definition. With -two_levelnamespace, the resulting symbol will be marked dynamic_lookup which means dyld will search all loaded images.
However, I cannot seem to get it to work. Whenever I specify "-U symbolName" or "-UsymbolName" in the "Other Linker Flags" I am still greeted with this linker error:
Undefined symbols for architecture x86_64:
"_symbolName", referenced from: <various object files>
Am I using -U incorrectly perhaps? Is it not really the option I need, or is it just not working like it is supposed too?
Set -Wl,-undefined,dynamic_lookup to OTHER_LDFLAGS.
Link: Xcode clang link: Build Dynamic Framework (or dylib) not embed dependencies
Setting -Wl,-undefined,dynamic_lookup is dangerous, since it disables all undefined warning.
Use -Wl,-U,symbol_namein OTHER_LDFLAGS to disable warnings for a single symbol.
In Xcode:
Go to Project/Select Target
Click Build Settings
Search Other Linker Flags
Enter options
I make a build for iPhone for the first time and got a problem.
I already checked a lot of posts and didnt find answer.
When i make a build on device a get:
Undefined symbols for architecture armv7:
"RegisterAllStrippedInternalCalls()", referenced from:
RegisterAllInternalCalls() in libiPhone-lib.a(MonoICallRegistration.o)
"RegisterAllClasses()", referenced from:
InitializeEngineNoGraphics() in libiPhone-lib.a(SaveAndLoadHelper.o)
"RegisterMonoModules()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
On simulator ok.
libiPhone-lib.a added to link libraries.
Can somebody tell what it is? Please
Your unity version is not compatible, just download the latest version of unity which I believe is 4.3.1 and try recompiling. Here is the link if you need it. http://unity3d.com/unity/download/download-mac
The new version is compatible with armv7.
ok if anyone else is experiencing the same problem here's a way out:
those 3 methods mentioned are declared in the RegisterMonoModules.cpp in the Libraries folder, usually. so take that cpp file and add it to your target's Build Phases > Compile Sources
then if you have additional SDK's integrated that are not added to the 'Compile Sources' the new build will throw some other errors. just make sure to add the wrapper .mm files from the sdk's to your Compile Sources. Usually one .mm file per sdk. (e.g. for unity facebook sdk it's FbUnityInterface.mm file)
hope this helps