Opened 8 years ago

Closed 8 years ago

#52130 closed defect (fixed)

clang-3.8+ math.h fails to work on Snow Leopard without -U__STRICT_ANSI__

Reported by: kenneth.f.cunningham@… Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: snowleopard Cc:
Port: clang-3.8

Description

As Jeremy has pointed out previously, there is a build error in ld64-latest @264.3.102_2+llvm38 on 10.6. due to math errors.

the near-final line of the LibCxxOnOlderSystems instructions

sudo port -v upgrade --enforce-variants ld64 -ld64_97 -ld64_127 -ld64_136 -ld64_236

fails due to some math errors

opt/local/bin/clang-mp-3.8 -Os -Os -arch x86_64 -I/opt/local/libexec/llvm-3.8/include -DLTO_SUPPORT -Isrc/abstraction -Isrc/ld -Isrc/ld/parsers -I/opt/local/include -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64-latest/work/dyld-360.18/include  -c -o src/ld/debugline.o src/ld/debugline.c
In file included from src/other/ObjectDump.cpp:35:
In file included from src/ld/parsers/macho_relocatable_file.h:28:
In file included from src/ld/ld.hpp:30:
/opt/local/libexec/llvm-3.8/bin/../include/c++/v1/math.h:1199:91: error: use of undeclared identifier 'llrintf'
inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT       {return llrintf(__lcpp_x);}
                                                                                          ^
/opt/local/libexec/llvm-3.8/bin/../include/c++/v1/math.h:1200:91: error: use of undeclared identifier 'llrintl'
inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);}
                                                                                          ^
/opt/local/libexec/llvm-3.8/bin/../include/c++/v1/math.h:1205:40: error: call to 'llrint' is ambiguous
llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);}
                                       ^~~~~~
/opt/local/libexec/llvm-3.8/bin/../include/c++/v1/math.h:1199:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT       {return llrintf(__lcpp_x);}
                                           ^
/opt/local/libexec/llvm-3.8/bin/../include/c++/v1/math.h:1200:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);}

-- and more of the same ----

this potential fix was located <http://clang-developers.42468.n3.nabble.com/problems-building-libcxx-td2353619.html>

and indeed adding the following to the ld64 portfile does enable the ld64 upgrade to proceed without errors, and subsequent ports build normally. Presumably this is 10.6 specific (not tested on any other system at present) and would need to be wrapped in a darwin 10 guard...

    configure.cppflags-append -I${workpath}/dyld-${dyld_version}/include
  +  configure.cppflags-append -U__STRICT_ANSI__

Change History (5)

comment:1 Changed 8 years ago by mf2k (Frank Schima)

Cc: jeremyhu@… removed
Owner: changed from macports-tickets@… to jeremyhu@…

comment:2 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Port: clang-3.8 added; ld64 removed
Status: newassigned

Yeah, this is the issue I was mentioning on the mailing list about why I don't recommend using macports-clang-3.8 yet as a default compiler on Snow Leopard. I prefer to get this fixed in the clang-3.8+ ports.

comment:3 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Summary: ld64-latest @264.3.102_2+llvm38 build failure on 10.6 due to math.h - and fixclang-3.8+ math.h fails to work on Snow Leopard without -U__STRICT_ANSI__

comment:4 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

3004-Fix-missing-long-long-math-prototypes-when-using-the.patch fixes this for cmath, but v1/math.h is new in 3.8, so we need to fix it as well.

Last edited 8 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:5 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: fixed
Status: assignedclosed

To github.com:macports/macports-ports.git

6bcc0e3..b41cdad master -> master

https://github.com/jeremyhu/libcxx/commit/720feba4874d4ca3131753dc31af127e3c509c36

Note: See TracTickets for help on using tickets.