Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@otegami
Copy link
Contributor

@otegami otegami commented Oct 15, 2025

Issue

We got the following error when we built Groonga with MariaDB.

/home/buildbot/_deps/llama_cpp-src/ggml/src/ggml-cpu/ggml-cpu.c:3567:24: error: passing argument 1 of 'putenv' discards 'const' qualifier from pointer target type [-Werro =discarded-qualifiers]

Cause

When building Groonga with MariaDB, the bundled llama.cpp triggers -Werror.

Solution

Upstream llama.cpp doesn't setup discarded-qualifiers, so we suppress the warning by explicitly passing -Wno-discarded-qualifiers in Debug and RelWithDebInfo builds.

## Issue

We got the following error when we built Groonga with MariaDB.

```
/home/buildbot/_deps/llama_cpp-src/ggml/src/ggml-cpu/ggml-cpu.c:3567:24: error: passing argument 1 of 'putenv' discards 'const' qualifier from pointer target type [-Werro =discarded-qualifiers]
```

## Cause

When building Groonga with MariaDB, the bundled llama.cpp triggers `-Werror`.

## Solution

Upstream llama.cpp doesn't setup discarded-qualifiers,
so we suppress the warning by explicitly passing `-Wno-discarded-qualifiers` in Debug and RelWithDebInfo builds.
@otegami otegami force-pushed the suppress-discarded-qualifiers branch from e371e2e to 1ea199e Compare October 15, 2025 08:26
```
rm -rf ../llama.cpp.build && \
cmake \
  -S . \
  -B ../llama.cpp.build \
  --preset=x64-linux-gcc-debug \
  -DCMAKE_C_COMPILER=clang \
  -DCMAKE_CXX_COMPILER=clang++ \
  -DCMAKE_INSTALL_PREFIX=/tmp/local \
  -DCMAKE_C_FLAGS="-Wwrite-strings -Werror=incompatible-pointer-types-discards-qualifiers" && \
cmake --build ../llama.cpp.build/
...
/home/otegami/work/cpp/llama.cpp/ggml/src/ggml-cpu/ggml-cpu.c:3572:24: error: passing 'const char[18]' to parameter of type 'char *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
 3572 |                 putenv("KMP_BLOCKTIME=200"); // 200ms
      |                        ^~~~~~~~~~~~~~~~~~~
```
@otegami otegami force-pushed the suppress-discarded-qualifiers branch from 1ea199e to a615aaf Compare October 15, 2025 10:24
@kou kou merged commit b9dc6a2 into groonga:main Oct 17, 2025
42 checks passed
@kou kou deleted the suppress-discarded-qualifiers branch October 17, 2025 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants