<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 19, 2017, at 2:10 PM, db <<a href="mailto:iamsudo@gmail.com" class="">iamsudo@gmail.com</a>> wrote:</div><div class=""><div class=""><br class="">Are the other steps described in the LibcxxOnOlderSystems instructions for 10.6 not necessary for 10.8?<br class=""></div></div></blockquote><div><br class=""></div><div>10.8 already has /usr/lib/libc++.dylib installed, so you don’t need to go through the bootstrapping hoops to get that as you do on 10.6. </div><div><br class=""></div><div>Just setting your "<span style="font-size: 13px; background-color: rgb(247, 247, 247);" class="">cxx_stdlib         libc++" and "buildfromsource always"</span> in macports.conf will be enough.</div><div><br class=""></div><div>I think the Lion and Mountain Lion LibCxxOnOlderSystems instructions could probably suggest/recommend installing and setting the default compiler to something newer, but I defer to the gurus here. They support people of all skill levels, and if you’re changing your default compiler, you should have a pretty good idea what and why you’re doing that.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class=""><br class=""><blockquote type="cite" class="">You can fix these ports by manually adding  -stdlib=libc++ to the CXXFLAGS and often LDFLAGS (as you described before), and/or you can change the default stdlib to libc++ in clang-3.8 (as I mentioned with my clang patch before), or alternatively Mojca's idea to add the stdlib spec to the CXX compiler environment variable would work as well, if that is implemented.<br class="">The easiest of these for me was the clang-3.8 patch.<br class=""></blockquote><br class="">If I understood correctly Apple's clang natively does what stock clang needs to be patched for.<br class=""></div></div></blockquote><div><br class=""></div><div>It’s an important concept to have cold, to understand what’s going on (and fix things when they might not work).</div><div><br class=""></div><div>clang (macports-installed versions) looks at the build line it’s asked to compile. If it sees -stdlib=something specified on the build line, it uses that. No problems. Presumably you set it correctly. It uses the last one it finds on the build line, if it finds more than one.</div><div><br class=""></div><div>However, if clang doesn’t see -stdlib specified on the build line, as shipped it will automatically add -stdlib=libstdc++ on < 10.9, and -stdlib=libc++ on 10.9+.</div><div><br class=""></div><div>Although this is usually what you might want, IF you’ve modified your system as you and I are doing to force the use of libc++ on <10.9, this will be the wrong behaviour, and you will get link errors when building some or most macports software. In short, clang has no idea that we would want to use libc++ even though we are on <10.9 — that’s not the way the system shipped...</div><div><br class=""></div><div>So the fix is to either make sure there is always a -stdlib=libc++ placed on the build line (purest, but frequently enough is not there), OR to modify the default behaviour of clang on these modified systems to teach it to add -stdlib=libc++ instead of -stdlib=libstdc++ even on < 10.9. This turns out to be quite easy.</div><div><br class=""></div><div><br class=""></div><div>The few times I tried sending -stdlib=libc++ to the system installed clang version when building with xcode on 10.6, it just generated an error saying I had used the wrong stdlib …. so I don’t think you can override that behaviour. I haven’t explored that much.</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">Both 3.8 and 3.9 are at rev 3 but I'd rather assume I could patch llvm portfile manually and use your patch file 999.</div></div></blockquote></div><br class=""><div class="">The patch should work just the same unless that one file has been significantly changed (doubt it). If so, the patch phase of the port build will error out.</div><div class=""><br class=""></div><div class="">The patch for clang-3.8 and the patch for clang-3.9 are different, in case you didn’t notice. I’d stick with clang-3.8 for now - it works fine to get you started. The clang-3.9 patch is also in the same general repo, but in the llvm-3.9/files folder.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">You can also make the change manually if you want to look yourself and be completely sure you know what is happening. It’s quite easy to do.</div><div class=""><br class=""></div><div class="">Run ‘sudo port patch clang-3.8’ with the current unmodified macports clang-3.8 portfile, then find and open the file mentioned in the 999 patch (cd `port work clang-3.8` will get you started there), scroll down to the part of interest, change it yourself manually to be sure you did what you wanted to do, and then ‘sudo port -v install clang-3.8’ it and it will just keep on building from there with your changes.</div><div class=""><br class=""></div><div class="">Best,</div><div class=""><br class=""></div><div class="">Ken</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>