Opened 12 months ago

Closed 12 months ago

Last modified 12 months ago

#71880 closed defect (fixed)

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

Reported by: mascguy (Christopher Nielsen) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.10.5
Keywords: Cc: i0ntempest
Port: llama.cpp

Description

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:

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

Change History (2)

comment:1 Changed 12 months ago by Christopher Nielsen <mascguy@…>

Resolution: fixed
Status: assignedclosed

In 1304a7d9aec264b9dd3331f27f7301428c0217b5/macports-ports (master):

llama.cpp: update to 4508; fix builds on 10.15 and earlier

  • Explicitly disable OpenMP

Fixes: #71870

  • Upstream patch for errno-related build failure on 10.15:

Fixes: #71880

squash

comment:2 Changed 12 months ago by mascguy (Christopher Nielsen)

Upstream just accepted and merged the contributed fix, so it should be present in the next release.

Note: See TracTickets for help on using tickets.