aguinet / dragonffi

C Foreign Function Interface and JIT using Clang/LLVM
Apache License 2.0
548 stars 23 forks source link

No member named 'getProcessTriple' in namespace 'llvm::sys' , on FreeBSD 13.0 #52

Closed advancedwebdeveloper closed 3 years ago

advancedwebdeveloper commented 3 years ago

Hi.

The bug is related to https://llvm.org/doxygen/namespacellvm_1_1sys.html#aab375071f641a086c0d7067635ccd3dc https://github.com/llvm/llvm-project/blob/213aea4c5836934771eb97eb97e4c964053a8596/llvm/include/llvm/Support/Host.h#L36

$cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -G Ninja .. -- The C compiler identification is Clang 11.0.0 -- The CXX compiler identification is Clang 11.0.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/clang - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/clang++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Using llvm-config: /usr/bin/llvm-config -- LLVM prefix: /usr -- Clang cmake directory: /usr/lib/cmake/clang -- Clang link dylib: OFF -- Performing Test LLVM_LIBSTDCXX_MIN -- Performing Test LLVM_LIBSTDCXX_MIN - Success -- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR -- Performing Test LLVM_LIBSTDCXX_SOFT_ERROR - Success -- Performing Test C_SUPPORTS_FPIC -- Performing Test C_SUPPORTS_FPIC - Success -- Performing Test CXX_SUPPORTS_FPIC -- Performing Test CXX_SUPPORTS_FPIC - Success -- Building with -fPIC -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG -- Performing Test SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG - Success -- Performing Test C_SUPPORTS_WERROR_DATE_TIME -- Performing Test C_SUPPORTS_WERROR_DATE_TIME - Success -- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME -- Performing Test CXX_SUPPORTS_WERROR_DATE_TIME - Success -- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW -- Performing Test C_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success -- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW -- Performing Test CXX_SUPPORTS_WERROR_UNGUARDED_AVAILABILITY_NEW - Success -- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS -- Performing Test LINKER_SUPPORTS_COLOR_DIAGNOSTICS - Success -- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS -- Performing Test C_SUPPORTS_FNO_FUNCTION_SECTIONS - Success -- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS -- Performing Test C_SUPPORTS_FFUNCTION_SECTIONS - Success -- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS -- Performing Test CXX_SUPPORTS_FFUNCTION_SECTIONS - Success -- Performing Test C_SUPPORTS_FDATA_SECTIONS -- Performing Test C_SUPPORTS_FDATA_SECTIONS - Success -- Performing Test CXX_SUPPORTS_FDATA_SECTIONS -- Performing Test CXX_SUPPORTS_FDATA_SECTIONS - Success CMake Warning (dev) at /usr/lib/cmake/llvm/HandleLLVMOptions.cmake:852 (option): Policy CMP0077 is not set: option() honors normal variables. Run "cmake --help-policy CMP0077" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the normal variable 'LLVM_ENABLE_EH'. Call Stack (most recent call first): CMakeLists.txt:59 (include) This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/lib/cmake/llvm/HandleLLVMOptions.cmake:853 (option): Policy CMP0077 is not set: option() honors normal variables. Run "cmake --help-policy CMP0077" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the normal variable 'LLVM_ENABLE_RTTI'. Call Stack (most recent call first): CMakeLists.txt:59 (include) This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at /usr/local/share/cmake/Modules/CMakeDependentOption.cmake:39 (option): Policy CMP0077 is not set: option() honors normal variables. Run "cmake --help-policy CMP0077" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the normal variable 'LLVM_EXPORT_SYMBOLS_FOR_PLUGINS'. Call Stack (most recent call first): /usr/lib/cmake/llvm/HandleLLVMOptions.cmake:1006 (CMAKE_DEPENDENT_OPTION) CMakeLists.txt:59 (include) This warning is for project developers. Use -Wno-dev to suppress it.

-- Looking for os_signpost_interval_begin -- Looking for os_signpost_interval_begin - not found -- Linker detection: LLD -- Clang resources directory: /usr/lib/clang/11.0.0/include -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of int128_t -- Check size of __int128_t - done -- Check size of _Complex -- Check size of _Complex - done -- Found PythonInterp: /usr/local/bin/python3.7 (found version "3.7.9") -- Found PythonLibs: /usr/local/lib/libpython3.7m.so (found version "3.7.9") -- Configuring done -- Generating done -- Build files have been written to: /home/oceanfish81/dragonffi/build oceanfish81@gollvm:~/dragonffi/build $ ninja -j 8 [5/60] Building CXX object CMakeFiles/dffi.dir/lib/dffi_api.cpp.o FAILED: CMakeFiles/dffi.dir/lib/dffi_api.cpp.o /usr/bin/clang++ -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -Ddffi_EXPORTS -I../include -Iinclude -I../third-party -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -w -fdiagnostics-color -ffunction-sections -fdata-sections -fPIC -fvisibility=hidden -std=c++14 -MD -MT CMakeFiles/dffi.dir/lib/dffi_api.cpp.o -MF CMakeFiles/dffi.dir/lib/dffi_api.cpp.o.d -o CMakeFiles/dffi.dir/lib/dffi_api.cpp.o -c ../lib/dffi_api.cpp ../lib/dffi_api.cpp:112:21: error: no member named 'getProcessTriple' in namespace 'llvm::sys' return llvm::sys::getProcessTriple();


1 error generated.
advancedwebdeveloper commented 3 years ago

[8/60] Building CXX object CMakeFiles/dffi.dir/lib/dffi_impl_clang_res.cpp.o FAILED: CMakeFiles/dffi.dir/lib/dffi_impl_clang_res.cpp.o /usr/bin/clang++ -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ddffi_EXPORTS -I../include -Iinclude -I../third-party -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -w -fdiagnostics-color -ffunction-sections -fdata-sections -fPIC -fvisibility=hidden -std=c++14 -MD -MT CMakeFiles/dffi.dir/lib/dffi_impl_clang_res.cpp.o -MF CMakeFiles/dffi.dir/lib/dffi_impl_clang_res.cpp.o.d -o CMakeFiles/dffi.dir/lib/dffi_impl_clang_res.cpp.o -c ../lib/dffi_impl_clang_res.cpp [11/60] Building CXX object CMakeFiles/dffi.dir/lib/dffi_impl.cpp.o FAILED: CMakeFiles/dffi.dir/lib/dffi_impl.cpp.o /usr/bin/clang++ -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ddffi_EXPORTS -I../include -Iinclude -I../third-party -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -w -fdiagnostics-color -ffunction-sections -fdata-sections -fPIC -fvisibility=hidden -std=c++14 -MD -MT CMakeFiles/dffi.dir/lib/dffi_impl.cpp.o -MF CMakeFiles/dffi.dir/lib/dffi_impl.cpp.o.d -o CMakeFiles/dffi.dir/lib/dffi_impl.cpp.o -c ../lib/dffi_impl.cpp ../lib/dffi_impl.cpp:179:37: error: no member named 'getProcessTriple' in namespace 'llvm::sys' const auto TripleStr = llvm::sys::getProcessTriple();

The following errors might be caused by missing include:

../lib/dffiimpl.cpp:269:18: error: allocation of incomplete type 'clang::FileManager' FileMgr = new FileManager(Clang_->getFileSystemOpts(), std::move(Overlay)); ^~~ /usr/include/clang/Basic/SourceManager.h:62:7: note: forward declaration of 'clang::FileManager' class FileManager; ^

This is an API specific issue:

../lib/dffi_impl.cpp:647:12: error: no matching function for call to 'SearchForAddressOfSymbol' return sys::DynamicLibrary::SearchForAddressOfSymbol(Name); ^~~~~~~~~~~~~ /usr/include/llvm/Support/DynamicLibrary.h:113:18: note: candidate function not viable: no known conversion from 'llvm::StringRef' to 'const char ' for 1st argument static void SearchForAddressOfSymbol(const char symbolName); ^ /usr/include/llvm/Support/DynamicLibrary.h:116:18: note: candidate function not viable: no known conversion from 'llvm::StringRef' to 'const std::string' (aka 'const basic_string<char, char_traits, allocator>') for 1st argument static void SearchForAddressOfSymbol(const std::string &symbolName) { ^ ../lib/dffi_impl.cpp:927:43: error: assigning to 'std::1::unordered_map<std::__1::basic_string<char, std::1::char_traits, std::1::allocator>, int, std::1::hash, std::1::equal_to<std::__1::basic_string<char, std::1::char_traits, std::1::allocator>>, std::1::allocator<std::1::pair<const std::1::basic_string<char, std::__1::char_traits, std::__1::allocator>, int>>>::mapped_type' (aka 'int') from incompatible type 'const llvm::APInt' Fields[EOp->getName().str()] = EOp->getValue();


In file included from ../lib/dffi_impl.cpp:18:
In file included from /usr/include/clang/CodeGen/CodeGenAction.h:12:
In file included from /usr/include/clang/Frontend/FrontendAction.h:23:
In file included from /usr/include/clang/Frontend/ASTUnit.h:17:
In file included from /usr/include/clang/AST/ASTContext.h:19:
In file included from /usr/include/clang/AST/CanonicalType.h:17:
In file included from /usr/include/clang/AST/Type.h:21:
In file included from /usr/include/clang/AST/NestedNameSpecifier.h:18:
In file included from /usr/include/clang/Basic/Diagnostic.h:17:
In file included from /usr/include/clang/Basic/DiagnosticIDs.h:18:
/usr/include/llvm/ADT/IntrusiveRefCntPtr.h:126:36: error: member access into incomplete type 'clang::FileManager'
  static void release(T *obj) { obj->Release(); }
                                   ^
/usr/include/llvm/ADT/IntrusiveRefCntPtr.h:189:34: note: in instantiation of member function 'llvm::IntrusiveRefCntPtrInfo<clang::FileManager>::release' requested here
      IntrusiveRefCntPtrInfo<T>::release(Obj);
                                 ^
/usr/include/llvm/ADT/IntrusiveRefCntPtr.h:156:27: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::FileManager>::release' requested here
  ~IntrusiveRefCntPtr() { release(); }
                          ^
../lib/dffi_impl.cpp:161:11: note: in instantiation of member function 'llvm::IntrusiveRefCntPtr<clang::FileManager>::~IntrusiveRefCntPtr' requested here
DFFIImpl::DFFIImpl(CCOpts const& Opts):
          ^
/usr/include/clang/Basic/SourceManager.h:62:7: note: forward declaration of 'clang::FileManager'
class FileManager;
      ^
5 errors generated.
aguinet commented 3 years ago

Which is the output of llvm /usr/bin/llvm-config --version?

For information, DragonFFI only supports LLVM 10 for now.

advancedwebdeveloper commented 3 years ago

Thwn you can start your migration

advancedwebdeveloper commented 3 years ago

The version is https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-amd64-unknown-freebsd11.tar.xz

aguinet commented 3 years ago

FYI, current master is now based on LLVM 11. Please reopen the bug if you still have the same issue with the master branch.

advancedwebdeveloper commented 3 years ago

Hold on, let me re-check