使用LLVM库编译或运行出现错误的一些解决办法

    科技2022-09-08  148

    1.编译成功,提示Option注册了多次

    效果图:

    提示Option xxx registerd more than once! LLVM ERROR: inconsistency in registerd CommandLine options

    原因分析:

    如果使用的是CMake进行查找依赖的话,如llvm_map_components_to_libnames,可能是因为:

    安装了多个LLVM版本,导致查找时得到了多次相同的Option

    解决方法:

    只保留一个LLVM版本尝试将后面链接处改成LLVM而不是之前找到的llvm_libs(如上图)

    2. 编译失败,提示-lxxx not found

    如图:

    connot find -ledit

    connot find -lz

    原因分析:

    缺少lib库

    解决方法:

    安装libedit-dev以及zlib1g-dev即可

    3. CMake配置失败,找到LLVM但提示yaml-bench不存在

    如图:

    原因分析:

    测试在LLVM 9.0.0中不存在这个软件包,但在9.0.1中测试包含

    解决方法:

    由于该文件不是很必须的文件,所以可以尝试touch该文件

    尝试安装libclang-common-9-dev

    Processed: 0.008, SQL: 9