[SOLVED] Can't link/run for iOS Simulator through Qt Creator
-
I am using the latest Qt Creator and Qt 5.4. Below is a snippet of my build output. It will not link and run. The complaints all center around the c++ standard library. Another thing, the deployment target is 5.0 but I am explicitly selecting iPhone 6 ios 8.1 as my device type. Its also specifying i386 architecture, yet the proper architecture is x86_64 for iPhone 6.
Undefined symbols for architecture i386:
"std::basic_ios<char, std::char_traits<char> >::fill() const", referenced from:
operator<<(std::ostream&, ACE_Time_Value const&) in libACE.a(Time_Value.o)
"std::ostream::flush()", referenced from:
ACE_Log_Record::print(char const*, unsigned long, std::ostream&) in libACE.a(Log_Record.o)
"std::ostream::operator<<(int)", referenced from:
operator<<(std::ostream&, ACE_Time_Value const&) in libACE.a(Time_Value.o)
"std::ostream::operator<<(long)", referenced from:
operator<<(std::ostream&, ACE_Time_Value const&) in libACE.a(Time_Value.o)
"std::_List_node_base::hook(std::_List_node_base*)", referenced from:
std::list<ACE_Static_Node const*, std::allocator<ACE_Static_Node const*> >::_M_insert(std::_List_iterator<ACE_Static_Node const*>, ACE_Static_Node const* const&) in libACE.a(Parse_Node.o)
"std::ios_base::Init::Init()", referenced from:[...]
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)** BUILD FAILED **
The following build commands failed:
Ld Debug-iphonesimulator/tap_new_display_app.app/tap_new_display_app normal i386
(1 failure)
make[2]: *** [iphonesimulator-debug] Error 65
make[1]: *** [debug-iphonesimulator] Error 2
make: *** [sub-tap_new_display_app-make_first-ordered] Error 2
16:34:43: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project tap_new_display (kit: iphonesimulator-clang Qt 5.4.0 for iOS)
When executing step "Make"
16:34:43: Elapsed time: 00:10.By the way, if I use qmake to generate an Xcode project file, I get the same errors (not surprising). But, I can specify linking in the C++ runtime library "libc++.dylib" in the Build Phases section and it will compile and run just fine.
-
What I noticed was that while the errors were related to the standard library, they were all in one library, libACE. Non of the other libraries were complaining. The one difference is that the libACE library is an external third-party library, not built within the Qt Creator project. I had compiled the various architectures without any special compiler flags and what I ended up with resulted in the original problem.
I rebuilt the libraries with the -stdlib=libc++ flag and the problem has been resolved. I created a universal lib with i386, x86_64 and armv7 architectures and I have verified I can build and run all.
This also eliminated the need to explicitly link libc++ within xCode.
-
#iphonesimulator
CONFIG(iphonesimulator, iphoneos | iphonesimulator) {
#here do some things for iphonesimulator# for iphonesimulator error: file was built for x86_64 which is not the architecture being linked (i386) # for error Ld .object/xxxxxxxxxx/xxxxxxxx/i386/xxxxx normal i386 QMAKE_APPLE_SIMULATOR_ARCHS = x86_64 #i386 for 32bit
}
#iphoneos
CONFIG(iphoneos, iphoneos | iphonesimulator) {
#here do some things for iphoneos
}