flang-compiler / f18

F18 is a front-end for Fortran intended to replace the existing front-end in the Flang compiler
230 stars 48 forks source link

Can't build shared libraries. #1092

Closed ghost closed 4 years ago

ghost commented 4 years ago

I tried to build f18 using this configuration:

cmake ../.. -DCMAKE_C_COMPILER=clang-9 -DCMAKE_CXX_COMPILER=clang++-9 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/f18 -DCMAKE_CXX_STANDARD=17 -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_LIBCXX=ON -DLLVM_ENABLE_LLD=ON -DCMAKE_PREFIX_PATH=/opt/f18/

``/opt/f18``` is where I installed llvm+mlir. I got this error:

[  4%] Linking CXX shared library ../libFortranCommon.so
ld.lld: error: undefined symbol: llvm::DisableABIBreakingChecks
>>> referenced by Fortran-features.cpp
>>>               CMakeFiles/FortranCommon.dir/Fortran-features.cpp.o:(llvm::VerifyDisableABIBreakingChecks)
clang: error: linker command failed with exit code 1 (use -v to see invocation
lib/Common/CMakeFiles/FortranCommon.dir/build.make:128: recipe for target 'lib/libFortranCommon.so' failed
make[2]: *** [lib/libFortranCommon.so] Error 1
CMakeFiles/Makefile2:955: recipe for target 'lib/Common/CMakeFiles/FortranCommon.dir/all' failed
make[1]: *** [lib/Common/CMakeFiles/FortranCommon.dir/all] Error 2

the error doesn't occur when "BUILD_SHARED_LIBS" is not set or "-DBUILD_SHARED_LIBS=OFF"

DavidTruby commented 4 years ago

Does MLIR now support building with shared libraries? The reason I didn't get this working when merging the changed CMake files is that at the time it didn't, but perhaps that has been fixed now?

ghost commented 4 years ago

I didn't get any error when building llvm+mlir with shared libraries.

sscalpone commented 4 years ago

Anecdotally, I heard mlir would fail with an initialization error when used as shared libraries. @ChinouneMehdi Can you confirm that f18 is working ok with mlir shared libraries?

ghost commented 4 years ago

@sscalpone All the tests pass when building f18 with mlir shared libraries.

DavidTruby commented 4 years ago

Hi, why have you closed this? Is the problem resolved now?