Using Clang 16 with LLVM 15 to emit IR

Hello,

So on my distribution I have Clang 16. The project I’m trying to build only support LLVM 15.

When I build I have the following error:

[53/138] cd /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/src/liboslexec && /usr/bin/clang++ -DOSL_FAST_MATH=1 -DOSL_INTERNAL=1 -DOIIO_DISABLE_DEPRECATED=1 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DOIIO_HIDE_FORMAT=1 -DOSL_LLVM_VERSION=150 -DOSL_LLVM_FULL_VERSION="15.0.7" -Dosoparse=OSL_v1_12_osoparse -Doslparse=OSL_v1_12_oslparse -std=c++17 -fno-use-cxa-atexit -Xclang -no-opaque-pointers -DOSL_FAST_MATH=1 -DOSL_INTERNAL=1 -DOIIO_DISABLE_DEPRECATED=1 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DOIIO_HIDE_FORMAT=1 -DOSL_LLVM_VERSION=150 -DOSL_LLVM_FULL_VERSION="15.0.7" -Dosoparse=OSL_v1_12_osoparse -Doslparse=OSL_v1_12_oslparse -std=c++17 -fno-use-cxa-atexit -Xclang -no-opaque-pointers -I/builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/src/liboslexec -I/builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/src/include -I/builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/include -I/usr/include -I/usr/include -I/usr/include -DOSL_COMPILING_TO_BITCODE=1 -Wno-deprecated-register -Wno-ignored-attributes -Wno-unknown-attributes -O3 -fno-math-errno -S -emit-llvm -o /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/src/liboslexec/llvm_ops_host_rs.s llvm_ops.cpp && /usr/lib64/llvm15/bin/llvm-as -f -o /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/src/liboslexec/llvm_ops_host_rs.bc /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/src/liboslexec/llvm_ops_host_rs.s
FAILED: src/liboslexec/llvm_ops_host_rs.bc /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/src/liboslexec/llvm_ops_host_rs.bc 
cd /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/src/liboslexec && /usr/bin/clang++ -DOSL_FAST_MATH=1 -DOSL_INTERNAL=1 -DOIIO_DISABLE_DEPRECATED=1 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DOIIO_HIDE_FORMAT=1 -DOSL_LLVM_VERSION=150 -DOSL_LLVM_FULL_VERSION="15.0.7" -Dosoparse=OSL_v1_12_osoparse -Doslparse=OSL_v1_12_oslparse -std=c++17 -fno-use-cxa-atexit -Xclang -no-opaque-pointers -DOSL_FAST_MATH=1 -DOSL_INTERNAL=1 -DOIIO_DISABLE_DEPRECATED=1 -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DOIIO_HIDE_FORMAT=1 -DOSL_LLVM_VERSION=150 -DOSL_LLVM_FULL_VERSION="15.0.7" -Dosoparse=OSL_v1_12_osoparse -Doslparse=OSL_v1_12_oslparse -std=c++17 -fno-use-cxa-atexit -Xclang -no-opaque-pointers -I/builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/src/liboslexec -I/builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/src/include -I/builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/include -I/usr/include -I/usr/include -I/usr/include -DOSL_COMPILING_TO_BITCODE=1 -Wno-deprecated-register -Wno-ignored-attributes -Wno-unknown-attributes -O3 -fno-math-errno -S -emit-llvm -o /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/src/liboslexec/llvm_ops_host_rs.s llvm_ops.cpp && /usr/lib64/llvm15/bin/llvm-as -f -o /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/src/liboslexec/llvm_ops_host_rs.bc /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/src/liboslexec/llvm_ops_host_rs.s
/usr/lib64/llvm15/bin/llvm-as: /builddir/build/BUILD/OpenShadingLanguage-1.12.13.0/redhat-linux-build/src/liboslexec/llvm_ops_host_rs.s:13308:79: error: unterminated attribute group
attributes #0 = { alwaysinline mustprogress nofree nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

Hardly found something about this error message.

Could it be caused by mixing Clang and LLVM version? Some incompatibility with the IR?

Thanks.

Yes. Don’t do that. Textual IR has no compatibility guarantees, and bitcode only has the guarantee that it can be used by a //newer// LLVM. Going backwards is never guaranteed to work.

2 Likes