Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build error /usr/bin/ld.lld: error: unknown argument: --push-state #9

Open
victorygogogo opened this issue Jul 13, 2021 · 4 comments
Open

Comments

@victorygogogo
Copy link

-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/e0004850/project_code/llvm_for_hlo/llvm-build

  • cmake --build /home/e0004850/project_code/mlir-hlo/../llvm_for_hlo/llvm-build --target all --target mlir-cpu-runner
    [383/2912] Linking C executable bin/count
    FAILED: bin/count
    : && /usr/bin/cc -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-comment -fdiagnostics-color -O2 -g -DNDEBUG -fuse-ld=lld -W
    l,--color-diagnostics -Wl,-O3 -Wl,--gc-sections utils/count/CMakeFiles/count.dir/count.c.o -o bin/count -Wl,-rpath,"$ORIGIN/../lib" -lpthread && :
    /usr/bin/ld.lld: error: unknown argument: --push-state
    /usr/bin/ld.lld: error: unknown argument: --pop-state
    /usr/bin/ld.lld: error: unknown argument: --push-state
    /usr/bin/ld.lld: error: unknown argument: --pop-state

    collect2: error: ld returned 1 exit status
    [416/2912] Building CXX object lib/DebugInfo/CodeView/CMakeFiles/LLVMDebugInfoCodeView.dir/EnumTables.cpp.o
    ninja: build stopped: subcommand failed.

how to solve this problem

@victorygogogo
Copy link
Author

if use "DLLVM_INSTALL_UTILS=ON" will cause this problem.

@joker-eph
Copy link
Contributor

The issue seems like mixing gcc with the lld linker. Which version of gcc are you using? (/usr/bin/cc --version)
Disabling -DLLVM_ENABLE_LLD=ON or building with clang (or a more recent gcc) should work I think?

@victorygogogo
Copy link
Author

gcc version (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0 ,
Disabling -DLLVM_ENABLE_LLD=ON build is ok when use "build_tools/build_mlir.sh ${PWD}/llvm-project/ ${PWD}/llvm-build" this command
$ mkdir build && cd build
$ cmake .. -GNinja
-DLLVM_ENABLE_LLD=ON
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_ASSERTIONS=On
-DMLIR_DIR=${PWD}/../llvm-build/lib/cmake/mlir
$ ninja check-mlir-hlo
use the above command, set -DLLVM_ENABLE_LLD=OFF \ cause a link problem , so set -DLLVM_ENABLE_LLD=ON build is ok, is there any problem build like this?

and how to build wth clang ,can you tell me ?

@joker-eph
Copy link
Contributor

-DCMAKE_C_COMPILER=<path_to_clang> -DCMAKE_CXX_COMPILER=<path_to_clang++>

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

No branches or pull requests

2 participants