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

Building codon on Windows 10/11 X64 platform with one step away #566

Open
TaiXeflar opened this issue Jun 18, 2024 · 2 comments
Open

Building codon on Windows 10/11 X64 platform with one step away #566

TaiXeflar opened this issue Jun 18, 2024 · 2 comments

Comments

@TaiXeflar
Copy link

TaiXeflar commented Jun 18, 2024

Yes, I'm interested on this project and seen lots of suggest to build on WSL2 or just Linux. But I keep tried various ways(#69) and have some record there.

I prepared 2 ways to build:

First one: Using MSVC(v143) or LLVM based(exaloop/llvm-project Clang/LLVM) build on Visual Studio 2022. I'm still keep trying these builds.

  • pwsh (PowerShell 7, VS2022 environment)
 cd ~/Desktop;                                                                      # powershell recognize ~ path(unix-like) to $env:USERPROFILE
 git clone https://github.com/exaloop/llvm-project.git --depth=1      
 mkdir llvm-project/build; cd llvm-project/build                                    # powershell mkdir == shell "mkdir -p"
 
 cmake ../llvm -G Ninja                                                 \           # Ninja Generator
        -DCMAKE_BUILD_TYPE=MinSizeRel                                   \           # This option is due to my small 2TB SSD
        -DCMAKE_C_COMPILER=cl.exe                                       \           # MSVC v143 14.40.33807, cl= msvc compiler driver
        -DCMAKE_CXX_COMPILER=cl.exe                                     \           # MSVC v143 14.40.33807, cl= msvc compiler driver
        -DCMAKE_ASM_MASM_COMPILER=ml64.exe                              \           # MSVC Macro Assembler compiler
        -DCMAKE_INSTALL_PREFIX="C:/Developer/Codon/llvm"                \                       
        -DLLVM_TARGETS_TO_BUILD="host;NVPTX"                            \
        -DLLVM_ENABLE_PROJECTS="clang;lld"                              

 cmake --build . --target install       
 cd ~/Desktop; 
 git clone https://github.com/exaloop/codon.git --depth=1 --branch=windows
 mkdir codon/build; cd codon/build
 
 cmake .. -G Ninja
          -DCMAKE_BUILD_TYPE=MinSizeRel
          -DCMAKE_C_COMPILER=cl
          -DCMAKE_CXX_COMPILER=cl
          -DCMAKE_ASM_MASM_COMPILER=ml64
          -DCMAKE_PREFIX_PATH="C:/Developer/Codon/llvm"
          -DCMAKE_INSTALL_PREFIX="C:/Developer/Codon"
          -DCODON_GPU=ON

    # Remind in VS2022 env no target C/CXX compiler will auto select MSVC
    #

The build record see #69.

Second way: I rebuild llvm/clang and codon again, but Using "Strawberry Perl" with toolkit have GCC compiler:

 cd ~/Desktop;                                                                      # powershell recognize ~ path(unix-like) to $env:USERPROFILE
 git clone https://github.com/exaloop/llvm-project.git --depth=1      
 mkdir llvm-project/build; cd llvm-project/build                                    # powershell mkdir == shell "mkdir -p"
 
 cmake ../llvm -G Ninja                                                 \           # Ninja Generator
        -DCMAKE_BUILD_TYPE=MinSizeRel                                   \           # This option is due to my small 2TB SSD, Again
        -DCMAKE_C_COMPILER=gcc.exe                                      \           # MSVC v143 14.40.33807, cl= msvc compiler driver
        -DCMAKE_CXX_COMPILER=g++.exe                                    \           # MSVC v143 14.40.33807, cl= msvc compiler driver
        -DCMAKE_INSTALL_PREFIX="C:/Developer/Codon/llvm-gcc"            \                       
        -DLLVM_TARGETS_TO_BUILD="host;NVPTX"                            \
        -DLLVM_ENABLE_PROJECTS="clang;lld"                              

 cmake --build . --target install       
 cd ~/Desktop; 
 mkdir codon/build-gcc; cd codon/build-gcc
 
 cmake .. -G Ninja
          -DCMAKE_BUILD_TYPE=MinSizeRel
          -DCMAKE_C_COMPILER=gcc.exe
          -DCMAKE_CXX_COMPILER=g++.exe
          -DCMAKE_ASM_MASM_COMPILER=ml64.exe
          -DCMAKE_PREFIX_PATH="C:/Developer/Codon/llvm-gcc"
          -DCMAKE_INSTALL_PREFIX="C:/Developer/Codon"
          -DCODON_GPU=ON

 cmake --build .
    # By passing "CMAKE_ASM_MASM_COMPILER" to set Assembler compiler

And the second way have almost complete build(), but stop at ld.exe:

 x86_64-w64-mingw32/bin/ld.exe: error: export ordinal too large: 71633
 collect2.exe: error: ld returned 1 exit status

This is quite happy and f**k to me just a little bit objects to finish it... going play Genshin Impact for a little break.
Hope these results helps.

image

@CelestinPL
Copy link

Considering the seconds case error, that is the windows limitation. This problem is actually described here: error-export-ordinal-too-large-104116 and the proposition there is to try -fvisibility=hidden in GCC and CLANG to hide some exported functions. Can you try to build it that way?

@TaiXeflar
Copy link
Author

TaiXeflar commented Aug 26, 2024

Sorry for a long time reply. I actually tried this way: The GCC toolchain compile is pretty normal with a fast speed by ninja until linking, it will stucks at very long time, with a high memory usage, and finally stoped linking by printing unknown external linking symbol(10k lines and more). The LLVM toolchain compiles also well, but with a build of lld or msvc linker also quickly stop with link problems(unknown symbol).

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