[MacPorts] #43828: clang-3.4 package uses mismatched libc++ headers and libraries
MacPorts
noreply at macports.org
Fri Sep 5 08:04:22 PDT 2014
#43828: clang-3.4 package uses mismatched libc++ headers and libraries
------------------------------------+------------------------
Reporter: howarth.at.macports@… | Owner: jeremyhu@…
Type: defect | Status: closed
Priority: Normal | Milestone:
Component: ports | Version: 2.3.0
Resolution: worksforme | Keywords:
Port: clang-3.4 |
------------------------------------+------------------------
Description changed by larryv@…:
Old description:
> On 10.7, I noticed that the MacPort's clang++-mp-3.4 compiler from the
> clang-3.4 package is using a mismatched set of libc++ headers and
> libraries…
>
> {{{
> % clang++-mp-3.4 -stdlib=libc++ hello.cc -v
> clang version 3.4 (tags/RELEASE_34/final)
> Target: x86_64-apple-darwin11.4.2
> Thread model: posix
> "/opt/local/libexec/llvm-3.4/bin/clang" -cc1 -triple x86_64-apple-
> macosx10.7.0 -emit-obj -mrelax-all -disable-free -main-file-name hello.cc
> -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose
> -munwind-tables -target-cpu core2 -target-linker-version 136 -v
> -resource-dir /opt/local/libexec/llvm-3.4/bin/../lib/clang/3.4
> -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/howarth
> -ferror-limit 19 -fmessage-length 125 -stack-protector 1 -mstackrealign
> -fblocks -fobjc-runtime=macosx-10.7.0 -fencode-extended-block-signature
> -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-
> diagnostics -vectorize-slp -o
> /var/folders/b8/ybr6czsd73s1qds_6bh5v0v80000gn/T/hello-8467e9.o -x c++
> hello.cc
> clang -cc1 version 3.4 based upon LLVM 3.4 default target x86_64-apple-
> darwin11.4.2
> ignoring nonexistent directory "/usr/include/c++/v1"
> ignoring nonexistent directory "/usr/local/include"
> #include "..." search starts here:
> #include <...> search starts here:
> /opt/local/libexec/llvm-3.4/bin/../include/c++/v1
> /opt/local/libexec/llvm-3.4/bin/../lib/clang/3.4/include
> /usr/include
> /System/Library/Frameworks (framework directory)
> /Library/Frameworks (framework directory)
> End of search list.
> "/opt/local/libexec/llvm-3.4/bin/ld" -demangle -dynamic -arch x86_64
> -macosx_version_min 10.7.0 -o a.out -lcrt1.10.6.o
> /var/folders/b8/ybr6czsd73s1qds_6bh5v0v80000gn/T/hello-8467e9.o -lc++
> -lSystem
> /opt/local/libexec/llvm-3.4/bin/../lib/clang/3.4/lib/darwin/libclang_rt.osx.a
>
> % otool -L ./a.out
> ./a.out:
> /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current
> version 28.4.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
> version 159.1.0)
>
> So the newer libc++ 3.4.1 headers stored in
> /opt/local/libexec/llvm-3.4/include are being used the much older system
> libc++…
>
> % otool -L /usr/lib/libc++.1.dylib
> /usr/lib/libc++.1.dylib:
> /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current
> version 28.4.0)
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
> version 159.1.0)
> /usr/lib/libc++abi.dylib (compatibility version 1.0.0, current
> version 14.0.0)
> }}}
>
> We fixed this on fink by adding…
>
> {{{
> # Adjust path for relocation of libc++ headers
> if test "$darwin_vers" -ge 13
> then sed -i.orig2 -e
> 's|AddPath("/usr/include/c++/v1"|AddPath("/Library/Developer/CommandLineTools/usr/lib/c++/v1"|'
> \
> tools/clang/lib/Frontend/InitHeaderSearch.cpp
> elif test "$darwin_vers" -ge 11
> then sed -i.orig2 -e
> 's|AddPath("/usr/include/c++/v1"|AddPath("/usr/lib/c++/v1"|' \
> tools/clang/lib/Frontend/InitHeaderSearch.cpp
> fi
> }}}
>
> so clang-3.4 in MacPorts needs something like…
>
> {{{
> if {${os.major} > 12} {
> post-patch {
> reinplace
> "s|AddPath(\"/usr/include/c++/v1\"|AddPath(\"/Library/Developer/CommandLineTools/usr/lib/c++/v1\"|"
> ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
> }
> elseif {${os.major} > 10} {
> post-patch {
> reinplace
> "s|AddPath(\"/usr/include/c++/v1\"|AddPath(\"/usr/lib/c++/v1\"|"
> ${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
> }
> }
> }}}
>
> As you can see from the verbose output of clang-3.4 at the beginning of
> this report…
>
> ignoring nonexistent directory "/usr/include/c++/v1"
>
> …the stock sources default to a /usr/include/c++/v1 directory which Apple
> has never used instead of /usr/lib/c++/v1 on 10.7/10.8 and
> /Library/Developer/CommandLineTools/usr/lib/c++/v1 on 10.9.
New description:
On 10.7, I noticed that the MacPort's clang++-mp-3.4 compiler from the
clang-3.4 package is using a mismatched set of libc++ headers and
libraries…
{{{
% clang++-mp-3.4 -stdlib=libc++ hello.cc -v
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
"/opt/local/libexec/llvm-3.4/bin/clang" -cc1 -triple x86_64-apple-
macosx10.7.0 -emit-obj -mrelax-all -disable-free -main-file-name hello.cc
-mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -target-linker-version 136 -v -resource-
dir /opt/local/libexec/llvm-3.4/bin/../lib/clang/3.4 -stdlib=libc++
-fdeprecated-macro -fdebug-compilation-dir /Users/howarth -ferror-limit 19
-fmessage-length 125 -stack-protector 1 -mstackrealign -fblocks -fobjc-
runtime=macosx-10.7.0 -fencode-extended-block-signature -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp
-o /var/folders/b8/ybr6czsd73s1qds_6bh5v0v80000gn/T/hello-8467e9.o -x c++
hello.cc
clang -cc1 version 3.4 based upon LLVM 3.4 default target x86_64-apple-
darwin11.4.2
ignoring nonexistent directory "/usr/include/c++/v1"
ignoring nonexistent directory "/usr/local/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/local/libexec/llvm-3.4/bin/../include/c++/v1
/opt/local/libexec/llvm-3.4/bin/../lib/clang/3.4/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/opt/local/libexec/llvm-3.4/bin/ld" -demangle -dynamic -arch x86_64
-macosx_version_min 10.7.0 -o a.out -lcrt1.10.6.o
/var/folders/b8/ybr6czsd73s1qds_6bh5v0v80000gn/T/hello-8467e9.o -lc++
-lSystem
/opt/local/libexec/llvm-3.4/bin/../lib/clang/3.4/lib/darwin/libclang_rt.osx.a
% otool -L ./a.out
./a.out:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current
version 28.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 159.1.0)
}}}
So the newer libc++ 3.4.1 headers stored in
/opt/local/libexec/llvm-3.4/include are being used the much older system
libc++…
{{{
% otool -L /usr/lib/libc++.1.dylib
/usr/lib/libc++.1.dylib:
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current
version 28.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 159.1.0)
/usr/lib/libc++abi.dylib (compatibility version 1.0.0, current
version 14.0.0)
}}}
We fixed this on fink by adding…
{{{
# Adjust path for relocation of libc++ headers
if test "$darwin_vers" -ge 13
then sed -i.orig2 -e
's|AddPath("/usr/include/c++/v1"|AddPath("/Library/Developer/CommandLineTools/usr/lib/c++/v1"|'
\
tools/clang/lib/Frontend/InitHeaderSearch.cpp
elif test "$darwin_vers" -ge 11
then sed -i.orig2 -e
's|AddPath("/usr/include/c++/v1"|AddPath("/usr/lib/c++/v1"|' \
tools/clang/lib/Frontend/InitHeaderSearch.cpp
fi
}}}
so clang-3.4 in MacPorts needs something like…
{{{
if {${os.major} > 12} {
post-patch {
reinplace
"s|AddPath(\"/usr/include/c++/v1\"|AddPath(\"/Library/Developer/CommandLineTools/usr/lib/c++/v1\"|"
${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
}
elseif {${os.major} > 10} {
post-patch {
reinplace
"s|AddPath(\"/usr/include/c++/v1\"|AddPath(\"/usr/lib/c++/v1\"|"
${worksrcpath}/tools/clang/lib/Frontend/InitHeaderSearch.cpp
}
}
}}}
As you can see from the verbose output of clang-3.4 at the beginning of
this report…
{{{
ignoring nonexistent directory "/usr/include/c++/v1"
}}}
…the stock sources default to a /usr/include/c++/v1 directory which Apple
has never used instead of /usr/lib/c++/v1 on 10.7/10.8 and
/Library/Developer/CommandLineTools/usr/lib/c++/v1 on 10.9.
--
--
Ticket URL: <https://trac.macports.org/ticket/43828#comment:3>
MacPorts <http://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list