I´m really stuck with this issue... and i hope you can help me out here.
I'm developing an iPad app for a company, that requires to use secured SOAP web services... not the perfect combination! i know, the thing is that taking a look around google, i found that the "best" thing to do was making a WS client using gSOAP and that´s what i did! now i have the client for one of those WS in C++.
When i try to call one of the methods of the WS, and build the app... this is what happens:
Ld /Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator/App.app/App normal i386
cd /Users/me/iOS/App
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.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 i386 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk
-L/Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator
-L/Users/me/iOS/App -F/Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator
-F/Applications/Xcode.app/Contents/Developer/Library/Frameworks
-filelist /Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/App.LinkFileList
-mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100
-framework SenTestingKit -framework Foundation -framework UIKit -framework QuartzCore -framework CoreGraphics -ldataSOAPlibDev
-o /Users/me/Library/Developer/Xcode/DerivedData/App-akcairabnqiunvddtmwphaispprl/Build/Products/Debug-iphonesimulator/App.app/App
ld: warning: ignoring file /Users/me/iOS/App/libdataSOAPlibDev.a,
file was built for archive which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
'soap::soap()', referenced from:
-[ViewContratosController viewDidLoad] in ViewContratosController.o
'_soap_init_LIBRARY_VERSION_REQUIRED_20808', referenced from:
-[ViewContratosController viewDidLoad] in ViewContratosController.o
'soap_call_ns1__obtenerPais(soap*, char const*, char const*, ns2__paisFile*,
ns1__obtenerPaisResponse&)', referenced from:
-[ViewContratosController viewDidLoad] in ViewContratosController.o
'soap::~soap()', referenced from:
-[ViewContratosController viewDidLoad] in ViewContratosController.o
'ns2__paisFile::soap_default(soap*)', referenced from:
ns2__paisFile::ns2__paisFile() in ViewContratosController.o
'vtable for ns2__paisFile', referenced from:
ns2__paisFile::ns2__paisFile() in ViewContratosController.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The NOTE may tell the problem... but i don´t know how to solve it... any ideas?
Thanks!
The problem is probably that you took a library for iPAd (ARM architecture) and tried to build to the simulator (i386 architecture). Try building to the actual device instead.
The hint for me was:
ld: warning: ignoring file /Users/me/iOS/App/libdataSOAPlibDev.a, file
was built for archive which is not the architecture being linked
(i386)
OK! i solved it including (not importing) the headers and the nsmap generated by gSOAP in the .mm file where i´m trying to consume the WS...
#include "soapH.h"
#include "soapStub.h"
#include "soapdataServiceSoapBindingProxy.h"
#include "dataServiceSoapBinding.nsmap"
If you are going to make a static library out of a WS Client created by gSOAP, be REALLY careful with the "Build Phases" of the library Project... add carefully the headers and the compile sources!
After that... import to your iOS proyect the "lib.a" with the headers and the XMLs under the same folder! and call the WS doing something like this:
dataServiceSoapBinding service;
ns2__countryFile country;
struct ns1__getCountryResponse response;
country.idCountry = 11;
if(service.ns1__getCountry(&country, response) == SOAP_OK) {
NSLog(#"ok");
} else {
NSLog(#"ERROR");
}
I hope this may help anybody... because i had such a hard time figuring this out... and didn´t find much info about it!
:)
Related
I am trying to compile curl and statically link it to another project.
I did manage to compile it for my mac architecture(x86_64) and got "libcurl.a".
Now when I try to build:
#include <curl/curl.h>
int main()
{
CURL *curl = curl_easy_init();
}
with g++ tornado.cc -o tornado (path-to-where-it-is)libcurl.a -std=c++11
I get:
Undefined symbols for architecture x86_64:
"_CFArrayAppendValue", referenced from:
_append_cert_to_array in libcurl.a(libcurl_la-darwinssl.o)
"_CFArrayCreate", referenced from:
_darwinssl_connect_common in libcurl.a(libcurl_la-darwinssl.o)
"_CFArrayCreateMutable", referenced from:
_darwinssl_connect_step2 in libcurl.a(libcurl_la-darwinssl.o)
"_CFArrayGetCount", referenced from:
_darwinssl_connect_common in libcurl.a(libcurl_la-darwinssl.o)
"_CFArrayGetValueAtIndex", referenced from:
_darwinssl_connect_common in libcurl.a(libcurl_la-darwinssl.o)
"_CFDataCreate", referenced from:
_append_cert_to_array in libcurl.a(libcurl_la-darwinssl.o)
As I understand it wants to get links for darwinssl, but I do not know where to get those.
The readme for curl (https://github.com/biasedbit/curl-ios-build-scripts/blob/master/README.md) - does mention it depends on libz.dylib and
Security.framework but does not give any clues about what they are, when and how do I need them, and how to include those.
P.S. the regular curl inclusion works fine: g++ tornado.cc -o tornado -lcurl -std=c++11
I found some time to mess around on the mac. Here's the command that worked for me:
gcc main.cpp -I path/to/include path/to/libcurl.a -framework Foundation -lz -framework Security
Basically, you need -framework Foundation, -lz and -framework Security.
there are quite a no. of question on this point. But none of them can guide a solution to my issue. I am trying to create a plugin for Adobe Illustrator CC in XCode Version 6.3.2 (6D2105). Following their official guidelines to create a basic "HelloWorld" plugin giving this linker error.
Error:
Ld /Users/Barun/Adobe\ Illustrator\ CC\ 2015\ SDK/samplecode/output/mac/debug/HelloWorld.bundle/Contents/MacOS/HelloWorld normal x86_64
cd "/Users/Barun/Adobe Illustrator CC 2015 SDK/samplecode/HelloWorld"
export MACOSX_DEPLOYMENT_TARGET=10.9
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/Barun/Adobe\ Illustrator\ CC\ 2015\ SDK/samplecode/output/mac/debug -F/Users/Barun/Adobe\ Illustrator\ CC\ 2015\ SDK/samplecode/output/mac/debug -filelist /Users/Barun/Library/Developer/Xcode/DerivedData/HelloWorld-fzhjlvdzxxobzagznysauclanlgg/Build/Intermediates/HelloWorld.build/Debug/HelloWorld.build/Objects-normal/x86_64/HelloWorld.LinkFileList -mmacosx-version-min=10.9 -dead_strip -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/Barun/Library/Developer/Xcode/DerivedData/HelloWorld-fzhjlvdzxxobzagznysauclanlgg/Build/Intermediates/HelloWorld.build/Debug/HelloWorld.build/Objects-normal/x86_64/HelloWorld_dependency_info.dat -o /Users/Barun/Adobe\ Illustrator\ CC\ 2015\ SDK/samplecode/output/mac/debug/HelloWorld.bundle/Contents/MacOS/HelloWorld
Undefined symbols for architecture x86_64:
"_CFStringCreateWithCharacters", referenced from:
ai::UnicodeString::as_CFString(__CFAllocator const*) const in IAIUnicodeString.o
"_CFStringGetCharactersPtr", referenced from:
ai::UnicodeString::UnicodeString(__CFString const* const&) in IAIUnicodeString.o
"_CFStringGetLength", referenced from:
ai::UnicodeString::UnicodeString(__CFString const* const&) in IAIUnicodeString.o
"_CFStringGetCharacters", referenced from:
ai::UnicodeString::UnicodeString(__CFString const* const&) in IAIUnicodeString.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Looks like the linking error coming from IAIUnicodeString.cpp file, which is a support file provided by the sdk. So I am not having idea to what need to be change there.
I was successful to build FreeGrid and DrawArt project provided with the SDK as sample. I have also checked all the build settings with FreeGrid to my HelloWorld project, no mismatch from that side too.
The project set up can be found in Github.
From Adobe Forum https://forums.adobe.com/message/7723859#7723859:
Add to project settings:
BuildPhases>Link Binary With Libraries: CoreFoundation.framework
I have a very simple class, which I will send as Object via TCP using Asio by boost. I found many examples on the Internet, but when I compile my code I get a Link Failure.
#include <boost/archive/text_oarchive.hpp>
void async_write(){
std::ostringstream archive_stream;
boost::archive::text_oarchive archive(archive_stream); // here it fails
//....
}
I downloaded boost via macports.
My Qt project file:
INCLUDEPATH += /opt/local/include
LIBS += -L/opt/local/lib
LIBS += -lboost_system-mt -lboost_filesystem-mt -lboost_serialization-mt
Failure:
Undefined symbols for architecture x86_64:
"boost::archive::text_oarchive_impl::save(std::string const&)", referenced from:
void boost::archive::save_access::save_primitive(boost::archive::text_oarchive&, std::string const&) in tcpsession.o
"boost::archive::text_oarchive_impl::text_oarchive_impl(std::ostream&, unsigned int)", referenced from:
boost::archive::text_oarchive::text_oarchive(std::ostream&, unsigned int) in tcpsession.o
"boost::archive::basic_text_oprimitive::~basic_text_oprimitive()", referenced from:
boost::archive::text_oarchive_impl::~text_oarchive_impl() in tcpsession.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: * [tcpserver] Error 1
Any help is appreciated.
The standard reply would be "re-run qmake". It's even simpler to just delete the entire shadow build directory. One level up from the source of your project, there will be build-... folders. Delete all of them, and build again.
The simplest way to see whether your project file (the file with LIBS += lines) is current, add something to it that's invalid (like a typo in the library name). If it still "builds" without showing the error directly aimed at your typo (a missing library), then you know that your build is not based on the current project file, and you should re-run qmake or delete the shadow build folder so that everything will be recreated there.
I'm having a compilation issue which I'm unable to solve. I'm developing a cross platform C++ project coding on both Mac Os X 10.8 and Windows. The code compiles and run fine on Windows and on Mac Os X Leopard as well.
Since Apple pushes the developers to stick to the latest platform for various reasons I'm forced to develop on Mountain Lion and I'm trying to get the project to work again.
I compiled correctly all the libraries I needed (wxWidgets, etc) and I imported the project in the latest version of Eclipse. When I try to build the project it tries to compile the firts .cpp file and at the end it (why?) tries to invoke the linker resulting on a series of missing symbols for my own defined classes. None of the other .cpp files is being compiled, so it's pretty understendable why the whole process is failing.
I also tried to invoke make from CLI, with the same result. I went into the makefile and everything seems correct. It looks like a very newbie issue, I feel I'm missing something huge here.
I'm pasting below the output of the compiler, just in case some compiling guru step in. Please feel free to ask for more details.
Compiler output
Pastebin Link: Compiler output
I used PB since the output is quite large.
The relevant section are the invocation of as and collect2 soon after the compiling phase of the very first .cpp file. The missing symbols are defined in other .cpp files in the same dir.
/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin11/4.2.1/as -arch x86_64 -force_cpusubtype_ALL -o /var/folders/br/h6ln_j014ll56zwc8x6xjmk80000gn/T//ccSUmHal.o /var/folders/br/h6ln_j014ll56zwc8x6xjmk80000gn/T//ccn8ex81.s
/usr/llvm-gcc-4.2/bin/../libexec/gcc/i686-apple-darwin11/4.2.1/collect2 -dynamic -arch x86_64 -macosx_version_min 10.8.3 -weak_reference_mismatches non-weak -o Calcoli.o -lcrt1.10.6.o -L/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/x86_64 -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/x86_64 -L/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1 -L/usr/llvm-gcc-4.2/bin/../lib/gcc -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1 -L/usr/llvm-gcc-4.2/bin/../lib/gcc/i686-apple-darwin11/4.2.1/../../.. -L/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/../../.. /var/folders/br/h6ln_j014ll56zwc8x6xjmk80000gn/T//ccSUmHal.o -lstdc++ -lSystem -lgcc -lSystem
The compiler output ends with the "classic" undefined symbol issue. All emphasized text*emphasized text*emphasized text
Undefined symbols for architecture x86_64:
"typeinfo for TipoPuntoCalc", referenced from:
Calcoli::setPuntoS(GTGraphicObject*) in ccSUmHal.o
"typeinfo for TipoPali", referenced from:
Calcoli::setPaloS(GTGraphicObject*) in ccSUmHal.o
"typeinfo for TipoRett", referenced from:
Calcoli::setFondazioneS(GTGraphicObject*) in ccSUmHal.o
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [Calcoli.o] Error 1
This shouldn't be an architecture related issue, since specifing i386 as target has the same result (symbol(s) not found for architecture i386).
Thank you,
Evelina
Go to your target's "Build Phases" section and verify that all the files you need to compile and link are actually included in the proper sections.
It sounds as if the compiler is not being told to include some things you need.
I've been trying to get SFML working for a while now and I've been trying to get it working using GCC. I'm on OS X by the way. I followed the standard Linux instructions and using the Linux 64-bit download however when it comes to compiling...
g++ -o testing main.cpp -lsfml-system
This happens:
main.cpp: In function ‘int main()’:
main.cpp:7: error: ‘class sf::Clock’ has no member named ‘GetElapsedTime’
main.cpp:9: error: ‘class sf::Clock’ has no member named ‘GetElapsedTime’
main.cpp:10: error: ‘Sleep’ is not a member of ‘sf’
So I thought it could be due to not using includes, so I changed my gcc compile command to:
g++ -o testing main.cpp -I ~/SFML-1.6/include/ -lsfml-system
and now I'm getting this error:
ld: warning: ignoring file /usr/local/lib/libsfml-system.so, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"sf::Clock::Clock()", referenced from:
_main in ccZEiB7b.o
"sf::Clock::GetElapsedTime() const", referenced from:
_main in ccZEiB7b.o
"sf::Sleep(float)", referenced from:
_main in ccZEiB7b.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status**
And I have no idea what to do to fix it.
Short answer
Add the -arch i386 (on mac) or -m32 (on linux) flag
Long answer
Your sfml-system library was built in 32 bits whereas you are trying to compile your program in 64 bits. So your program cannot link to the library.
Recompile SFML in 64 bits if possible and you should be able to compile your program in 64 bits.
SFML expects you to use frameworks on OS X. Open the SFML folder and copy all the folders under lib64 to /Library/Frameworks (that is, copy SFML.framework, sfml-system.framework, etc. to /Library/Frameworks).
Once you've installed the frameworks, you can use them by passing the -framework command to g++ like so:
g++ -o testing main.cpp -framework SFML -framework sfml-system