|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
In the previous episode: I need to compile my C++ code using -std=c++0x but that option is only supported by g++ >= 4.3 and Apple provide g++-4.2 2009/9/15 Chris Espinosa <email@hidden>: > On Sep 15, 2009, at 8:11 AM, Ludovic Rousseau <email@hidden> > wrote: > >> 2009/9/15 Jean-Daniel Dupas <email@hidden>: >>> Now, to come back to your question, you can add a CC "user defined build >>> setting" to the build setting list. >>> Despite the setting name, CC is used for both C and C++ files. >>> You have to specify an absolute path IIRC. >> >> Great. It does work. >> >> The problem now is that my g++ does not understand Apple "extensions" >> to the compiler. My locally recompiled compiler does not understand >> the -arch argument. >> >> I see two options: >> - tell Xcode to not pass this argument. Is it possible? >> - write a wrapper that removes this argument from the command line >> before calling the real compiler > > The best way to use a non-Apple tool in the Xcode build chain is to create > an External Build System target and write a makefile that invokes your tool > the way you want it. Then your Xcode targets can link to the static or > dynamic library built by the makefile. You have all the regular Xcode build > settings at your disposal in the makefile, but you're responsible for > assembling the compiler invocation yourself. I used a wrapper to call my own gcc-4.3 after removing the unsupported Apple "extensions". I attach my wrapper for review if needed. The code is running fine. The problem I have now is some memory allocation errors: foobar(5834) malloc: *** error for object 0x5d4674: Non-aligned pointer being freed *** set a breakpoint in malloc_error_break to debug Breakpoint 1, 0x943174a9 in malloc_error_break () (gdb) bt #0 0x943174a9 in malloc_error_break () #1 0x94312497 in szone_error () #2 0x9423c523 in szone_free () #3 0x9423c38d in free () #4 0x9420502a in std::string::_Rep::_M_destroy () #5 0x9420599d in std::string::_M_mutate () #6 0x94205a44 in std::string::_M_replace_safe () #7 0x94205ae8 in std::string::assign () #8 0x00593a05 in std::string::operator= (this=0x701aa8, __s=0xbfffe45d "00 00") at bits/basic_string.h:931 [...] I have memory allocation problems with std::string manipulation. The problem is that code compiled with my g++-4.3 uses the C++ runtime provided by g++-4.3 (/usr/local/liblibstdc++.6.dylib) but code compiled using the Apple g++ uses another C++ runtime (/usr/lib/libstdc++.6.dylib). And (it looks like) you can't mix an application using /usr/lib/libstdc++.6.dylib (say Firefox) and a library using /usr/local/liblibstdc++.6.dylib (my library loaded by Firefox). I tried to link my library to the static /usr/local/lib/libstdc++.a but the resulting .dylib is still linked to /usr/local/lib/libstdc++.6.dylib and /usr/local/lib/libgcc_s.1.dylib. I think I am on a dead end now :-( Regards, -- Dr. Ludovic Rousseau
Description: Binary data
_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
Visit the Apple Store online or at retail locations.
Copyright © 2011 Apple Inc. All rights reserved.