[MacPorts] #51520: llvm-3.9 @3.9-r270400_0+assertions+debug build failure on snow leopard due to missing strnlen function - and fix
#51520: llvm-3.9 @3.9-r270400_0+assertions+debug build failure on snow leopard due to missing strnlen function - and fix ------------------------------------+-------------------------------- Reporter: kenneth.f.cunningham@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Keywords: snowleopard | Port: llvm-3.9 ------------------------------------+-------------------------------- Sorry I haven't figured out the diff files just yet. llvm-3.9 build fails at 12% and then at 98% with error strnlen function not found to fix: in this file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.9/llvm-3.9/work/trunk/lib/ObjectYAML/MachOYAML.cpp and in this file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.9/llvm-3.9/work/trunk/tools/obj2yaml/macho2yaml.cpp add this replacement function after <string.h> and build succeeds (found an example in the cctools patches): static size_t strnlen(const char *s, size_t maxlen) { size_t len; for (len = 0; len < maxlen; len++, s++) { if (!*s) break; } return (len); } -- Ticket URL: <https://trac.macports.org/ticket/51520> MacPorts <https://www.macports.org/> Ports system for OS X
#51520: llvm-3.9 @3.9-r270400_0+assertions+debug build failure on snow leopard due to missing strnlen function - and fix -------------------------------------+------------------------- Reporter: kenneth.f.cunningham@… | Owner: jeremyhu@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: snowleopard Port: llvm-3.9 | -------------------------------------+------------------------- Changes (by ryandesign@…): * cc: jeremyhu@… (removed) * owner: macports-tickets@… => jeremyhu@… Old description:
Sorry I haven't figured out the diff files just yet.
llvm-3.9 build fails at 12% and then at 98% with error strnlen function not found
to fix:
in this file
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.9/llvm-3.9/work/trunk/lib/ObjectYAML/MachOYAML.cpp
and in this file
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.9/llvm-3.9/work/trunk/tools/obj2yaml/macho2yaml.cpp
add this replacement function after <string.h> and build succeeds (found an example in the cctools patches):
static size_t strnlen(const char *s, size_t maxlen) { size_t len;
for (len = 0; len < maxlen; len++, s++) { if (!*s) break; } return (len); }
New description: Sorry I haven't figured out the diff files just yet. llvm-3.9 build fails at 12% and then at 98% with error strnlen function not found to fix: in this file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.9/llvm-3.9/work/trunk/lib/ObjectYAML/MachOYAML.cpp and in this file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_llvm-3.9/llvm-3.9/work/trunk/tools/obj2yaml/macho2yaml.cpp add this replacement function after <string.h> and build succeeds (found an example in the cctools patches): {{{ static size_t strnlen(const char *s, size_t maxlen) { size_t len; for (len = 0; len < maxlen; len++, s++) { if (!*s) break; } return (len); } }}} -- -- Ticket URL: <https://trac.macports.org/ticket/51520#comment:1> MacPorts <https://www.macports.org/> Ports system for OS X
#51520: llvm-3.9 @3.9-r270400_0+assertions+debug build failure on snow leopard due to missing strnlen function - and fix -------------------------------------+------------------------- Reporter: kenneth.f.cunningham@… | Owner: jeremyhu@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: snowleopard Port: llvm-3.9 | -------------------------------------+------------------------- Comment (by jeremyhu@…): Yep. I reported it upstream a couple weeks ago: https://llvm.org/bugs/show_bug.cgi?id=27714 I'm not sure how we want to handle this for a proper solution. The static one-off will get us building again, but there is a more general question about how to handle portability issues like this in general going forward in llvm's codebase. -- Ticket URL: <https://trac.macports.org/ticket/51520#comment:2> MacPorts <https://www.macports.org/> Ports system for OS X
#51520: llvm-3.9 @3.9-r270400_0+assertions+debug build failure on snow leopard due to missing strnlen function - and fix -------------------------------------+------------------------- Reporter: kenneth.f.cunningham@… | Owner: jeremyhu@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: snowleopard Port: llvm-3.9 | -------------------------------------+------------------------- Comment (by kenneth.f.cunningham@…): I went through the process of installing <https://trac.macports.org/wiki/LibcxxOnOlderSystems> and then rebuilt clang-3.9, but this didn't fix the missing definition. This issue seems to apply to other software as well, of course. <http://stackoverflow.com/questions/32468480/strnlen-does-not-exist-in- gcc-4-2-1-on-mac-os-x-10-6-8-how-to-define-it>. Given SL's market share, it may not be reasonable to expect all upstream authors to support systems without strnlen. What do you think of the idea of modifying /usr/include/string.h on snow leopard to static inline the rare missing functions in the header file? I realize it's not a purist approach -- probably first class of first day of computer science school tells you not to do that. If that is not acceptable, there a way to override string.h, calling one in the /opt directory first that inlines the few missing functions after calling the original /usr/include/string.h. That at least leaves the factory distribution unmodified. -- Ticket URL: <https://trac.macports.org/ticket/51520#comment:3> MacPorts <https://www.macports.org/> Ports system for OS X
#51520: llvm-3.9 @3.9-r270400_0+assertions+debug build failure on snow leopard due to missing strnlen function - and fix -------------------------------------+------------------------- Reporter: kenneth.f.cunningham@… | Owner: jeremyhu@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: snowleopard Port: llvm-3.9 | -------------------------------------+------------------------- Comment (by jeremyhu@…): No, you should not be modifying your SDK to add a static inline version of strnlen. If we really wanted to go that route, we'd add -i${filesdir}/strnlen.h to CFLAGS, but I'm hoping to come up with a more general solution to this. -- Ticket URL: <https://trac.macports.org/ticket/51520#comment:4> MacPorts <https://www.macports.org/> Ports system for OS X
#51520: llvm-3.9 @3.9-r270400_0+assertions+debug build failure on snow leopard due to missing strnlen function - and fix -------------------------------------+------------------------- Reporter: kenneth.f.cunningham@… | Owner: jeremyhu@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: snowleopard Port: llvm-3.9 | -------------------------------------+------------------------- Comment (by jeremyhu@…): The issue also impacts older BSDs and other operating systems. While it has been around for a while, this function was only added to POSIX in SUSv4. -- Ticket URL: <https://trac.macports.org/ticket/51520#comment:5> MacPorts <https://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts