If flang links with LLVM_DYLIB, there's no need to link the support library again.
Details
Diff Detail
Event Timeline
Thanks for fixing this. I tested in my build environment. I could reproduce the failure without this fix at build time with LLVM_LINK_LLVM_DYLIB when Generating ../../include/flang/__fortran_builtins.mod. With this fix, I can still build OK without LLVM_LINK_LLVM_DYLIB. With LLVM_LINK_LLVM_DYLIB, flang now builds, but I see 14 flang regression tests are failing with error CommandLine Error: Option 'disable-symbolication' registered more than once!. I think it may be a test linking issue that is remaining, but at least LLVM_LINK_LLVM_DYLIB now works to build flang.
Thanks. I'll try to fix this duplicate link issue before commiting this (incomplete) patch then :-)
Harmonize usage of LLVM components througout Flang.
Explicit LLVM Libs where used across several CMakeFIles, which led to incompatibilities with LLVM shlibs.
Fortunately, the LLVM component system can be relied on to harmoniously handle both cases.
Thanks for this update, I just finished testing it. There is one issue with a really really slow test being run in regression (see inline comment). Apart from that, this patch built in my environment with/without LLVM_LINK_LLVM_DYLIB in/out of LLVM tree.
flang/unittests/Decimal/CMakeLists.txt | ||
---|---|---|
7 ↗ | (On Diff #296261) | With this change, thorough-test is now run with make check-flang regression tests which we would like to avoid because it can take ~1hour to run. I think this is because lit just tries to run whatever executable are ending with ".test" in this folder. To fix that, add_flang_nongtest_unittest could avoid adding the ".test" extension to the executable in case SLOW_TEST is passed to it. |
I can build and run tests as expected with and without LLVM_LINK_LLVM_DYLIB now. Thanks for making flang work with this build option !
@serge-sans-paille Thank you for working on this! Sadly the Flang buildbot is unhappy again:http://lab.llvm.org:8014/#/builders/109/builds/35. I'm guessing that you didn't test with -DFLANG_BUILD_NEW_DRIVER=ON?
IIUC, the add_flang_tool macro needs fixing/updating. I'll take a look and submit something. Perhaps I'll need to revert the changes in flang/tools/flang-driver/CMakeLists.txt. in the interim.
flang/tools/flang-driver/CMakeLists.txt | ||
---|---|---|
11 ↗ | (On Diff #298129) | Sadly, add_flang_tool doesn't understand this syntax: http://lab.llvm.org:8014/#/builders/109/builds/35 |
The CMake error for flang-new is now fixed, but I'm no longer able to build Flang with BUILD_SHARED_LIBS=On. @serge-sans-paille , have you tested that configuration? I'm struggling to find a fix.