macosllvmzshvhdlghdl

Compiling VHDL file with ```ghdl -a``` encountered error ```ghdl:error: installation problem: ghdl1-llvm not found```


I was recently trying to compile the .vhd file with ghdl ghdl -a --ieee=synopsys --work=work Matrix_Data_Structure.vhd , the following error occurred :

ghdl:error: installation problem: ghdl1-llvm not found

I am running ghdl on the MacOS system, installed with brew

I tried to also install llvm and add path to zshrc :

echo 'export PATH="/opt/homebrew/opt/llvm@12/bin:$PATH"' >> ~/.zshrc
echo 'export LDFLAGS="-L/opt/homebrew/opt/llvm@12/lib"' >> ~/.zshrc
echo 'export CPPFLAGS="-I/opt/homebrew/opt/llvm@12/include"' >> ~/.zshrc

as well as uninstall ghdl and reinstall ghdl, the same error message persisted

-------Edit: Extra Info--------------------------------------------- ghdl --version GHDL 4.1.0 (4.0.0.r39.g7188e92cf) [Dunoon edition]

OS version :macOS Sonoma version 14.6 GDHL path :/opt/homebrew/bin/ghdl


Solution

  • The problem was solved by directly git clone from the ghdl repository then build and install it, then add path to zshrc:

    # Clone the LLVM repository
    git clone https://github.com/llvm/llvm-project.git
    cd llvm-project
    
    # Create a build directory
    mkdir build
    cd build
    
    # Configure the build
    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/llvm ../llvm
    
    # Build and install LLVM
    make
    sudo make install
    
    # Add paths to .zshrc
    echo 'export PATH="/usr/local/llvm/bin:$PATH"' >> ~/.zshrc
    echo 'export LDFLAGS="-L/usr/local/llvm/lib"' >> ~/.zshrc
    echo 'export CPPFLAGS="-I/usr/local/llvm/include"' >> ~/.zshrc
    echo 'export DYLD_LIBRARY_PATH="/usr/local/llvm/lib:$DYLD_LIBRARY_PATH"' >> ~/.zshrc
    
    # Apply the changes
    source ~/.zshrc
    
    # Verify the installation
    llvm-config --version