[MacPorts] #71880: llama.cpp: build fails on 10.15, due to use of 'errno' in src/llama-mmap.cpp; fix contributed to upstream

MacPorts noreply at macports.org
Sat Jan 18 21:28:39 UTC 2025


#71880: llama.cpp: build fails on 10.15, due to use of 'errno' in src/llama-
mmap.cpp; fix contributed to upstream
---------------------+-----------------------
 Reporter:  mascguy  |      Owner:  mascguy
     Type:  defect   |     Status:  assigned
 Priority:  Normal   |  Milestone:
Component:  ports    |    Version:  2.10.5
 Keywords:           |       Port:  llama.cpp
---------------------+-----------------------
 On macOS 10.15 - and perhaps other systems/OSs - builds fail due to use of
 `errno`:

 {{{
 /opt/local/var/macports/build/_opt_macports_sources_ports_latest_llm_llama.cpp/llama.cpp/work/llama.cpp-4508/src
 /llama-mmap.cpp:159:86: error: use of undeclared identifier 'errno'
             throw std::runtime_error(format("failed to open %s: %s",
 fname, strerror(errno)));
 ^
 /opt/local/var/macports/build/_opt_macports_sources_ports_latest_llm_llama.cpp/llama.cpp/work/llama.cpp-4508/src
 /llama-mmap.cpp:174:73: error: use of undeclared identifier 'errno'
             throw std::runtime_error(format("ftell error: %s",
 strerror(errno)));
                                                                         ^
 /opt/local/var/macports/build/_opt_macports_sources_ports_latest_llm_llama.cpp/llama.cpp/work/llama.cpp-4508/src
 /llama-mmap.cpp:188:72: error: use of undeclared identifier 'errno'
             throw std::runtime_error(format("seek error: %s",
 strerror(errno)));
                                                                        ^
 /opt/local/var/macports/build/_opt_macports_sources_ports_latest_llm_llama.cpp/llama.cpp/work/llama.cpp-4508/src
 /llama-mmap.cpp:196:9: error: use of undeclared identifier 'errno'
         errno = 0;
         ^

 [...etc, etc...]
 }}}

 The fix is to simply add an include for `<cerrno>`. An issue was submitted
 to upstream, along with a corresponding PR:

 * [https://github.com/ggerganov/llama.cpp/issues/11295 Issue 11295 -
 Compile bug: llama-mmap.cpp: use of errno without including <cerrno>,
 causes build failures on some systems]
 * [https://github.com/ggerganov/llama.cpp/pull/11296 PR 11296 - fix:
 llama-mmap: add include for cerrno]

 I'll add the fix to the existing PR, encompassing separate build fixes for
 earlier macOS releases:

 * [https://github.com/macports/macports-ports/pull/27409 PR 27409 -
 llama.cpp: fix builds for 10.15 and earlier]

-- 
Ticket URL: <https://trac.macports.org/ticket/71880>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list