KazApps / YaneuraOu

YaneuraOu is the World's Strongest Shogi engine(AI player) , WCSC29 1st winner , educational and USI compliant engine.
GNU General Public License v3.0
0 stars 0 forks source link

WSL上でAOCCコンパイラやIntelコンパイラを用いてWindows用バイナリ(YaneuraOu-by-gcc.exe)を生成する方法 #1

Closed mrt-tsk closed 1 month ago

mrt-tsk commented 2 months ago

WSL上でmingw-w64を用いて既存のgccやclangでやねうら王のWindows用バイナリを生成する方法については コンパイラとして/usr/bin/x86_64-w64-mingw32-g++-posixや~/llvm-mingw-20240619-ucrt-ubuntu-20.04-x86_64/bin/x86_64-w64-mingw32-g++を指定してビルドすることで解決できたように思います。 それぞれ動作に必要なdllをYaneuraOu-by-gcc.exeと同じ階層に置くことで無事動作確認できました。 ただ表題の方法については自力では結局わかりませんでした。 WSL上でAOCCコンパイラやIntelコンパイラを用いて、やねうら王のWindows用バイナリを生成する方法を教えていただけないでしょうか。

KazApps commented 2 months ago

手元に完全に検証できる環境がない(仮想環境入れる時間は現在なく、現在の環境もできれば消したくない)ため、 動作確認が完全にできているわけではありませんが、以下の手順でこちらの環境 Windows 11 + WSL2 + Ubuntu 24.04 + AOCC 4.2では一応動きました。 Intel Compilerでも大体同様の手順ですが、Intel CompilerのlinkerがPE Headerに対応してない(簡単に言うとWindows用のバイナリを吐けない)ため、もう少し面倒になります。そちらももし必要になればまたissueを開いてくだされば対応いたします。

以下の手順で何か問題が発生した場合は、改めてお知らせいただけるとありがたいです。

なお、以下のコマンドはすべて特に明記がなければWSL上です。

AOCCコンパイラのインストール

既にインストールが済んでいていて、/opt/AMD/aocc-compiler-4.2.0/bin/clang++ --versionコマンドが正しく動作する場合には読み飛ばしてもらって結構です。 https://www.amd.com/ja/developer/aocc/eula/aocc-4-2-eula.html?filename=aocc-compiler-4.2.0_1_amd64.debのライセンスに同意し、以下のコマンドでインストールする。

cd /tmp/
wget https://download.amd.com/developer/eula/aocc/aocc-4-2/aocc-compiler-4.2.0_1_amd64.deb
sudo apt install ./aocc-compiler-4.2.0_1_amd64.deb

インストール後、/opt/AMD/aocc-compiler-4.2.0/bin/clang++ --versionコマンドで

AMD clang version 16.0.3 (CLANG: AOCC_4.2.0-Build#89 2023_12_13)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/AMD/aocc-compiler-4.2.0/bin

のような出力が得られたら成功です。

msys上でのclangやその他のインストール

AOCCがベースにしてるバージョン以上 (厳密には同じバージョンにすべきかもしれませんが) のclangをmsys上でインストールします。 AOCC 4.2 (2024/09/09 現在最新)の場合は、clang 16以上になります。 その他のAOCCのバージョンの場合は、/opt/AMD/aocc-compiler-4.2.0/bin/clang++ --versionで確認してください。

基本的に以下のコマンドを実行しておけば最新のclangが入るはずなので、AOCCがベースにしているclangより古いものが入ることはないとは思われますが...

msys上で

pacman --needed --noconfirm -Syuu
pacman --needed --noconfirm -S mingw-w64-x86_64-clang mingw-w64-clang-x86_64-compiler-rt mingw-w64-x86_64-libunwind

クロスコンパイルに必要なファイルをコピー

現状ではリンク時にエラーが出てしまうため、必要なファイルをコピーします。

sudo cp -r /mnt/c/msys64/mingw64/lib/clang/18/lib/windows/ /opt/AMD/aocc-compiler-4.2.0/lib/clang/1
6/lib/

/mnt/c/msys64/mingw64/lib/clang/18/lib/windows/の18の部分と/opt/AMD/aocc-compiler-4.2.0/lib/clang/1 6/lib/の16の部分はそれぞれお使いのclangやAOCCのバージョンに合わせて変更してください。

ビルド

まずクローンしているYaneuraOuのソースコードの場所(YaneuraOu/source)に移動します。

Makefileの編集

Makefileの中で

ifneq (,$(findstring em++,$(COMPILER)))
        TARGET = $(TARGETDIR)/yaneuraou.js
else
        ifeq ($(OS),Windows_NT)
                CPPFLAGS += $(WCPPFLAGS)
                LDFLAGS += -static -Wl,--stack,25000000
                TARGET = $(TARGETDIR)/YaneuraOu-by-gcc.exe
        else
                CPPFLAGS += -D_LINUX
                TARGET = $(TARGETDIR)/YaneuraOu-by-gcc
        endif
endif

という箇所があると思うので、

ifneq (,$(findstring em++,$(COMPILER)))
        TARGET = $(TARGETDIR)/yaneuraou.js
else
        ifeq ($(OS),Windows_NT)
                CPPFLAGS += $(WCPPFLAGS)
                LDFLAGS += -static -Wl,--stack,25000000
                TARGET = $(TARGETDIR)/YaneuraOu-by-gcc.exe
        else
                # CPPFLAGS += -D_LINUX
                TARGET = $(TARGETDIR)/YaneuraOu-by-gcc
        endif
endif

という風にCPPFLAGS += -D_LINUXをコメントアウトしてください。

make

make clean tournament TARGET_CPU=ZEN4 COMPILER=/opt/AMD/aocc-compiler-4.2.0/bin/clang++ EXTRA_CPPFLAGS="-DUSE_AVX2 -DUSE_BMI2 -DUSE_VNNI -march=native -mtune=native -stdlib=libc++ -fvector-transform -floop-transform -faggressive-loop-transform -fnt-store -fremap-arrays -target x86_64-w64-mingw32 -I/usr/include/mingw-w64 -static -pthread" EXTRA_LDFLAGS="-rtlib=compiler-rt -unwindlib=libunwind -L/usr/lib -L/mnt/c/msys64/mingw64/lib" -j 8

上の例ではZEN4用にビルドしていますが、やねうら王Wikiを参考に実際にお使いのCPUに合うTARGET_CPUを指定してビルドして下さい。 また、-fvector-transform -floop-transform -faggressive-loop-transform -fnt-store -fremap-arraysはあってもなくてもビルドはできるので、消してもらっても結構です。

mrt-tsk commented 2 months ago

詳細な解説ありがとうございます。

In file included from In file included from position.cppusi_option.cpp::13: : ./position.h./misc.h::34::1010:: fatal error: fatal error: 'deque' file not found'chrono' file not found

include #include

     ^~~~~~~         ^~~~~~~~

In file included from In file included from In file included from main.cpptypes.cppIn file included from In file included from movegen.cpp::usi.cppbitboard.cpp:41::3: : 1: 1In file included from In file included from : In file included from : ./search.h./types.hIn file included from ./types.hIn file included from ::./types.h:./bitboard.h817:17:: : 17: 4: : ./misc.hIn file included from ./extra/bitop.h./extra/bitop.h:./types.h./extra/bitop.h::4::88:178::10: :1010:10:: ./extra/bitop.h: : 8:fatal error: fatal error: fatal error: 10fatal error: : 'chrono' file not found'cstddef' file not found'cstddef' file not found'cstddef' file not found

fatal error: 'cstddef' file not found

include #include // std::size_t#include // std::size_t#include // std::size_t#include // std::size_t

     ^~~~~~~~         ^~~~~~~~~
     ^~~~~~~~~         ^~~~~~~~~         ^~~~~~~~~

1 error generated. 1 error generated. make[1]: [Makefile:660: ../obj/types.o] Error 1 make[1]: Waiting for unfinished jobs.... 1 error generated. make[1]: [Makefile:660: ../obj/usi_option.o] Error 1 make[1]: [Makefile:660: ../obj/main.o] Error 1 1 error generated. 1 error generated. make[1]: [Makefile:660: ../obj/position.o] Error 1 make[1]: [Makefile:660: ../obj/usi.o] Error 1 1 error generated. 1 error generated. make[1]: [Makefile:660: ../obj/movegen.o] Error 1 make[1]: [Makefile:660: ../obj/bitboard.o] Error 1 misc.cpp:37:10: fatal error: 'fstream' file not found

include

     ^~~~~~~~~

1 error generated. make[1]: [Makefile:660: ../obj/misc.o] Error 1 make[1]: Leaving directory '/home/mrttsk/YaneuraOu/source' make: [Makefile:690: tournament] Error 2

おおむね手順通りにできましたが、ビルド時に上記のようなエラーを吐かれてしまいました。見当違いかもしれないのですが、個人的に気になったのはmakeの-I/usr/include/mingw-w64という部分で、自分の環境だとそこにmingw-w64というフォルダが存在してなくて…これが原因のような気がしています。何かいい解決方法はありませんか?

KazApps commented 2 months ago

ご返信ありがとうございます。

そのエラーは、libc++(llvmが実装している標準ライブラリ)がインストールされていないことが原因で出ている可能性が高いと思われます。 ので以下の以下のコマンドでlibc++をインストールして再度ビルドを試していただけますでしょうか。

sudo apt update
sudo apt install clang libc++-dev libc++abi-dev

また、-I/usr/include/mingw-w64に関しては、今回のビルドには不要なオプションでした。手間を取らせてしまい、申し訳ありませんでした。

mrt-tsk commented 2 months ago

ありがとうございます。そうだったのですね! libc++をインストールして再度ビルドしてみましたが、エラーが出ました。

In file included from usi_option.cpp:3: ./misc.h:4:10: In file included from position.cppfatal error: :1: 'chrono' file not found ./position.h:3:10: fatal error: 'deque' file not found#include

     ^~~~~~~~

include

     ^~~~~~~

In file included from In file included from main.cppmovegen.cpp::43: : In file included from In file included from ./search.h./types.h::817: : In file included from In file included from bitboard.cpp./misc.husi.cpp./extra/bitop.h::::418:1: :10: In file included from 10:In file included from ./bitboard.h: ./types.h: :417: : In file included from fatal error: ./types.hfatal error: :./extra/bitop.h17:'chrono' file not found: 8'cstddef' file not found: 10./extra/bitop.h :: 8:10: fatal error: 'cstddef' file not foundfatal error:

include 'cstddef' file not found

include // std::size_t ^~~~

     ^~~~~~~~~

include // std::size_t#include // std::size_t

     ^~~~~~~~~         ^~~~~~~~~

In file included from types.cpp:1: In file included from ./types.h:17: ./extra/bitop.h:8:10: fatal error: 'cstddef' file not found

include // std::size_t

     ^~~~~~~~~

1 error generated. 1 error generated. 1 error generated. make[1]: [Makefile:660: ../obj/main.o] Error 1 make[1]: Waiting for unfinished jobs.... 1 error generated. make[1]: [Makefile:660: ../obj/types.o] Error 1 make[1]: [Makefile:660: ../obj/usi_option.o] Error 1 1 error generated. make[1]: [Makefile:660: ../obj/position.o] Error 1 make[1]: [Makefile:660: ../obj/usi.o] Error 1 1 error generated. make[1]: [Makefile:660: ../obj/movegen.o] Error 1 1 error generated. make[1]: [Makefile:660: ../obj/bitboard.o] Error 1 misc.cpp:37:10: fatal error: 'fstream' file not found

include

     ^~~~~~~~~

1 error generated. make[1]: [Makefile:660: ../obj/misc.o] Error 1 make[1]: Leaving directory '/home/mrttsk/YaneuraOu/source' make: [Makefile:690: tournament] Error 2

KazApps commented 2 months ago

/opt/AMD/aocc-compiler-4.2.0/bin/clang++ -E -x c++ -stdlib=libc++ -target x86_64-w64-mingw32 -static - -v < /dev/null このコマンドを実行すると下の方に

#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/v1
 /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include
 /usr/x86_64-w64-mingw32/include
End of search list.

のような出力があると思うので、この例でいうところの

 /usr/include/c++/v1
 /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include
 /usr/x86_64-w64-mingw32/include

の部分のパスを教えてもらえませんか。 また、それらが存在するかもチェックしていただけるとありがたいです。

mrt-tsk commented 2 months ago

コマンド実行してみました。 ignoring nonexistent directoryという部分があったので、ちょっと上の方から実行結果を貼付します。

clang -cc1 version 16.0.3 based upon LLVM Mirror.Version.16.0.3 default target x86_64-unknown-linux-gnu ignoring nonexistent directory "/usr/x86_64-w64-mingw32/include/c++/v1" ignoring nonexistent directory "/usr/include/c++/v1" ignoring nonexistent directory "/usr/x86_64-w64-mingw32/usr/include"

include "..." search starts here:

include <...> search starts here:

/opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include /usr/x86_64-w64-mingw32/include End of search list.

上記2つは存在していました。 例にある/usr/include/c++/v1は存在してないです。

KazApps commented 2 months ago

こちらの環境ではlibc++-18-devlibc++-devlibc++1-18libc++1libc++abi-18-devlibc++abi-devlibc++abi1-18libc++abi1が入ってるみたいなので以下のコマンドでインストールして再度ビルドしてみてください。

sudo apt install libc++-18-dev libc++-dev libc++1-18 libc++1 libc++abi-18-dev libc++abi-dev libc++abi1-18 libc++abi1

正しくインストールが済んでいたら、/usr/include/c++/v1は存在しているはずなのですが...

mrt-tsk commented 2 months ago

確かに…普通ありますよね。/usr/include/c++/v1がなぜ存在してないのかわかりません。同じ名前のファイル(v1)があったので、/usr/include/c++/にコピーしてみましたが、どうもこれも解決には至らないようです。

sudo apt install libc++-18-dev libc++-dev libc++1-18 libc++1 libc++abi-18-dev libc++abi-dev libc++abi1-18 libc++abi1を 実行したところエラーが出ました。困りました。 E: Unable to locate package libc++-18-dev E: Unable to locate package libc++1-18 E: Unable to locate package libc++abi-18-dev E: Unable to locate package libc++abi1-18

KazApps commented 2 months ago

そうでした。*-18や*-18-devはLLVMのAutomatic installation scriptを使ってインストールしたやつだった気がします。libunwindやcompiler-rtにも必要だった気もするので以下のコマンドでインストールしてみてもらえませんか。

wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt install libllvm-18-ocaml-dev libllvm18 llvm-18 llvm-18-dev llvm-18-doc llvm-18-examples llvm-18-runtime clang-18 clang-tools-18 clang-18-doc libclang-common-18-dev libclang-18-dev libclang1-18 clang-format-18 python3-clang-18 clangd-18 clang-tidy-18 libclang-rt-18-dev lld-18 libc++-18-dev libc++abi-18-dev libomp-18-dev libunwind-18-dev
mrt-tsk commented 2 months ago

LLVMのhttps://apt.llvm.org/を参考に無事インストールできたと思います。ただ再度ビルド時に今までと同じエラーが出ました。 /usr/include/c++/にv1フォルダをコピーしてもまた違ったエラーが出ます。長いですが、貼付します。

In file included from eval/nnue/evaluate_nnue.cpp:10: In file included from eval/nnue/../../position.h:11: In file included from eval/nnue/../../eval/nnue/nnue_accumulator.h:10: In file included from eval/nnue/nnue_architecture.h:59: In file included from eval/nnue/architectures/halfkp_256x2-32-32.h:10: eval/nnue/architectures/../layers/affine_transform.h:270:10: error: 'builtin_ia32_vpdpbusd256' needs target feature avx512vl,avx512vnni|avxvnni acc = _mm256_dpbusd_epi32(acc, a0, b0); ^ /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include/avx512vlvnniintrin.h:39:13: note: expanded from macro '_mm256_dpbusd_epi32' ((m256i)builtin_ia32_vpdpbusd256((v8si)(S), (v8si)(A), (v8si)(B))) ^ In file included from eval/nnue/evaluate_nnue.cpp:10: In file included from eval/nnue/../../position.h:11: In file included from eval/nnue/../../eval/nnue/nnue_accumulator.h:10: In file included from eval/nnue/nnue_architecture.h:59: In file included from eval/nnue/architectures/halfkp_256x2-32-32.h:10: eval/nnue/architectures/../layers/affine_transform.h:271:10: error: 'builtin_ia32_vpdpbusd256' needs target feature avx512vl,avx512vnni|avxvnni acc = _mm256_dpbusd_epi32(acc, a1, b1); ^ /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include/avx512vlvnniintrin.h:39:13: note: expanded from macro '_mm256_dpbusd_epi32' ((m256i)builtin_ia32_vpdpbusd256((v8si)(S), (v8si)(A), (v8si)(B))) ^ In file included from eval/nnue/evaluate_nnue.cpp:10: In file included from eval/nnue/../../position.h:11: In file included from eval/nnue/../../eval/nnue/nnue_accumulator.h:10: In file included from eval/nnue/nnue_architecture.h:59: In file included from eval/nnue/architectures/halfkp_256x2-32-32.h:10: eval/nnue/architectures/../layers/affine_transform.h:259:10: error: 'builtin_ia32_vpdpbusd256' needs target feature avx512vl,avx512vnni|avxvnni acc = _mm256_dpbusd_epi32(acc, a, b); ^ /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include/avx512vlvnniintrin.h:39:13: note: expanded from macro '_mm256_dpbusd_epi32' ((m256i)builtin_ia32_vpdpbusd256((v8si)(S), (v8si)(A), (v8si)(B))) ^ In file included from eval/nnue/evaluate_nnue.cpp:10: In file included from eval/nnue/../../position.h:11: In file included from eval/nnue/../../eval/nnue/nnue_accumulator.h:10: In file included from eval/nnue/nnue_architecture.h:59: In file included from eval/nnue/architectures/halfkp_256x2-32-32.h:10: eval/nnue/architectures/../layers/affine_transform.h:270:10: error: 'builtin_ia32_vpdpbusd256' needs target feature avx512vl,avx512vnni|avxvnni acc = _mm256_dpbusd_epi32(acc, a0, b0); ^ /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include/avx512vlvnniintrin.h:39:13: note: expanded from macro '_mm256_dpbusd_epi32' ((m256i)builtin_ia32_vpdpbusd256((v8si)(S), (v8si)(A), (v8si)(B))) ^ In file included from eval/nnue/evaluate_nnue.cpp:10: In file included from eval/nnue/../../position.h:11: In file included from eval/nnue/../../eval/nnue/nnue_accumulator.h:10: In file included from eval/nnue/nnue_architecture.h:59: In file included from eval/nnue/architectures/halfkp_256x2-32-32.h:10: eval/nnue/architectures/../layers/affine_transform.h:271:10: error: 'builtin_ia32_vpdpbusd256' needs target feature avx512vl,avx512vnni|avxvnni acc = _mm256_dpbusd_epi32(acc, a1, b1); ^ /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include/avx512vlvnniintrin.h:39:13: note: expanded from macro '_mm256_dpbusd_epi32' ((m256i)builtin_ia32_vpdpbusd256((v8si)(S), (v8si)(A), (v8si)(B))) ^ In file included from eval/nnue/evaluate_nnue.cpp:10: In file included from eval/nnue/../../position.h:11: In file included from eval/nnue/../../eval/nnue/nnue_accumulator.h:10: In file included from eval/nnue/nnue_architecture.h:59: In file included from eval/nnue/architectures/halfkp_256x2-32-32.h:10: eval/nnue/architectures/../layers/affine_transform.h:259:10: error: 'builtin_ia32_vpdpbusd256' needs target feature avx512vl,avx512vnni|avxvnni acc = _mm256_dpbusd_epi32(acc, a, b); ^ /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include/avx512vlvnniintrin.h:39:13: note: expanded from macro '_mm256_dpbusd_epi32' ((m256i)builtin_ia32_vpdpbusd256((v8si)(S), (v8si)(A), (v8si)(B))) ^ In file included from eval/nnue/evaluate_nnue.cpp:10: In file included from eval/nnue/../../position.h:11: In file included from eval/nnue/../../eval/nnue/nnue_accumulator.h:10: In file included from eval/nnue/nnue_architecture.h:59: In file included from eval/nnue/architectures/halfkp_256x2-32-32.h:10: eval/nnue/architectures/../layers/affine_transform.h:259:10: error: '__builtin_ia32_vpdpbusd256' needs target feature avx512vl,avx512vnni|avxvnni /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/include/avx512vlvnniintrin.h:39:13: note: expanded from macro '_mm256_dpbusd_epi32' ((m256i)builtin_ia32_vpdpbusd256((v8si)(S), (v8si)(A), (__v8si)(B))) ^ 7 errors generated. /opt/AMD/aocc-compiler-4.2.0/bin/clang++ -std=c++17 -fno-exceptions -fno-rtti -Wextra -MMD -MP -fpermissive -DUSE_AVX2 -DUSE_BMI2 -DUSE_VNNI -march=native -mtune=native -stdlib=libc++ -target x86_64-w64-mingw32 -I/usr/include/mingw-w64 -static -pthread -Ofast -DNDEBUG -Wno-unused-parameter -DUNICODE -DNO_EXCEPTIONS -DTARGET_CPU=\"AVX2\" -DUSE_AVX2 -DUSE_BMI2 -mbmi -mbmi2 -mavx2 -march=corei7-avx -DYANEURAOU_ENGINE_NNUE -DTARGET_CPU=\"AVX2\" -flto -DFOR_TOURNAMENT -o ../obj/eval/nnue/features/pe9.o -c eval/nnue/features/pe9.cpp /opt/AMD/aocc-compiler-4.2.0/bin/clang++ -std=c++17 -fno-exceptions -fno-rtti -Wextra -MMD -MP -fpermissive -DUSE_AVX2 -DUSE_BMI2 -DUSE_VNNI -march=native -mtune=native -stdlib=libc++ -target x86_64-w64-mingw32 -I/usr/include/mingw-w64 -static -pthread -Ofast -DNDEBUG -Wno-unused-parameter -DUNICODE -DNO_EXCEPTIONS -DTARGET_CPU=\"AVX2\" -DUSE_AVX2 -DUSE_BMI2 -mbmi -mbmi2 -mavx2 -march=corei7-avx -DYANEURAOU_ENGINE_NNUE -DTARGET_CPU=\"AVX2\" -flto -DFOR_TOURNAMENT -o ../obj/engine/yaneuraou-engine/yaneuraou-search.o -c engine/yaneuraou-engine/yaneuraou-search.cpp make[1]: [Makefile:660: ../obj/eval/nnue/evaluate_nnue.o] Error 1 make[1]: Waiting for unfinished jobs.... make[1]: Leaving directory '/home/mrttsk/YaneuraOu/source' make: *** [Makefile:690: tournament] Error 2

KazApps commented 2 months ago

そのビルドコマンドはこちらの環境(ZEN4)でのコマンドで、VNNIというのを有効にしていたのですが、おそらくお使いのPCがVNNIに対応していないようでそれによってエラーが出てるみたいですね。 とりあえす、

make clean tournament COMPILER=/opt/AMD/aocc-compiler-4.2.0/bin/clang++ EXTRA_CPPFLAGS="-stdlib=libc++ -target x86_64-w64-mingw32 -I/usr/include/mingw-w64 -static -pthread" EXTRA_LDFLAGS="-rtlib=compiler-rt -unwindlib=libunwind -L/usr/lib -L/mnt/c/msys64/mingw64/lib" -j 8

でビルドできるかを確認していただいて、できるようならCPUに合わせたオプションを指定してみるといいかと思います。

mrt-tsk commented 2 months ago

なるほど!だいぶエラー減りました。あと一歩という感じがします。 lld: error: unable to find library -lc++ clang-16: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [Makefile:656: YaneuraOu-by-gcc] Error 1 make[1]: Leaving directory '/home/mrttsk/YaneuraOu/source' make: [Makefile:690: tournament] Error 2

KazApps commented 2 months ago

おそらく、/opt/AMD/aocc-compiler-4.2.0/lib/libc++.alibc++.solibc++.so.1などlibc++のファイルがあると思うので、一度確認してみてください。もし存在するようであれば、

make clean tournament COMPILER=/opt/AMD/aocc-compiler-4.2.0/bin/clang++ EXTRA_CPPFLAGS="-stdlib=libc++ -target x86_64-w64-mingw32 -I/usr/include/mingw-w64 -static -pthread" EXTRA_LDFLAGS="-rtlib=compiler-rt -unwindlib=libunwind -L/usr/lib -L/mnt/c/msys64/mingw64/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/" -j 8

で再度ビルドを試してみてもらえないでしょうか。

本来は/opt/AMD/aocc-compiler-4.2.0/lib/はコンパイラによって自動的にファイルが検索される場所のはずなのですが... /opt/AMD/aocc-compiler-4.2.0/bin/clang++ -print-search-dirsで検索対象のパスを見ることもできるので、そちらも確認してみてもいいかもしれません。

mrt-tsk commented 2 months ago

実行してみました。さっきとはまた違ったエラーのようです。 ld.lld: error: unknown file type: chrono.cpp.o ld.lld: error: unknown file type: condition_variable.cpp.o ld.lld: error: unknown file type: exception.cpp.o ld.lld: error: unknown file type: memory.cpp.o ld.lld: error: unknown file type: mutex.cpp.o ld.lld: error: unknown file type: new.cpp.o ld.lld: error: unknown file type: string.cpp.o ld.lld: error: unknown file type: system_error.cpp.o ld.lld: error: unknown file type: thread.cpp.o ld.lld: error: unknown file type: random.cpp.o ld.lld: error: unknown file type: ios.cpp.o ld.lld: error: unknown file type: ios.instantiations.cpp.o ld.lld: error: unknown file type: iostream.cpp.o ld.lld: error: unknown file type: locale.cpp.o clang-16: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [Makefile:656: YaneuraOu-by-gcc] Error 1 make[1]: Leaving directory '/home/mrttsk/YaneuraOu/source' make: [Makefile:690: tournament] Error 2

なぜなんでしょうね笑 /opt/AMD/aocc-compiler-4.2.0/bin/clang++ -print-search-dirsの実行結果ですが、以下のようになりました。

programs: =/opt/AMD/aocc-compiler-4.2.0/bin:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/bin libraries: =/opt/AMD/aocc-compiler-4.2.0/lib/clang/16:/usr/lib/gcc/x86_64-linux-gnu/11:/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib64:/lib/x86_64-linux-gnu:/lib/../lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/../lib64:/opt/AMD/aocc-compiler-4.2.0/bin/../lib:/lib:/usr/lib

mrt-tsk commented 2 months ago

libc++.a、libc++.so、libc++.so.1などlibc++のファイルは存在してました。

mrt-tsk commented 2 months ago

libc++ファイルは/usr/lib/x86_64-linux-gnu/にも存在していたので、同じ要領で-L/usr/lib/x86_64-linux-gnuというオプションをつけてビルドしてみましたが、似たようなエラーが出ました。libc++関連のエラーではある気はするのですが…わからないです。

KazApps commented 2 months ago

リンカのエラーですね。 makeの出力の最後の方に

"/opt/AMD/aocc-compiler-4.2.0/bin/ld.lld" -m i386pep -Bstatic -o YaneuraOu-by-gcc.exe /usr/x86_64-w64-mingw32/lib/crt2.o /usr/x86_64-w64-mingw32/lib/crtbegin.o -L/usr/lib -L/mnt/c/msys64/mingw64/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/ -L/usr/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/mingw/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows ../obj/main.o ../obj/types.o ../obj/bitboard.o ../obj/misc.o ../obj/movegen.o ../obj/position.o ../obj/usi.o ../obj/usi_option.o ../obj/thread.o ../obj/tt.o ../obj/movepick.o ../obj/timeman.o ../obj/book/book.o ../obj/book/apery_book.o ../obj/extra/bitop.o ../obj/extra/long_effect.o ../obj/extra/sfen_packer.o ../obj/extra/super_sort.o ../obj/mate/mate.o ../obj/mate/mate1ply_without_effect.o ../obj/mate/mate1ply_with_effect.o ../obj/mate/mate_solver.o ../obj/eval/evaluate_bona_piece.o ../obj/eval/evaluate.o ../obj/eval/evaluate_io.o ../obj/eval/evaluate_mir_inv_tools.o ../obj/eval/material/evaluate_material.o ../obj/testcmd/unit_test.o ../obj/testcmd/mate_test_cmd.o ../obj/testcmd/normal_test_cmd.o ../obj/testcmd/benchmark.o ../obj/book/makebook.o ../obj/book/makebook2015.o ../obj/book/makebook2023.o ../obj/learn/learner.o ../obj/learn/learning_tools.o ../obj/learn/multi_think.o ../obj/eval/nnue/evaluate_nnue.o ../obj/eval/nnue/evaluate_nnue_learner.o ../obj/eval/nnue/nnue_test_command.o ../obj/eval/nnue/features/k.o ../obj/eval/nnue/features/p.o ../obj/eval/nnue/features/half_kp.o ../obj/eval/nnue/features/half_kp_vm.o ../obj/eval/nnue/features/half_relative_kp.o ../obj/eval/nnue/features/half_kpe9.o ../obj/eval/nnue/features/pe9.o ../obj/engine/yaneuraou-engine/yaneuraou-search.o -s -lpthread -lc++ --start-group -lmingw32 /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a -l:libunwind.a -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 --end-group /usr/x86_64-w64-mingw32/lib/crtend.o

のようなのがあると思うので、貼り付けてもらえないでしょうか。

mrt-tsk commented 2 months ago

"/opt/AMD/aocc-compiler-4.2.0/bin/ld.lld" -m i386pep -Bstatic -o YaneuraOu-by-gcc.exe /usr/x86_64-w64-mingw32/lib/crt2.o /usr/x86_64-w64-mingw32/lib/crtbegin.o -L/usr/lib -L/mnt/c/msys64/mingw64/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/ -L/usr/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/mingw/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows ../obj/main.o ../obj/types.o ../obj/bitboard.o ../obj/misc.o ../obj/movegen.o ../obj/position.o ../obj/usi.o ../obj/usi_option.o ../obj/thread.o ../obj/tt.o ../obj/movepick.o ../obj/timeman.o ../obj/book/book.o ../obj/book/apery_book.o ../obj/extra/bitop.o ../obj/extra/long_effect.o ../obj/extra/sfen_packer.o ../obj/extra/super_sort.o ../obj/mate/mate.o ../obj/mate/mate1ply_without_effect.o ../obj/mate/mate1ply_with_effect.o ../obj/mate/mate_solver.o ../obj/eval/evaluate_bona_piece.o ../obj/eval/evaluate.o ../obj/eval/evaluate_io.o ../obj/eval/evaluate_mir_inv_tools.o ../obj/eval/material/evaluate_material.o ../obj/testcmd/unit_test.o ../obj/testcmd/mate_test_cmd.o ../obj/testcmd/normal_test_cmd.o ../obj/testcmd/benchmark.o ../obj/book/makebook.o ../obj/book/makebook2015.o ../obj/book/makebook2023.o ../obj/learn/learner.o ../obj/learn/learning_tools.o ../obj/learn/multi_think.o ../obj/eval/nnue/evaluate_nnue.o ../obj/eval/nnue/evaluate_nnue_learner.o ../obj/eval/nnue/nnue_test_command.o ../obj/eval/nnue/features/k.o ../obj/eval/nnue/features/p.o ../obj/eval/nnue/features/half_kp.o ../obj/eval/nnue/features/half_kp_vm.o ../obj/eval/nnue/features/half_relative_kp.o ../obj/eval/nnue/features/half_kpe9.o ../obj/eval/nnue/features/pe9.o ../obj/engine/yaneuraou-engine/yaneuraou-search.o -s -lpthread -lc++ --start-group -lmingw32 /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a -l:libunwind.a -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 --end-group /usr/x86_64-w64-mingw32/lib/crtend.o

KazApps commented 2 months ago

あんま問題なさそうですね。

ld.lld: error: unknown file type: chrono.cpp.o
ld.lld: error: unknown file type: condition_variable.cpp.o
ld.lld: error: unknown file type: exception.cpp.o
ld.lld: error: unknown file type: memory.cpp.o
ld.lld: error: unknown file type: mutex.cpp.o
ld.lld: error: unknown file type: new.cpp.o
ld.lld: error: unknown file type: string.cpp.o
ld.lld: error: unknown file type: system_error.cpp.o
ld.lld: error: unknown file type: thread.cpp.o
ld.lld: error: unknown file type: random.cpp.o
ld.lld: error: unknown file type: ios.cpp.o
ld.lld: error: unknown file type: ios.instantiations.cpp.o
ld.lld: error: unknown file type: iostream.cpp.o
ld.lld: error: unknown file type: locale.cpp.o

これらは標準ライブラリのファイルなのですが、そこで何か問題が発生してそうです。

KazApps commented 2 months ago

こちらでは先ほど貼り付けていただいたコマンドでも正しくリンクできているみたいなので、コマンドの問題ではなさそうです。

mrt-tsk commented 2 months ago

あ!動いたんですね なるほど、コマンドには問題なしですか…

KazApps commented 2 months ago

うーん。libc++の問題であることは間違いないんですけど。 /usr/lib/llvm-18/libが存在するか確認していただいて、(インストールしたはずなので存在するはずですが)

"/opt/AMD/aocc-compiler-4.2.0/bin/ld.lld" -m i386pep -Bstatic -o YaneuraOu-by-gcc.exe /usr/x86_64-w64-mingw32/lib/crt2.o /usr/x86_64-w64-mingw32/lib/crtbegin.o -L/usr/lib -L/mnt/c/msys64/mingw64/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/ -L/usr/lib/llvm-18/lib -L/usr/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/mingw/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows ../obj/main.o ../obj/types.o ../obj/bitboard.o ../obj/misc.o ../obj/movegen.o ../obj/position.o ../obj/usi.o ../obj/usi_option.o ../obj/thread.o ../obj/tt.o ../obj/movepick.o ../obj/timeman.o ../obj/book/book.o ../obj/book/apery_book.o ../obj/extra/bitop.o ../obj/extra/long_effect.o ../obj/extra/sfen_packer.o ../obj/extra/super_sort.o ../obj/mate/mate.o ../obj/mate/mate1ply_without_effect.o ../obj/mate/mate1ply_with_effect.o ../obj/mate/mate_solver.o ../obj/eval/evaluate_bona_piece.o ../obj/eval/evaluate.o ../obj/eval/evaluate_io.o ../obj/eval/evaluate_mir_inv_tools.o ../obj/eval/material/evaluate_material.o ../obj/testcmd/unit_test.o ../obj/testcmd/mate_test_cmd.o ../obj/testcmd/normal_test_cmd.o ../obj/testcmd/benchmark.o ../obj/book/makebook.o ../obj/book/makebook2015.o ../obj/book/makebook2023.o ../obj/learn/learner.o ../obj/learn/learning_tools.o ../obj/learn/multi_think.o ../obj/eval/nnue/evaluate_nnue.o ../obj/eval/nnue/evaluate_nnue_learner.o ../obj/eval/nnue/nnue_test_command.o ../obj/eval/nnue/features/k.o ../obj/eval/nnue/features/p.o ../obj/eval/nnue/features/half_kp.o ../obj/eval/nnue/features/half_kp_vm.o ../obj/eval/nnue/features/half_relative_kp.o ../obj/eval/nnue/features/half_kpe9.o ../obj/eval/nnue/features/pe9.o ../obj/engine/yaneuraou-engine/yaneuraou-search.o -s -lpthread -lc++ --start-group -lmingw32 /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a -l:libunwind.a -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 --end-group /usr/x86_64-w64-mingw32/lib/crtend.o

でリンクできるか試してもらえないでしょうか。

mrt-tsk commented 2 months ago

大丈夫でした。存在してます笑 ただ、同じエラーが出ました。

mrt-tsk commented 2 months ago

libc++関連の問題なら関係ない気もしますが、/usr/include/c++/v1をディレクトリをコピーして作ったのがまずかったですかね

KazApps commented 2 months ago

それがまさにlibc++関係のディレクトリです(笑)。 ただし現状問題が発生しているのはリンクしているlibc++.aというファイルなので、include directoryは関係なさそうですね。

mrt-tsk commented 2 months ago

そうだったのか笑 影響がないなら良かったです

KazApps commented 2 months ago

おそらく原因がわかった気がします。 msys上で、

pacman -S mingw-w64-clang-x86_64-libc++

を実行すると、 C:\msys64\mingw64\liblibc++.aなどのlibc++関連のファイルがインストールされると思うので、それから

"/opt/AMD/aocc-compiler-4.2.0/bin/ld.lld" -m i386pep -Bstatic -o YaneuraOu-by-gcc.exe /usr/x86_64-w64-mingw32/lib/crt2.o /usr/x86_64-w64-mingw32/lib/crtbegin.o -L/usr/lib -L/mnt/c/msys64/mingw64/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/ -L/usr/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/mingw/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows ../obj/main.o ../obj/types.o ../obj/bitboard.o ../obj/misc.o ../obj/movegen.o ../obj/position.o ../obj/usi.o ../obj/usi_option.o ../obj/thread.o ../obj/tt.o ../obj/movepick.o ../obj/timeman.o ../obj/book/book.o ../obj/book/apery_book.o ../obj/extra/bitop.o ../obj/extra/long_effect.o ../obj/extra/sfen_packer.o ../obj/extra/super_sort.o ../obj/mate/mate.o ../obj/mate/mate1ply_without_effect.o ../obj/mate/mate1ply_with_effect.o ../obj/mate/mate_solver.o ../obj/eval/evaluate_bona_piece.o ../obj/eval/evaluate.o ../obj/eval/evaluate_io.o ../obj/eval/evaluate_mir_inv_tools.o ../obj/eval/material/evaluate_material.o ../obj/testcmd/unit_test.o ../obj/testcmd/mate_test_cmd.o ../obj/testcmd/normal_test_cmd.o ../obj/testcmd/benchmark.o ../obj/book/makebook.o ../obj/book/makebook2015.o ../obj/book/makebook2023.o ../obj/learn/learner.o ../obj/learn/learning_tools.o ../obj/learn/multi_think.o ../obj/eval/nnue/evaluate_nnue.o ../obj/eval/nnue/evaluate_nnue_learner.o ../obj/eval/nnue/nnue_test_command.o ../obj/eval/nnue/features/k.o ../obj/eval/nnue/features/p.o ../obj/eval/nnue/features/half_kp.o ../obj/eval/nnue/features/half_kp_vm.o ../obj/eval/nnue/features/half_relative_kp.o ../obj/eval/nnue/features/half_kpe9.o ../obj/eval/nnue/features/pe9.o ../obj/engine/yaneuraou-engine/yaneuraou-search.o -s -lpthread -lc++ --start-group -lmingw32 /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a -l:libunwind.a -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 --end-group /usr/x86_64-w64-mingw32/lib/crtend.o

でどうでしょう? これで改善されないようでしたら、

"/opt/AMD/aocc-compiler-4.2.0/bin/ld.lld" --verbose -m i386pep -Bstatic -o YaneuraOu-by-gcc.exe /usr/x86_64-w64-mingw32/lib/crt2.o /usr/x86_64-w64-mingw32/lib/crtbegin.o -L/usr/lib -L/mnt/c/msys64/mingw64/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/ -L/usr/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/mingw/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows ../obj/main.o ../obj/types.o ../obj/bitboard.o ../obj/misc.o ../obj/movegen.o ../obj/position.o ../obj/usi.o ../obj/usi_option.o ../obj/thread.o ../obj/tt.o ../obj/movepick.o ../obj/timeman.o ../obj/book/book.o ../obj/book/apery_book.o ../obj/extra/bitop.o ../obj/extra/long_effect.o ../obj/extra/sfen_packer.o ../obj/extra/super_sort.o ../obj/mate/mate.o ../obj/mate/mate1ply_without_effect.o ../obj/mate/mate1ply_with_effect.o ../obj/mate/mate_solver.o ../obj/eval/evaluate_bona_piece.o ../obj/eval/evaluate.o ../obj/eval/evaluate_io.o ../obj/eval/evaluate_mir_inv_tools.o ../obj/eval/material/evaluate_material.o ../obj/testcmd/unit_test.o ../obj/testcmd/mate_test_cmd.o ../obj/testcmd/normal_test_cmd.o ../obj/testcmd/benchmark.o ../obj/book/makebook.o ../obj/book/makebook2015.o ../obj/book/makebook2023.o ../obj/learn/learner.o ../obj/learn/learning_tools.o ../obj/learn/multi_think.o ../obj/eval/nnue/evaluate_nnue.o ../obj/eval/nnue/evaluate_nnue_learner.o ../obj/eval/nnue/nnue_test_command.o ../obj/eval/nnue/features/k.o ../obj/eval/nnue/features/p.o ../obj/eval/nnue/features/half_kp.o ../obj/eval/nnue/features/half_kp_vm.o ../obj/eval/nnue/features/half_relative_kp.o ../obj/eval/nnue/features/half_kpe9.o ../obj/eval/nnue/features/pe9.o ../obj/engine/yaneuraou-engine/yaneuraou-search.o -s -lpthread -lc++ --start-group -lmingw32 /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a -l:libunwind.a -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 --end-group /usr/x86_64-w64-mingw32/lib/crtend.o

を実行していただいて、

ld.lld: Reading /usr/x86_64-w64-mingw32/lib/crt2.o
ld.lld: Reading /usr/x86_64-w64-mingw32/lib/crtbegin.o
ld.lld: Reading ../obj/main.o
ld.lld: Reading ../obj/types.o
ld.lld: Reading ../obj/bitboard.o
ld.lld: Reading ../obj/misc.o
ld.lld: Reading ../obj/movegen.o
ld.lld: Reading ../obj/position.o
ld.lld: Reading ../obj/usi.o
ld.lld: Reading ../obj/usi_option.o
ld.lld: Reading ../obj/thread.o
ld.lld: Reading ../obj/tt.o
ld.lld: Reading ../obj/movepick.o
ld.lld: Reading ../obj/timeman.o
ld.lld: Reading ../obj/book/book.o
ld.lld: Reading ../obj/book/apery_book.o
ld.lld: Reading ../obj/extra/bitop.o
ld.lld: Reading ../obj/extra/long_effect.o
ld.lld: Reading ../obj/extra/sfen_packer.o
ld.lld: Reading ../obj/extra/super_sort.o
ld.lld: Reading ../obj/mate/mate.o
ld.lld: Reading ../obj/mate/mate1ply_without_effect.o
ld.lld: Reading ../obj/mate/mate1ply_with_effect.o
ld.lld: Reading ../obj/mate/mate_solver.o
ld.lld: Reading ../obj/eval/evaluate_bona_piece.o
ld.lld: Reading ../obj/eval/evaluate.o
ld.lld: Reading ../obj/eval/evaluate_io.o
ld.lld: Reading ../obj/eval/evaluate_mir_inv_tools.o
ld.lld: Reading ../obj/eval/material/evaluate_material.o
ld.lld: Reading ../obj/testcmd/unit_test.o
ld.lld: Reading ../obj/testcmd/mate_test_cmd.o
ld.lld: Reading ../obj/testcmd/normal_test_cmd.o
ld.lld: Reading ../obj/testcmd/benchmark.o
ld.lld: Reading ../obj/book/makebook.o
ld.lld: Reading ../obj/book/makebook2015.o
ld.lld: Reading ../obj/book/makebook2023.o
ld.lld: Reading ../obj/learn/learner.o
ld.lld: Reading ../obj/learn/learning_tools.o
ld.lld: Reading ../obj/learn/multi_think.o
ld.lld: Reading ../obj/eval/nnue/evaluate_nnue.o
ld.lld: Reading ../obj/eval/nnue/evaluate_nnue_learner.o
ld.lld: Reading ../obj/eval/nnue/nnue_test_command.o
ld.lld: Reading ../obj/eval/nnue/features/k.o
ld.lld: Reading ../obj/eval/nnue/features/p.o
ld.lld: Reading ../obj/eval/nnue/features/half_kp.o
ld.lld: Reading ../obj/eval/nnue/features/half_kp_vm.o
ld.lld: Reading ../obj/eval/nnue/features/half_relative_kp.o
ld.lld: Reading ../obj/eval/nnue/features/half_kpe9.o
ld.lld: Reading ../obj/eval/nnue/features/pe9.o
ld.lld: Reading ../obj/engine/yaneuraou-engine/yaneuraou-search.o
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libpthread.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libc++.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libmingw32.a
ld.lld: Reading /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libunwind.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libmoldname.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libmingwex.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libmsvcrt.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libadvapi32.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libshell32.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libuser32.a
ld.lld: Reading /mnt/c/msys64/mingw64/lib/libkernel32.a
ld.lld: Reading /usr/x86_64-w64-mingw32/lib/crtend.o
ld.lld: Reading libpthread.a(libwinpthread_la-thread.o)
ld.lld: Loaded libpthread.a(libwinpthread_la-thread.o) for pthread_attr_init
ld.lld: Reading libc++.a(cxa_guard.cpp.obj)

のようなところを張り付けてもらえると助かります。

mrt-tsk commented 2 months ago

1つ目の実行結果は

ld.lld: error: could not open '../obj/main.o': No such file or directory ld.lld: error: could not open '../obj/types.o': No such file or directory ld.lld: error: could not open '../obj/bitboard.o': No such file or directory ld.lld: error: could not open '../obj/misc.o': No such file or directory ld.lld: error: could not open '../obj/movegen.o': No such file or directory ld.lld: error: could not open '../obj/position.o': No such file or directory ld.lld: error: could not open '../obj/usi.o': No such file or directory ld.lld: error: could not open '../obj/usi_option.o': No such file or directory ld.lld: error: could not open '../obj/thread.o': No such file or directory ld.lld: error: could not open '../obj/tt.o': No such file or directory ld.lld: error: could not open '../obj/movepick.o': No such file or directory ld.lld: error: could not open '../obj/timeman.o': No such file or directory ld.lld: error: could not open '../obj/book/book.o': No such file or directory ld.lld: error: could not open '../obj/book/apery_book.o': No such file or directory ld.lld: error: could not open '../obj/extra/bitop.o': No such file or directory ld.lld: error: could not open '../obj/extra/long_effect.o': No such file or directory ld.lld: error: could not open '../obj/extra/sfen_packer.o': No such file or directory ld.lld: error: could not open '../obj/extra/super_sort.o': No such file or directory ld.lld: error: could not open '../obj/mate/mate.o': No such file or directory ld.lld: error: could not open '../obj/mate/mate1ply_without_effect.o': No such file or directory ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)

2つ目の実行結果は

ld.lld: Reading /usr/x86_64-w64-mingw32/lib/crtbegin.o ld.lld: error: could not open '../obj/main.o': No such file or directory ld.lld: error: could not open '../obj/types.o': No such file or directory ld.lld: error: could not open '../obj/bitboard.o': No such file or directory ld.lld: error: could not open '../obj/misc.o': No such file or directory ld.lld: error: could not open '../obj/movegen.o': No such file or directory ld.lld: error: could not open '../obj/position.o': No such file or directory ld.lld: error: could not open '../obj/usi.o': No such file or directory ld.lld: error: could not open '../obj/usi_option.o': No such file or directory ld.lld: error: could not open '../obj/thread.o': No such file or directory ld.lld: error: could not open '../obj/tt.o': No such file or directory ld.lld: error: could not open '../obj/movepick.o': No such file or directory ld.lld: error: could not open '../obj/timeman.o': No such file or directory ld.lld: error: could not open '../obj/book/book.o': No such file or directory ld.lld: error: could not open '../obj/book/apery_book.o': No such file or directory ld.lld: error: could not open '../obj/extra/bitop.o': No such file or directory ld.lld: error: could not open '../obj/extra/long_effect.o': No such file or directory ld.lld: error: could not open '../obj/extra/sfen_packer.o': No such file or directory ld.lld: error: could not open '../obj/extra/super_sort.o': No such file or directory ld.lld: error: could not open '../obj/mate/mate.o': No such file or directory ld.lld: error: could not open '../obj/mate/mate1ply_without_effect.o': No such file or directory ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)

mrt-tsk commented 2 months ago

なんか実行結果が違いすぎる笑

KazApps commented 2 months ago

YaneuraOu/sourceで実行してますか?

KazApps commented 2 months ago

もしくはmakeのキャッシュが消されてる可能性もあるので、1回

make clean tournament COMPILER=/opt/AMD/aocc-compiler-4.2.0/bin/clang++ EXTRA_CPPFLAGS="-stdlib=libc++ -target x86_64-w64-mingw32 -I/usr/include/mingw-w64 -static -pthread" EXTRA_LDFLAGS="-rtlib=compiler-rt -unwindlib=libunwind -L/usr/lib -L/mnt/c/msys64/mingw64/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/" -j 8

でビルドして、リンクエラーが出たときにもう1回、

"/opt/AMD/aocc-compiler-4.2.0/bin/ld.lld" --verbose -m i386pep -Bstatic -o YaneuraOu-by-gcc.exe /usr/x86_64-w64-mingw32/lib/crt2.o /usr/x86_64-w64-mingw32/lib/crtbegin.o -L/usr/lib -L/mnt/c/msys64/mingw64/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/ -L/usr/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/mingw/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows ../obj/main.o ../obj/types.o ../obj/bitboard.o ../obj/misc.o ../obj/movegen.o ../obj/position.o ../obj/usi.o ../obj/usi_option.o ../obj/thread.o ../obj/tt.o ../obj/movepick.o ../obj/timeman.o ../obj/book/book.o ../obj/book/apery_book.o ../obj/extra/bitop.o ../obj/extra/long_effect.o ../obj/extra/sfen_packer.o ../obj/extra/super_sort.o ../obj/mate/mate.o ../obj/mate/mate1ply_without_effect.o ../obj/mate/mate1ply_with_effect.o ../obj/mate/mate_solver.o ../obj/eval/evaluate_bona_piece.o ../obj/eval/evaluate.o ../obj/eval/evaluate_io.o ../obj/eval/evaluate_mir_inv_tools.o ../obj/eval/material/evaluate_material.o ../obj/testcmd/unit_test.o ../obj/testcmd/mate_test_cmd.o ../obj/testcmd/normal_test_cmd.o ../obj/testcmd/benchmark.o ../obj/book/makebook.o ../obj/book/makebook2015.o ../obj/book/makebook2023.o ../obj/learn/learner.o ../obj/learn/learning_tools.o ../obj/learn/multi_think.o ../obj/eval/nnue/evaluate_nnue.o ../obj/eval/nnue/evaluate_nnue_learner.o ../obj/eval/nnue/nnue_test_command.o ../obj/eval/nnue/features/k.o ../obj/eval/nnue/features/p.o ../obj/eval/nnue/features/half_kp.o ../obj/eval/nnue/features/half_kp_vm.o ../obj/eval/nnue/features/half_relative_kp.o ../obj/eval/nnue/features/half_kpe9.o ../obj/eval/nnue/features/pe9.o ../obj/engine/yaneuraou-engine/yaneuraou-search.o -s -lpthread -lc++ --start-group -lmingw32 /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a -l:libunwind.a -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 --end-group /usr/x86_64-w64-mingw32/lib/crtend.o

を実行してもらえないでしょうか。

mrt-tsk commented 2 months ago

失礼しました。cd YaneuraOu/source してなかったです。 これでいいでしょうか? ld.lld: Reading /usr/x86_64-w64-mingw32/lib/crt2.o ld.lld: Directives: /usr/x86_64-w64-mingw32/lib/crt2.o: -aligncomm:"mingw_winmain_lpCmdLine",3 -aligncomm:"mingw_winmain_hInstance",3 ld.lld: Reading /usr/x86_64-w64-mingw32/lib/crtbegin.o ld.lld: Reading ../obj/main.o ld.lld: Reading ../obj/types.o ld.lld: Reading ../obj/bitboard.o ld.lld: Reading ../obj/misc.o ld.lld: Reading ../obj/movegen.o ld.lld: Reading ../obj/position.o ld.lld: Reading ../obj/usi.o ld.lld: Reading ../obj/usi_option.o ld.lld: Reading ../obj/thread.o ld.lld: Reading ../obj/tt.o ld.lld: Reading ../obj/movepick.o ld.lld: Reading ../obj/timeman.o ld.lld: Reading ../obj/book/book.o ld.lld: Reading ../obj/book/apery_book.o ld.lld: Reading ../obj/extra/bitop.o ld.lld: Reading ../obj/extra/long_effect.o ld.lld: Reading ../obj/extra/sfen_packer.o ld.lld: Reading ../obj/extra/super_sort.o ld.lld: Reading ../obj/mate/mate.o ld.lld: Reading ../obj/mate/mate1ply_without_effect.o ld.lld: Reading ../obj/mate/mate1ply_with_effect.o ld.lld: Reading ../obj/mate/mate_solver.o ld.lld: Reading ../obj/eval/evaluate_bona_piece.o ld.lld: Reading ../obj/eval/evaluate.o ld.lld: Reading ../obj/eval/evaluate_io.o ld.lld: Reading ../obj/eval/evaluate_mir_inv_tools.o ld.lld: Reading ../obj/eval/material/evaluate_material.o ld.lld: Reading ../obj/testcmd/unit_test.o ld.lld: Reading ../obj/testcmd/mate_test_cmd.o ld.lld: Reading ../obj/testcmd/normal_test_cmd.o ld.lld: Reading ../obj/testcmd/benchmark.o ld.lld: Reading ../obj/book/makebook.o ld.lld: Reading ../obj/book/makebook2015.o ld.lld: Reading ../obj/book/makebook2023.o ld.lld: Reading ../obj/learn/learner.o ld.lld: Reading ../obj/learn/learning_tools.o ld.lld: Reading ../obj/learn/multi_think.o ld.lld: Reading ../obj/eval/nnue/evaluate_nnue.o ld.lld: Reading ../obj/eval/nnue/evaluate_nnue_learner.o ld.lld: Reading ../obj/eval/nnue/nnue_test_command.o ld.lld: Reading ../obj/eval/nnue/features/k.o ld.lld: Reading ../obj/eval/nnue/features/p.o ld.lld: Reading ../obj/eval/nnue/features/half_kp.o ld.lld: Reading ../obj/eval/nnue/features/half_kp_vm.o ld.lld: Reading ../obj/eval/nnue/features/half_relative_kp.o ld.lld: Reading ../obj/eval/nnue/features/half_kpe9.o ld.lld: Reading ../obj/eval/nnue/features/pe9.o ld.lld: Reading ../obj/engine/yaneuraou-engine/yaneuraou-search.o ld.lld: Reading /mnt/c/msys64/mingw64/lib/libpthread.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libc++.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libmingw32.a ld.lld: Reading /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libunwind.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libmoldname.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libmingwex.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libmsvcrt.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libadvapi32.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libshell32.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libuser32.a ld.lld: Reading /mnt/c/msys64/mingw64/lib/libkernel32.a ld.lld: Reading /usr/x86_64-w64-mingw32/lib/crtend.o ld.lld: Reading libpthread.a(libwinpthread_la-thread.o) ld.lld: Loaded libpthread.a(libwinpthread_la-thread.o) for pthread_attr_init ld.lld: Reading libc++.a(cxa_guard.cpp.obj) ld.lld: Directives: libc++.a(cxa_guard.cpp.obj)

mrt-tsk commented 2 months ago

"/opt/AMD/aocc-compiler-4.2.0/bin/ld.lld" -m …も実行してみました。

ld.lld: error: undefined symbol: mingw_app_type

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_app_type)

ld.lld: error: undefined symbol: mingw_initcharmax

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_initcharmax)

ld.lld: error: undefined symbol: mingw_initltssuo_force

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_initltssuo_force)

ld.lld: error: undefined symbol: mingw_initltsdyn_force

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_initltsdyn_force)

ld.lld: error: undefined symbol: mingw_initltsdrot_force

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_initltsdrot_force)

ld.lld: error: undefined symbol: __stdio_common_vsscanf

referenced by libc++.a(locale.cpp.obj):(_sscanf_l)

ld.lld: error: undefined symbol: __declspec(dllimport) _strftime_l

referenced by libc++.a(locale.cpp.obj):(std::1::time_put<char, std::__1::ostreambuf_iterator<char, std::1::char_traits>>::do_put(std::1::ostreambuf_iterator<char, std::__1::char_traits>, std::1::ios_base&, char, tm const, char, char) const) referenced by libc++.a(locale.cpp.obj):(std::1::time_put::__do_put(char, char&, tm const, char, char) const) referenced by libc++.a(locale.cpp.obj):(std::1::time_put::__do_put(wchar_t, wchar_t&, tm const*, char, char) const) referenced 6 more times

ld.lld: error: undefined symbol: std::1::basic_streambuf<char, std::__1::char_traits>::seekpos(std::1::fpos, unsigned int)

referenced by misc.cpp ../obj/misc.o referenced by eval/nnue/evaluate_nnue.cpp ../obj/eval/nnue/evaluate_nnue.o

ld.lld: error: undefined symbol: std::__1::codecvt<char, char, int>::id

referenced by misc.cpp ../obj/misc.o referenced by book/book.cpp ../obj/book/book.o referenced by book/apery_book.cpp ../obj/book/apery_book.o referenced 3 more times

KazApps commented 2 months ago

"/opt/AMD/aocc-compiler-4.2.0/bin/ld.lld" -m …とはどのコマンドのことでしょうか? リンカの出力を見る限り、msysの方のlibc++を参照できているようですが、まだエラーは出る状態でしょうか。

mrt-tsk commented 2 months ago

"/opt/AMD/aocc-compiler-4.2.0/bin/ld.lld" -m i386pep -Bstatic -o YaneuraOu-by-gcc.exe /usr/x86_64-w64-mingw32/lib/crt2.o /usr/x86_64-w64-mingw32/lib/crtbegin.o -L/usr/lib -L/mnt/c/msys64/mingw64/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/ -L/usr/x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/mingw/lib -L/opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows ../obj/main.o ../obj/types.o ../obj/bitboard.o ../obj/misc.o ../obj/movegen.o ../obj/position.o ../obj/usi.o ../obj/usi_option.o ../obj/thread.o ../obj/tt.o ../obj/movepick.o ../obj/timeman.o ../obj/book/book.o ../obj/book/apery_book.o ../obj/extra/bitop.o ../obj/extra/long_effect.o ../obj/extra/sfen_packer.o ../obj/extra/super_sort.o ../obj/mate/mate.o ../obj/mate/mate1ply_without_effect.o ../obj/mate/mate1ply_with_effect.o ../obj/mate/mate_solver.o ../obj/eval/evaluate_bona_piece.o ../obj/eval/evaluate.o ../obj/eval/evaluate_io.o ../obj/eval/evaluate_mir_inv_tools.o ../obj/eval/material/evaluate_material.o ../obj/testcmd/unit_test.o ../obj/testcmd/mate_test_cmd.o ../obj/testcmd/normal_test_cmd.o ../obj/testcmd/benchmark.o ../obj/book/makebook.o ../obj/book/makebook2015.o ../obj/book/makebook2023.o ../obj/learn/learner.o ../obj/learn/learning_tools.o ../obj/learn/multi_think.o ../obj/eval/nnue/evaluate_nnue.o ../obj/eval/nnue/evaluate_nnue_learner.o ../obj/eval/nnue/nnue_test_command.o ../obj/eval/nnue/features/k.o ../obj/eval/nnue/features/p.o ../obj/eval/nnue/features/half_kp.o ../obj/eval/nnue/features/half_kp_vm.o ../obj/eval/nnue/features/half_relative_kp.o ../obj/eval/nnue/features/half_kpe9.o ../obj/eval/nnue/features/pe9.o ../obj/engine/yaneuraou-engine/yaneuraou-search.o -s -lpthread -lc++ --start-group -lmingw32 /opt/AMD/aocc-compiler-4.2.0/lib/clang/16/lib/windows/libclang_rt.builtins-x86_64.a -l:libunwind.a -lmoldname -lmingwex -lmsvcrt -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 --end-group /usr/x86_64-w64-mingw32/lib/crtend.o

です。

mrt-tsk commented 2 months ago

まだ、エラー出ますね…

ld.lld: error: undefined symbol: mingw_app_type

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_app_type)

ld.lld: error: undefined symbol: mingw_initcharmax

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_initcharmax)

ld.lld: error: undefined symbol: mingw_initltssuo_force

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_initltssuo_force)

ld.lld: error: undefined symbol: mingw_initltsdyn_force

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_initltsdyn_force)

ld.lld: error: undefined symbol: mingw_initltsdrot_force

referenced by /usr/x86_64-w64-mingw32/lib/crt2.o:(.refptr.mingw_initltsdrot_force)

ld.lld: error: undefined symbol: __stdio_common_vsscanf

referenced by libc++.a(locale.cpp.obj):(_sscanf_l)

ld.lld: error: undefined symbol: __declspec(dllimport) _strftime_l

referenced by libc++.a(locale.cpp.obj):(std::1::time_put<char, std::__1::ostreambuf_iterator<char, std::1::char_traits>>::do_put(std::1::ostreambuf_iterator<char, std::__1::char_traits>, std::1::ios_base&, char, tm const, char, char) const) referenced by libc++.a(locale.cpp.obj):(std::1::time_put::__do_put(char, char&, tm const, char, char) const) referenced by libc++.a(locale.cpp.obj):(std::1::time_put::__do_put(wchar_t, wchar_t&, tm const*, char, char) const) referenced 6 more times

ld.lld: error: undefined symbol: std::1::basic_streambuf<char, std::__1::char_traits>::seekpos(std::1::fpos, unsigned int)

referenced by misc.cpp ../obj/misc.o referenced by eval/nnue/evaluate_nnue.cpp ../obj/eval/nnue/evaluate_nnue.o

ld.lld: error: undefined symbol: std::__1::codecvt<char, char, int>::id

referenced by misc.cpp ../obj/misc.o referenced by book/book.cpp ../obj/book/book.o referenced by book/apery_book.cpp ../obj/book/apery_book.o referenced 3 more times clang-16: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [Makefile:656: YaneuraOu-by-gcc] Error 1 make[1]: Leaving directory '/home/mrttsk/YaneuraOu/source' make: [Makefile:690: tournament] Error 2

KazApps commented 2 months ago

リンカのログに

ld.lld: Reading libmingw32.a(lib64_libmingw32_a-gccmain.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-gccmain.o) for __main
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-natstart.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-natstart.o) for __native_startup_lock
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-wildcard.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-wildcard.o) for _dowildcard
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-dllargv.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-dllargv.o) for _setargv
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-_newmode.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-_newmode.o) for _newmode
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-tlssup.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-tlssup.o) for __mingw_initltssuo_force
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-xncommod.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-xncommod.o) for _commode
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-cinitexe.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-cinitexe.o) for __xc_z
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-merr.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-merr.o) for _matherr
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-CRT_fp10.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-CRT_fp10.o) for _fpreset
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-mingw_helpers.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-mingw_helpers.o) for __mingw_app_type
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o) for _pei386_runtime_relocator
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-usermatherr.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-usermatherr.o) for __mingw_setusermatherr
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-xtxtmode.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-xtxtmode.o) for _fmode
ld.lld: Reading libmingw32.a(lib64_libmingw32_a-crt_handler.o)
ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-crt_handler.o) for _gnu_exception_handler
ld.lld: Reading libmingwex.a(lib64_libmingwex_a-dirent.o)
ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-dirent.o) for opendir
ld.lld: Reading libmingwex.a(lib64_libmingwex_a-mingw-aligned-malloc.o)
ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-mingw-aligned-malloc.o) for __mingw_aligned_malloc
ld.lld: Reading libmingwex.a(lib64_libmingwex_a-mingw_matherr.o)
ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-mingw_matherr.o) for _MINGW_INSTALL_DEBUG_MATHERR
ld.lld: Reading libmingwex.a(lib64_libmingwex_a-fseeko32.o)
ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-fseeko32.o) for fseeko
ld.lld: Reading libmingwex.a(lib64_libmingwex_a-fseeko64.o)
ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-fseeko64.o) for fseeko64
ld.lld: Reading libmingwex.a(lib64_libmingwex_a-ftello.o)
ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-ftello.o) for ftello
ld.lld: Reading libmingwex.a(lib64_libmingwex_a-ftello64.o)
ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-ftello64.o) for ftello64
...(以下略)

のようなところはありませんか。

mrt-tsk commented 2 months ago

見つけました。

ld.lld: Reading libmingw32.a(lib64_libmingw32_a-gccmain.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-gccmain.o) for main ld.lld: Reading libmingw32.a(lib64_libmingw32_a-natstart.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-natstart.o) for native_startup_lock ld.lld: Reading libmingw32.a(lib64_libmingw32_a-wildcard.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-wildcard.o) for _dowildcard ld.lld: Reading libmingw32.a(lib64_libmingw32_a-dllargv.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-dllargv.o) for _setargv ld.lld: Reading libmingw32.a(lib64_libmingw32_a-_newmode.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-_newmode.o) for _newmode ld.lld: Reading libmingw32.a(lib64_libmingw32_a-tlssup.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-tlssup.o) for dyn_tls_init_callback ld.lld: Reading libmingw32.a(lib64_libmingw32_a-xncommod.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-xncommod.o) for _commode ld.lld: Reading libmingw32.a(lib64_libmingw32_a-cinitexe.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-cinitexe.o) for xc_z ld.lld: Reading libmingw32.a(lib64_libmingw32_a-merr.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-merr.o) for _matherr ld.lld: Reading libmingw32.a(lib64_libmingw32_a-CRT_fp10.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-CRT_fp10.o) for _fpreset ld.lld: Reading libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o) for _pei386_runtime_relocator ld.lld: Reading libmingw32.a(lib64_libmingw32_a-usermatherr.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-usermatherr.o) for __mingw_setusermatherr ld.lld: Reading libmingw32.a(lib64_libmingw32_a-xtxtmode.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-xtxtmode.o) for _fmode ld.lld: Reading libmingw32.a(lib64_libmingw32_a-crt_handler.o) ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-crt_handler.o) for _gnu_exception_handler ld.lld: Reading libmingwex.a(lib64_libmingwex_a-dirent.o) ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-dirent.o) for opendir ld.lld: Reading libmingwex.a(lib64_libmingwex_a-mingw_matherr.o) ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-mingw_matherr.o) for _MINGW_INSTALL_DEBUG_MATHERR ld.lld: Reading libmingwex.a(lib64_libmingwex_a-fseeko32.o) ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-fseeko32.o) for fseeko ld.lld: Reading libmingwex.a(lib64_libmingwex_a-fseeko64.o) ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-fseeko64.o) for fseeko64 ld.lld: Reading libmingwex.a(lib64_libmingwex_a-ftello.o) ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-ftello.o) for ftello ld.lld: Reading libmingwex.a(lib64_libmingwex_a-ftello64.o) ld.lld: Loaded libmingwex.a(lib64_libmingwex_a-ftello64.o) for ftello64

KazApps commented 2 months ago

ld.lld: Loaded libmingw32.a(lib64_libmingw32_a-mingw_helpers.o) for __mingw_app_typeという行はないですか?

mrt-tsk commented 2 months ago

あらためて確認してみましたが、なかったです。

mrt-tsk commented 2 months ago

undefined symbol: mingw_app_typeの原因ですか…

KazApps commented 2 months ago

msys上で、

pacman --needed --noconfirm -Syuu
pacman -S mingw-w64-x86_64-gcc

などを実行してからリンクできるか試していただけないでしょうか。

mrt-tsk commented 2 months ago

やってみました。 恐らく同じと思われるエラーが出ました。

KazApps commented 2 months ago

msys上で

nm -a /mingw64/lib/libmingw32.a | grep mingw_app_type

を実行した結果はどうなりますか?

mrt-tsk commented 2 months ago

0000000000000000 B __mingw_app_type

KazApps commented 2 months ago

こちらの環境と全く同じ実行結果です。

KazApps commented 2 months ago

リンクのログに何かエラーとか警告とかってありますか。

mrt-tsk commented 2 months ago

色がついてればわかりやすいのですが…リンクのログから地道にerrorという文字を探せばいいでしょうか?

mrt-tsk commented 2 months ago

ld.lld: Directives: libc++.a(stdlib_stdexcept.cpp.obj): -exclude-symbols:_ZNSt11logic_errorD2Ev -exclude-symbols:_ZNSt11logic_errorD0Ev -exclude-symbols:_ZNKSt11logic_error4whatEv -exclude-symbols:_ZNSt13runtime_errorD2Ev -exclude-symbols:_ZNSt13runtime_errorD0Ev -exclude-symbols:_ZNKSt13runtime_error4whatEv -exclude-symbols:_ZNSt12domain_errorD0Ev -exclude-symbols:_ZNSt16invalid_argumentD0Ev -exclude-symbols:_ZNSt12length_errorD0Ev -exclude-symbols:_ZNSt12out_of_rangeD0Ev -exclude-symbols:_ZNSt11range_errorD0Ev -exclude-symbols:_ZNSt14overflow_errorD0Ev -exclude-symbols:_ZNSt15underflow_errorD0Ev -exclude-symbols:_ZTVSt11logic_error -exclude-symbols:_ZTVSt13runtime_error -exclude-symbols:_ZTVSt12domain_error -exclude-symbols:_ZTSSt12domain_error -exclude-symbols:_ZTSSt11logic_error -exclude-symbols:_ZTSSt9exception -exclude-symbols:_ZTISt9exception -exclude-symbols:_ZTISt11logic_error -exclude-symbols:_ZTISt12domain_error -exclude-symbols:_ZTVSt16invalid_argument -exclude-symbols:_ZTSSt16invalid_argument -exclude-symbols:_ZTISt16invalid_argument -exclude-symbols:_ZTVSt12length_error -exclude-symbols:_ZTSSt12length_error -exclude-symbols:_ZTISt12length_error -exclude-symbols:_ZTVSt12out_of_range -exclude-symbols:_ZTSSt12out_of_range -exclude-symbols:_ZTISt12out_of_range -exclude-symbols:_ZTVSt11range_error -exclude-symbols:_ZTSSt11range_error -exclude-symbols:_ZTSSt13runtime_error -exclude-symbols:_ZTISt13runtime_error -exclude-symbols:_ZTISt11range_error -exclude-symbols:_ZTVSt14overflow_error -exclude-symbols:_ZTSSt14overflow_error -exclude-symbols:_ZTISt14overflow_error -exclude-symbols:_ZTVSt15underflow_error -exclude-symbols:_ZTSSt15underflow_error -exclude-symbols:_ZTISt15underflow_error -exclude-symbols:_ZNSt11logic_errorD1Ev -exclude-symbols:_ZNSt13runtime_errorD1Ev -exclude-symbols:_ZNSt12domain_errorD2Ev -exclude-symbols:_ZNSt12domain_errorD1Ev -exclude-symbols:_ZNSt16invalid_argumentD2Ev -exclude-symbols:_ZNSt16invalid_argumentD1Ev -exclude-symbols:_ZNSt12length_errorD2Ev -exclude-symbols:_ZNSt12length_errorD1Ev -exclude-symbols:_ZNSt12out_of_rangeD2Ev -exclude-symbols:_ZNSt12out_of_rangeD1Ev -exclude-symbols:_ZNSt11range_errorD2Ev -exclude-symbols:_ZNSt11range_errorD1Ev -exclude-symbols:_ZNSt14overflow_errorD2Ev -exclude-symbols:_ZNSt14overflow_errorD1Ev -exclude-symbols:_ZNSt15underflow_errorD2Ev -exclude-symbols:_ZNSt15underflow_errorD1Ev ld.lld: Loaded libc++.a(stdlib_stdexcept.cpp.obj) for std::overflow_error::~overflow_error() ld.lld: Reading libc++.a(stdexcept.cpp.obj) ld.lld: Directives: libc++.a(stdexcept.cpp.obj): -exclude-symbols:_ZNSt11logic_errorC2ERKNSt3112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE -exclude-symbols:_ZNSt11logic_errorC2EPKc -exclude-symbols:_ZNSt11logicerrorC2ERKS -exclude-symbols:_ZNSt11logicerroraSERKS -exclude-symbols:_ZNSt13runtime_errorC2ERKNSt3112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE -exclude-symbols:_ZNSt13runtime_errorC2EPKc -exclude-symbols:_ZNSt13runtimeerrorC2ERKS -exclude-symbols:_ZNSt13runtimeerroraSERKS -exclude-symbols:_ZNSt3121throw_runtime_errorEPKc -exclude-symbols:_ZTSSt13runtime_error -exclude-symbols:_ZTSSt9exception -exclude-symbols:_ZTISt9exception -exclude-symbols:_ZTISt13runtime_error -exclude-symbols:_ZNSt11logic_errorC1ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE -exclude-symbols:_ZNSt11logic_errorC1EPKc -exclude-symbols:_ZNSt11logicerrorC1ERKS -exclude-symbols:_ZNSt13runtime_errorC1ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE -exclude-symbols:_ZNSt13runtime_errorC1EPKc -exclude-symbols:_ZNSt13runtimeerrorC1ERKS ld.lld: Loaded libc++.a(stdexcept.cpp.obj) for std::runtime_error::runtime_error(char const*) ld.lld: Reading libc++.a(cxa_virtual.cpp.obj)

ld.lld: Directives: libc++.a(future.cpp.obj): -exclude-symbols:_ZNKSt3123future_error_category4nameEv -exclude-symbols:_ZNKSt3123future_error_category7messageEi -exclude-symbols:_ZNSt3115future_categoryEv -exclude-symbols:_ZNSt3112future_errorC2ENS_10error_codeE -exclude-symbols:_ZNSt3112future_errorD2Ev -exclude-symbols:_ZNSt3112future_errorD0Ev -exclude-symbols:_ZNSt3117assoc_sub_state16on_zero_sharedEv -exclude-symbols:_ZNSt3117assoc_sub_state9set_valueEv -exclude-symbols:_ZNSt3120throw_future_errorB8ne180100ENS_11future_errcE -exclude-symbols:_ZNSt3117assoc_sub_state24set_value_at_thread_exitEv -exclude-symbols:_ZNSt3117assoc_sub_state13set_exceptionESt13exception_ptr -exclude-symbols:_ZNSt3117assoc_sub_state28set_exception_at_thread_exitESt13exception_ptr -exclude-symbols:_ZNSt3117assoc_sub_state12make_readyEv -exclude-symbols:_ZNSt3117assoc_sub_state4copyEv -exclude-symbols:_ZNSt3117assoc_sub_state10sub_waitERNS_11unique_lockINS_5mutexEEE -exclude-symbols:_ZNSt3117assoc_sub_state4waitEv -exclude-symbols:_ZNSt3117assoc_sub_state9executeEv -exclude-symbols:_ZNSt316futureIvEC2EPNS_17__assoc_sub_stateE -exclude-symbols:_ZNSt316futureIvED2Ev -exclude-symbols:_ZNSt316futureIvE3getEv -exclude-symbols:_ZNSt3__17promiseIvEC2Ev -exclude-symbols:_ZNSt317promiseIvED2Ev -exclude-symbols:clang_call_terminate -exclude-symbols:_ZNSt3112future_errorC2B8ne180100ENS_11future_errcE -exclude-symbols:_ZNSt317promiseIvE10get_futureEv -exclude-symbols:_ZNSt317promiseIvE9set_valueEv -exclude-symbols:_ZNSt317promiseIvE13set_exceptionESt13exception_ptr -exclude-symbols:_ZNSt317promiseIvE24set_value_at_thread_exitEv -exclude-symbols:_ZNSt317promiseIvE28set_exception_at_thread_exitESt13exception_ptr -exclude-symbols:_ZNSt3113shared_futureIvED2Ev -exclude-symbols:_ZNSt3113sharedfutureIvEaSERKS1 -exclude-symbols:_ZNSt3117assoc_sub_stateD2Ev -exclude-symbols:_ZNSt3117assoc_sub_stateD0Ev -exclude-symbols:_ZNSt3123future_error_categoryD0Ev -exclude-symbols:_ZZSt18make_exception_ptrB8ne180100INSt3112future_errorEESt13exception_ptrT_ENUlPvE_8invokeES4_ -exclude-symbols:_ZTVNSt3123future_error_categoryE -exclude-symbols:_ZTVNSt3112future_errorE -exclude-symbols:_ZTSNSt3112future_errorE -exclude-symbols:_ZTSSt11logic_error -exclude-symbols:_ZTSSt9exception -exclude-symbols:_ZTISt9exception -exclude-symbols:_ZTISt11logic_error -exclude-symbols:_ZTINSt3112future_errorE -exclude-symbols:_ZTVNSt3117__assoc_sub_stateE -exclude-symbols:_ZTSNSt3117assoc_sub_stateE -exclude-symbols:_ZTSNSt3114shared_countE -exclude-symbols:_ZTINSt3114shared_countE -exclude-symbols:_ZTINSt3117assoc_sub_stateE -exclude-symbols:_ZTSNSt3123future_error_categoryE -exclude-symbols:_ZTSNSt3112do_messageE -exclude-symbols:_ZTSNSt3114error_categoryE -exclude-symbols:_ZTINSt3114error_categoryE -exclude-symbols:_ZTINSt3112do_messageE -exclude-symbols:_ZTINSt3123future_error_categoryE -exclude-symbols:_ZNSt3112future_errorC1ENS_10error_codeE -exclude-symbols:_ZNSt3112future_errorD1Ev -exclude-symbols:_ZNSt316futureIvEC1EPNS_17assoc_sub_stateE -exclude-symbols:_ZNSt3__16futureIvED1Ev -exclude-symbols:_ZNSt317promiseIvEC1Ev -exclude-symbols:_ZNSt3__17promiseIvED1Ev -exclude-symbols:_ZNSt3__113shared_futureIvED1Ev

ld.lld: Directives: libc++.a(locale_win32.cpp.obj): -exclude-symbols:_Z9newlocaleiPKc8locale_t -exclude-symbols:_Z12MB_CUR_MAX_L8locale_t -exclude-symbols:_ZNSt3121libcpp_locale_guardC2E8locale_t -exclude-symbols:_ZN8locale_tD2Ev -exclude-symbols:_ZNSt3121libcpp_locale_guardD2Ev -exclude-symbols:_Z12localeconv_lR8locale_t -exclude-symbols:_Z8mbrlen_lPKcyP9_Mbstatet8locale_t -exclude-symbols:_Z11mbsrtowcs_lPwPPKcyP9_Mbstatet8locale_t -exclude-symbols:_Z9wcrtomb_lPcwP9_Mbstatet8locale_t -exclude-symbols:_Z9mbrtowc_lPwPKcyP9_Mbstatet8locale_t -exclude-symbols:_Z12mbsnrtowcs_lPwPPKcyyP9_Mbstatet8locale_t -exclude-symbols:_Z12wcsnrtombs_lPcPPKwyyP9_Mbstatet8locale_t -exclude-symbols:_Z7btowc_li8locale_t -exclude-symbols:_Z7wctob_lt8locale_t -exclude-symbols:_Z10snprintf_lPcy8locale_tPKcz -exclude-symbols:_Z10asprintf_lPPc8locale_tPKcz -exclude-symbols:_Z11vasprintf_lPPc8localetPKcS -exclude-symbols:_Z8strtof_lPKcPPc8locale_t -exclude-symbols:_Z9strtold_lPKcPPc8locale_t -exclude-symbols:_ZN15lconv_storageD2Ev -exclude-symbols:__clang_call_terminate -exclude-symbols:_ZN15lconv_storageC2EPK5lconv -exclude-symbols:_ZNSt3112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE17assign_externalEPKcy -exclude-symbols:_ZNSt3112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE17assign_externalEPKc -exclude-symbols:_ZNKSt3112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE20throw_length_errorB8ne180100Ev -exclude-symbols:_ZNSt3120throw_length_errorB8ne180100EPKc -exclude-symbols:_ZNSt12length_errorC2B8ne180100EPKc -exclude-symbols:_ZTSSt12length_error -exclude-symbols:_ZTSSt11logic_error -exclude-symbols:_ZTSSt9exception -exclude-symbols:_ZTISt9exception -exclude-symbols:_ZTISt11logic_error -exclude-symbols:_ZTISt12length_error

mrt-tsk commented 2 months ago

libc++.aの関連のような気がします