Skip to content

Error while building: _FORTIFY_SOURCE requires compiling with optimization #27

@olynch

Description

@olynch

I'm trying to use melior, and I'm getting an error while building tblgen:

warning: [email protected]: In file included from /nix/store/qdknxw57cwy1jkrhq7fzmiis73j42jv6-gcc-14.3.0/include/c++/14.3.0/x86_64-unknown-linux-gnu/bits/os_defines.h:39,
warning: [email protected]:                  from /nix/store/qdknxw57cwy1jkrhq7fzmiis73j42jv6-gcc-14.3.0/include/c++/14.3.0/x86_64-unknown-linux-gnu/bits/c++config.h:683,
warning: [email protected]:                  from /nix/store/qdknxw57cwy1jkrhq7fzmiis73j42jv6-gcc-14.3.0/include/c++/14.3.0/bits/memoryfwd.h:48,
warning: [email protected]:                  from /nix/store/qdknxw57cwy1jkrhq7fzmiis73j42jv6-gcc-14.3.0/include/c++/14.3.0/memory:63,
warning: [email protected]:                  from cc/lib/TableGen.hpp:14,
warning: [email protected]:                  from cc/lib/TableGen.cpp:11:
warning: [email protected]: /nix/store/9ly5qx1lbj0q1rcsf1dc0m9n3db6ii60-glibc-2.40-66-dev/include/features.h:422:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
warning: [email protected]:   422 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
warning: [email protected]:       |    ^~~~~~~
warning: [email protected]: cc1plus: all warnings being treated as errors
error: failed to run custom build command for `tblgen v0.6.0`

I'm using a version of llvm that I built from source with options:

cmake -G Ninja ../llvm    -DLLVM_ENABLE_PROJECTS='mlir;clang'    -DLLVM_BUILD_EXAMPLES=ON    -DLLVM_TARGETS_TO_BUILD="Native"    -DCMAKE_BUILD_TYPE=Release    -DLLVM_ENABLE_ASSERTIONS=ON    -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++    -DLLVM_CCACHE_BUILD=ON -DLLVM_SOURCE_PREFIX=. -DCMAKE_INSTALL_PREFIX:PATH=/home/o/.local/software/llvm/versions/20.1.

I'm not sure if this is a bug with build.rs or if it's something I'm doing wrong.

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