Link Error Using gcc49 port on Mac OS 10.9
Ryan Schmidt
ryandesign at macports.org
Sat Dec 7 01:37:26 PST 2013
On Dec 6, 2013, at 21:26, Geoffrey Odhner wrote:
> On 6 Dec 2013, at 2:59, Ryan Schmidt wrote:
>
>> I’d also ask if you really need to use gcc. Could you use clang instead?
>
> I also tried your suggestion of using clang. I installed the MacPorts port of clang-3.4, which compiled my program fine, but when I ran it, it gave exceptions on regexes that it shouldn't! I have a regex std::regex phone_("\\PHONE ?"), and I learned that their regular expression engine is very much more particular about adhering to the ECMA standard in its parsing of regular expressions, but because the standard doesn't explicitly require it, they don't support matching of backslashes, even when they are specified using hex escape sequences. This is really a problem! How can they not support matching against a specific character? Well, that's why I need to go back to GCC for now. I always seem to run into the issues with compilers. Thanks again for your help.
I see!
I actually meant the clang that comes with Xcode, but if the bleeding-edge clang-3.4 didn’t work for this, then Xcode’s version probably won’t either.
More Googling informs me that this std::regex thing is brand new in gcc. They had an incomplete version in gcc48, based on earlier c++0x standards, and have now completed the full c++11 version in what will become gcc49. More Googling says clang’s regex implementation should be up to the c++11 standard, but if as you say the behavior you’re looking for is not defined by the standard, then it’s understandable if it doesn’t support it. Seems like a strange omission from the standard though. I use regular expressions constantly; I can’t imagine being told there is no way to match one specific character.
The reason I suggest using clang if possible is that with 10.9, OS X has switched its C++ library from libstdc++ to libc++ and you cannot mix C++ code compiled with one with C++ code compiled with the other. So if you ever want to link with C++ libraries in MacPorts, you’ll have to be compiled with libc++ on Mavericks, and that means using clang or llvm-gcc but not FSF GCC.
I searched the clang bug database for “regex” and didn’t see any titles that looked relevant to me. Maybe you could take a look and file a bug report? If nobody reports this problem to the clang developers it probably won’t get fixed.
http://llvm.org/bugs/
More information about the macports-users
mailing list