Skip to content

opt can't load pass #176

Closed
Closed
@posutsai

Description

@posutsai

Hi I was trying to build LLVM from source and I already tried llvmorg-10.0.0-rc3 and llvmorg-11-init two versions. Previously the LLVM tool I used was installed from ubuntu apt package tool and my code works very well with it. However, when I switch to the opt that was built from source, it always output following error message. I am pretty sure the issue doesn't come from the loaded pass shared object file itself because opt prints same error after I load the HelloPass from the tutorial.

opt: CommandLine Error: Option 'debug-pass' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

I simply follow the instructions from the official website. Here's how I build LLVM.

git clone https://github.com/llvm/llvm-project.git
mkdir build && cd build
cmake -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS="clang" -DCMAKE_BUILD_TYPE="Release" ../llvm
make && make install

After some searching on Google, I doubt the issue comes from version conflict. Yet opt outputs the same message when I remove all of other version on my server. Thanks for your help and please let me know if the further information is needed.

Referring to these two similar issues,

  1. LLVM linking: CommandLine Error: Option 'help-list' registered more than once! LLVM ERROR: inconsistency in registered CommandLine options
  2. "opt: CommandLine Error: Option 'disable-symbolication' registered more than once!" when building with dg library
    I think it's necessary to show how I compile the Pass source code and input it into opt.
clang-10 -fPIC -c HelloPass.cpp -o HelloPass.o `llvm-config --cxxflags`
clang-10 -shared -o HelloPass.so HelloPass.o `llvm-config --ldflags --libs --system-libs`
opt -load HelloPass.so -hello-pass -S < source.ll > /dev/null

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