Skip to content

Release profile on x64 Windows generated without optimization flags when building under dev Cargo profile #240

Open
@vlovich

Description

@vlovich

This is with cmake 3.31.4

I observed that if I build llama.cpp from the command line:

mkdir build
cd build
cmake.exe ../ -DCMAKE_BUILD_TYPE=Release -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_SERVER=OFF
cmake.exe --build . -j 32 --config Release

the compiler flags comes out to:

CMAKE_CXX_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3 /GR /EHsc
CMAKE_CXX_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /DNDEBUG
CMAKE_C_FLAGS:STRING=/DWIN32 /D_WINDOWS /W3
CMAKE_C_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /DNDEBUG

by contrast, llama-cpp-rs's build script which uses this crate ends up generating:

CMAKE_CXX_FLAGS:STRING= -nologo -MD -Brepro
CMAKE_CXX_FLAGS_RELEASE:STRING= -nologo -MD -Brepro
CMAKE_C_FLAGS:STRING= -nologo -MD -Brepro
CMAKE_C_FLAGS_RELEASE:STRING= -nologo -MD -Brepro

when building the dev Cargo profile which seems wrong - optimizations shouldn't disappear from the Release CMake profile just because we're building under dev. The flags revert to the correct settings when built under release.

Filed upstream ticket to track it in both repos utilityai/llama-cpp-rs#649 but I suspect the fault has to lie with this crate since the build.rs isn't doing anything that would explain a change in this behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions