llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

LLVM 15.0.3 cmake file fails due to missing llvm-bolt

Open lerno opened this issue 3 years ago • 26 comments
trafficstars

LLVMExports.cmake is "faulty", complaining of missing llvm-bolt install.

2022-10-12T10:16:43.1944691Z -- The C compiler identification is Clang 15.0.3
2022-10-12T10:16:43.3702543Z -- The CXX compiler identification is Clang 15.0.3
2022-10-12T10:16:43.4881695Z -- Detecting C compiler ABI info
2022-10-12T10:16:43.6852526Z -- Detecting C compiler ABI info - done
2022-10-12T10:16:43.6948262Z -- Check for working C compiler: /usr/bin/clang-15 - skipped
2022-10-12T10:16:43.7015348Z -- Detecting C compile features
2022-10-12T10:16:43.7079205Z -- Detecting C compile features - done
2022-10-12T10:16:43.7279573Z -- Detecting CXX compiler ABI info
2022-10-12T10:16:43.8863684Z -- Detecting CXX compiler ABI info - done
2022-10-12T10:16:43.8960693Z -- Check for working CXX compiler: /usr/bin/clang++-15 - skipped
2022-10-12T10:16:43.8963927Z -- Detecting CXX compile features
2022-10-12T10:16:43.8971293Z -- Detecting CXX compile features - done
2022-10-12T10:16:43.9376157Z -- Performing Test HAVE_FFI_CALL
2022-10-12T10:16:44.0747441Z -- Performing Test HAVE_FFI_CALL - Success
2022-10-12T10:16:44.0826465Z -- Found FFI: /usr/lib/x86_64-linux-gnu/libffi.so  
2022-10-12T10:16:44.0890864Z -- Performing Test Terminfo_LINKABLE
2022-10-12T10:16:44.2189488Z -- Performing Test Terminfo_LINKABLE - Success
2022-10-12T10:16:44.2202348Z -- Found Terminfo: /usr/lib/x86_64-linux-gnu/libtinfo.so  
2022-10-12T10:16:44.2577518Z -- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
2022-10-12T10:16:44.3828267Z -- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.10") 
2022-10-12T10:16:44.4040265Z CMake Error at /usr/lib/llvm-15/lib/cmake/llvm/LLVMExports.cmake:1693 (message):
2022-10-12T10:16:44.4041150Z   The imported target "llvm-bolt" references the file
2022-10-12T10:16:44.4041684Z 
2022-10-12T10:16:44.4042198Z      "/usr/lib/llvm-15/bin/llvm-bolt"
2022-10-12T10:16:44.4042410Z 
2022-10-12T10:16:44.4042749Z   but this file does not exist.  Possible reasons include:
2022-10-12T10:16:44.4042969Z 
2022-10-12T10:16:44.4043166Z   * The file was deleted, renamed, or moved to another location.
2022-10-12T10:16:44.4043378Z 
2022-10-12T10:16:44.4043578Z   * An install or uninstall procedure did not complete successfully.
2022-10-12T10:16:44.4043815Z 
2022-10-12T10:16:44.4043981Z   * The installation package was faulty and contained
2022-10-12T10:16:44.4044192Z 
2022-10-12T10:16:44.4044462Z      "/usr/lib/llvm-15/lib/cmake/llvm/LLVMExports.cmake"
2022-10-12T10:16:44.4044677Z 
2022-10-12T10:16:44.4044809Z   but not all the files it references.
2022-10-12T10:16:44.4044979Z 
2022-10-12T10:16:44.4045110Z Call Stack (most recent call first):
2022-10-12T10:16:44.4045536Z   /usr/lib/llvm-15/cmake/LLVMConfig.cmake:336 (include)
2022-10-12T10:16:44.4045869Z   CMakeLists.txt:77 (find_package)
2022-10-12T10:16:44.4046033Z 
2022-10-12T10:16:44.4046054Z 
2022-10-12T10:16:44.4052407Z -- Configuring incomplete, errors occurred!
2022-10-12T10:16:44.4052850Z See also "/home/runner/work/c3c/c3c/build/CMakeFiles/CMakeOutput.log".

lerno avatar Oct 12 '22 12:10 lerno

install bolt-15 fixes your problem?

sylvestre avatar Oct 12 '22 12:10 sylvestre

It resolves that particular error, but in the linking step it now ends up with:

/usr/lib/x86_64-linux-gnu/libtinfo.so  /usr/lib/llvm-15/lib/libLLVMDemangle.a && :
/usr/bin/ld: /usr/lib/llvm-15/lib/libLLVMAArch64AsmParser.a: error adding symbols: archive has no index; run ranlib to add one
clang: error: linker command failed with exit code 1 (use -v to see invocation)

lerno avatar Oct 12 '22 13:10 lerno

Probably #58316 is related.

EugeneZelenko avatar Oct 12 '22 13:10 EugeneZelenko

yeah, they are duped

sylvestre avatar Oct 12 '22 14:10 sylvestre

About the ar issue, it is a different issue (i enabled LTO)

sylvestre avatar Oct 12 '22 14:10 sylvestre

@sylvestre Regarding LTO, I previously had problems with homebrew enabling LTO in their llvm15 package, as this prevented linking with anything except the exact same Clang version they used. So nothing worked.

lerno avatar Oct 12 '22 14:10 lerno

oh :|

sylvestre avatar Oct 12 '22 14:10 sylvestre

They then switched to thinLTO which also didn't work :(

lerno avatar Oct 12 '22 14:10 lerno

ok, I restarted the builds with llvm-bolt and disabled LTO (for now)

sylvestre avatar Oct 12 '22 14:10 sylvestre

@sylvestre Regarding LTO, I previously had problems with homebrew enabling LTO in their llvm15 package, as this prevented linking with anything except the exact same Clang version they used. So nothing worked.

This issue in Homebrew was resolved in https://github.com/Homebrew/homebrew-core/pull/112154, right? I does work for me now.

banach-space avatar Oct 12 '22 15:10 banach-space

This issue in Homebrew was resolved in https://github.com/Homebrew/homebrew-core/pull/112154, right?

I did that but I am pretty sure that my script is failing :)

sylvestre avatar Oct 12 '22 15:10 sylvestre

Yes, the brew issue was resolved.

lerno avatar Oct 12 '22 15:10 lerno

Is this fixed? Can we close this issue?

tru avatar Oct 13 '22 11:10 tru

No, while the workaround with bolt-15 now seems to be ok, I don't think CMake for LLVM targets should break if bolt-15 isn't imported.

lerno avatar Oct 13 '22 11:10 lerno

I think I fixed in the repo. Not sure that the builds are all completed

sylvestre avatar Oct 13 '22 12:10 sylvestre

I'll try later, because it doesn't work yet.

lerno avatar Oct 13 '22 12:10 lerno

How can I check that I'm using the version with the fix? I still see the LLVMExport failure if I don't import bolt-15.

lerno avatar Oct 13 '22 17:10 lerno

It doesn't seem to have helped @sylvestre. I see my tests trying to compile both with a version from 2022-10-12 and later with one from 2022-10-13, both fails the same way.

lerno avatar Oct 14 '22 07:10 lerno

@lerno what is the result of grep bolt /usr/lib/llvm-15/lib/cmake/llvm/LLVMExports-release.cmake ?

sylvestre avatar Oct 14 '22 11:10 sylvestre

It seems to be this:

# Import target "llvm-bolt" for configuration "Release"
set_property(TARGET llvm-bolt APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(llvm-bolt PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/llvm-bolt"
list(APPEND _IMPORT_CHECK_TARGETS llvm-bolt )
list(APPEND _IMPORT_CHECK_FILES_FOR_llvm-bolt "${_IMPORT_PREFIX}/bin/llvm-bolt" )
# Import target "llvm-bolt-heatmap" for configuration "Release"
set_property(TARGET llvm-bolt-heatmap APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(llvm-bolt-heatmap PROPERTIES
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/llvm-bolt-heatmap"
list(APPEND _IMPORT_CHECK_TARGETS llvm-bolt-heatmap )
list(APPEND _IMPORT_CHECK_FILES_FOR_llvm-bolt-heatmap "${_IMPORT_PREFIX}/bin/llvm-bolt-heatmap" )

lerno avatar Oct 14 '22 12:10 lerno

ok, thanks :) I think I have a fix!

sylvestre avatar Oct 14 '22 12:10 sylvestre

Let me know when I can test again. Also, it looks like this problem found its way into 16 now.

lerno avatar Oct 15 '22 01:10 lerno

I think it is now fixed on the repo

sylvestre avatar Oct 15 '22 09:10 sylvestre

Thanks for looking into this!

From the latest run of llvm-tutor (which depends on these packages):

CMake Error at /usr/lib/llvm-15/lib/cmake/llvm/LLVMExports.cmake:1693 (message):
  The imported target "merge-fdata" references the file

-- Configuring incomplete, errors occurred!
     "/usr/lib/llvm-15/bin/merge-fdata"

See also "/home/runner/work/llvm-tutor/llvm-tutor/HelloWorld/build/CMakeFiles/CMakeOutput.log".
  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib/llvm-15/lib/cmake/llvm/LLVMExports.cmake"

  but not all the files it references.

merge-fdata is a bolt tool. So one step forward, but not quite there yet :)

banach-space avatar Oct 15 '22 10:10 banach-space

This should be fixed too in the next rebuild: https://salsa.debian.org/pkg-llvm-team/llvm-toolchain/-/commit/992e52c0b156a5ba9c6a8a54f8c4857ddd3d371d

sylvestre avatar Oct 15 '22 10:10 sylvestre

The LLVM 15 version is still on 20221014 with the "merge-fdata" error. LLVM 16 on 20221015 is showing a new error, missing "/usr/lib/llvm-16/bin/llvm-bat-dump" instead. @sylvestre

lerno avatar Oct 16 '22 17:10 lerno

It appears that 15.0.3 now works. But the issue in LLVM-16 remains (missing /usr/lib/llvm-16/bin/llvm-bat-dump)

lerno avatar Oct 18 '22 11:10 lerno

unrelated to 15.0.3 :)

sylvestre avatar Oct 18 '22 12:10 sylvestre

Well that 15.0.3 works is related ;) Also 16 seems to work when bolt is included.

lerno avatar Oct 18 '22 17:10 lerno

Just curious if there is any general plan for LLVM to fix this directly? There's really no reason to check for lots of targets the user didn't ask for and then fail?

eli-schwartz avatar Jan 20 '23 19:01 eli-schwartz