This is an archive of the discontinued LLVM Phabricator instance.

Define/guard MLIR_STANDALONE_BUILD LLVM_LIBRARY_OUTPUT_INTDIR var.
ClosedPublic

Authored by stellaraccident on Jun 20 2023, 1:08 PM.

Details

Summary

It looks like MLIR is using the more modern CMAKE_LIBRARY_OUTPUT_DIRECTORY, but AddLLVM still uses this older LLVM specific alias.

In the specific case I was running into, the empty variable was causing -Wl,-rpath-link, on the command line, causing the following argument to be swallowed. This was maddening, because the following argument was the .o file containing main and I was getting main undefined errors when it was clearly there. This is egregious enough that I chose to guard it.

Diff Detail

Event Timeline

Herald added projects: Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptJun 20 2023, 1:08 PM
stellaraccident requested review of this revision.Jun 20 2023, 1:08 PM
stellaraccident retitled this revision from WIP: Define/guard MLIR_STANDALONE_BUILD LLVM_LIBRARY_OUTPUT_INTDIR var. to Define/guard MLIR_STANDALONE_BUILD LLVM_LIBRARY_OUTPUT_INTDIR var..Jun 20 2023, 1:08 PM
stellaraccident added a reviewer: mehdi_amini.
stellaraccident added a reviewer: jpienaar.
mehdi_amini accepted this revision.Jun 20 2023, 1:18 PM

Oh wow, yet another fun debugging story :)

This revision is now accepted and ready to land.Jun 20 2023, 1:18 PM
jpienaar accepted this revision.Jun 20 2023, 1:21 PM

Thanks!

This revision was landed with ongoing or failed builds.Jun 20 2023, 2:14 PM
This revision was automatically updated to reflect the committed changes.
tmatheson added a subscriber: tmatheson.EditedJun 21 2023, 8:00 AM

I don't think this is the right fix, as all the other uses of LLVM_LIBRARY_OUTPUT_INTDIR in AddLLVM are optional. See for example D13215.

Anyone building against an installed LLVM now has to define LLVM_LIBRARY_OUTPUT_INTDIR or their build will fail.

I don't think this is the right fix, as all the other uses of LLVM_LIBRARY_OUTPUT_INTDIR in AddLLVM are optional. See for example D13215.

Anyone building against an installed LLVM now has to define LLVM_LIBRARY_OUTPUT_INTDIR or their build will fail.

Good point. Shall I patch this to only add the rpath-link flag if that is set.

TBH - I was looking at this locally and just saw that it was non optional in fact (it. It corrupts the liner command line) and didn't ask the question as to whether the entire check should be conditioned.

Let me do a revert because it sounds like it will break people. Then can roll forward a proper fix.