Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build (macOS) #4

Open
genericptr opened this issue Aug 31, 2023 · 6 comments
Open

Can't build (macOS) #4

genericptr opened this issue Aug 31, 2023 · 6 comments

Comments

@genericptr
Copy link

Is my C++ compiler the wrong version maybe?

build$ cmake ..
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - 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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib/libffi.tbd  
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib/libcurses.tbd  
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib/libz.tbd (found version "1.2.11")  
-- Found zstd: /opt/homebrew/lib/libzstd.dylib  
-- Found LibXml2: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/lib/libxml2.tbd (found version "2.9.4") 
-- Found LLVM 16.0.4
-- Using LLVMConfig.cmake in: /opt/homebrew/opt/llvm@16/lib/cmake/llvm
-- Configuring done (4.5s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/ryanjoseph/Downloads/Amun-master/build
build$ make
[  5%] Building CXX object CMakeFiles/amun.dir/src/amun_alias_table.cpp.o
[ 10%] Building CXX object CMakeFiles/amun.dir/src/amun_basic.cpp.o
[ 15%] Building CXX object CMakeFiles/amun.dir/src/amun_command.cpp.o
[ 21%] Building CXX object CMakeFiles/amun.dir/src/amun_compiler.cpp.o
In file included from /Users/ryanjoseph/Downloads/Amun-master/src/amun_compiler.cpp:4:
In file included from /Users/ryanjoseph/Downloads/Amun-master/src/../include/amun_llvm_backend.hpp:6:
/Users/ryanjoseph/Downloads/Amun-master/include/amun_llvm_builder.hpp:57:53: warning: 'getPointerElementType' is deprecated: Deprecated without replacement, see https://llvm.org/docs/OpaquePointers.html for context and migration instructions [-Wdeprecated-declarations]
    auto pointer_element_type = pointer->getType()->getPointerElementType();
                                                    ^
/opt/homebrew/opt/llvm@16/include/llvm/IR/Type.h:406:5: note: 'getPointerElementType' has been explicitly marked deprecated here
  [[deprecated("Deprecated without replacement, see "
    ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_compiler.cpp:94:15: error: no template named 'Optional' in namespace 'llvm'; did you mean 'std::optional'?
    auto rm = llvm::Optional<llvm::Reloc::Model>();
              ^~~~~~~~~~~~~~
              std::optional
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/optional:590:7: note: 'std::optional' declared here
class optional
      ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_compiler.cpp:173:15: error: no template named 'Optional' in namespace 'llvm'; did you mean 'std::optional'?
    auto rm = llvm::Optional<llvm::Reloc::Model>();
              ^~~~~~~~~~~~~~
              std::optional
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/optional:590:7: note: 'std::optional' declared here
class optional
      ^
1 warning and 2 errors generated.
make[2]: *** [CMakeFiles/amun.dir/src/amun_compiler.cpp.o] Error 1
make[1]: *** [CMakeFiles/amun.dir/all] Error 2
make: *** [all] Error 2
build$ 
@AmrDeveloper
Copy link
Owner

Hello @genericptr,

I think you need to use updated clang version to be able to compile C++20

@genericptr
Copy link
Author

I don't use C++ much on macOS but I think you may need to add some additional flags to get c++ 20 support. It's also possible Apple hasn't implemented the full feature set.

There's the version I'm using which seems to be up to date.

Homebrew clang version 16.0.4
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm@16/bin

@AmrDeveloper
Copy link
Owner

I will search about this issue and check if i can solved it by adding flag or other thing

@AmrDeveloper
Copy link
Owner

AmrDeveloper commented Aug 31, 2023

@genericptr Can you please add this line on amun_compiler.cpp file

#include <llvm/ADT/Optional.h>

@genericptr
Copy link
Author

great that fixed that error. I still get errors but these are probably because I'm using LLVM 16. I think I can download a LLVM 15 version but not sure if the build system will use the correct one.

build$ make
[  5%] Building CXX object CMakeFiles/amun.dir/src/amun_compiler.cpp.o
In file included from /Users/ryanjoseph/Downloads/Amun-master/src/amun_compiler.cpp:4:
In file included from /Users/ryanjoseph/Downloads/Amun-master/src/../include/amun_llvm_backend.hpp:6:
/Users/ryanjoseph/Downloads/Amun-master/include/amun_llvm_builder.hpp:57:53: warning: 'getPointerElementType' is deprecated: Deprecated without replacement, see https://llvm.org/docs/OpaquePointers.html for context and migration instructions [-Wdeprecated-declarations]
    auto pointer_element_type = pointer->getType()->getPointerElementType();
                                                    ^
/opt/homebrew/opt/llvm@16/include/llvm/IR/Type.h:406:5: note: 'getPointerElementType' has been explicitly marked deprecated here
  [[deprecated("Deprecated without replacement, see "
    ^
1 warning generated.
[ 10%] Building CXX object CMakeFiles/amun.dir/src/amun_compiler_options.cpp.o
[ 15%] Building CXX object CMakeFiles/amun.dir/src/amun_diagnostics.cpp.o
[ 21%] Building CXX object CMakeFiles/amun.dir/src/amun_external_linker.cpp.o
[ 26%] Building CXX object CMakeFiles/amun.dir/src/amun_files.cpp.o
[ 31%] Building CXX object CMakeFiles/amun.dir/src/amun_llvm_backend.cpp.o
In file included from /Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:1:
In file included from /Users/ryanjoseph/Downloads/Amun-master/src/../include/amun_llvm_backend.hpp:6:
/Users/ryanjoseph/Downloads/Amun-master/include/amun_llvm_builder.hpp:57:53: warning: 'getPointerElementType' is deprecated: Deprecated without replacement, see https://llvm.org/docs/OpaquePointers.html for context and migration instructions [-Wdeprecated-declarations]
    auto pointer_element_type = pointer->getType()->getPointerElementType();
                                                    ^
/opt/homebrew/opt/llvm@16/include/llvm/IR/Type.h:406:5: note: 'getPointerElementType' has been explicitly marked deprecated here
  [[deprecated("Deprecated without replacement, see "
    ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:129:62: warning: 'getPointerElementType' is deprecated: Deprecated without replacement, see https://llvm.org/docs/OpaquePointers.html for context and migration instructions [-Wdeprecated-declarations]
        if (init_value_type != llvm_type && init_value_type->getPointerElementType() == llvm_type) {
                                                             ^
/opt/homebrew/opt/llvm@16/include/llvm/IR/Type.h:406:5: note: 'getPointerElementType' has been explicitly marked deprecated here
  [[deprecated("Deprecated without replacement, see "
    ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:467:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(start_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:474:27: error: 'getBasicBlockList' is a private member of 'llvm::Function'
        current_function->getBasicBlockList().push_back(true_block);
        ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:479:31: error: 'getBasicBlockList' is a private member of 'llvm::Function'
            current_function->getBasicBlockList().push_back(false_branch);
            ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:499:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(end_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:549:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(condition_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:556:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(body_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:575:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(end_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:635:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(condition_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:642:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(body_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:682:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(end_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:706:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(body_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:719:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(end_block);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:739:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(condition_branch);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:745:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(loop_branch);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:759:23: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    current_function->getBasicBlockList().push_back(end_branch);
    ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:990:15: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    function->getBasicBlockList().push_back(elseBB);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:998:15: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    function->getBasicBlockList().push_back(mergeBB);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:1063:15: error: 'getBasicBlockList' is a private member of 'llvm::Function'
    function->getBasicBlockList().push_back(first_branch);
    ~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
/Users/ryanjoseph/Downloads/Amun-master/src/amun_llvm_backend.cpp:1078:19: error: 'getBasicBlockList' is a private member of 'llvm::Function'
        function->getBasicBlockList().push_back(current_branch);
        ~~~~~~~~~~^~~~~~~~~~~~~~~~~
/opt/homebrew/opt/llvm@16/include/llvm/IR/Function.h:728:29: note: declared private here
        BasicBlockListType &getBasicBlockList()       { return BasicBlocks; }
                            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 warnings and 20 errors generated.
make[2]: *** [CMakeFiles/amun.dir/src/amun_llvm_backend.cpp.o] Error 1
make[1]: *** [CMakeFiles/amun.dir/all] Error 2
make: *** [all] Error 2
build$ 

@AmrDeveloper
Copy link
Owner

@genericptr Great, Yes i think getPointerElementType removed from llvm 16, it will work fine on llvm 15 and i will asap modify the code to work fine on llvm 16 and above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants