Skip to content

Arm版への対応 #2042

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

Open
beru opened this issue Apr 22, 2025 · 6 comments
Open

Arm版への対応 #2042

beru opened this issue Apr 22, 2025 · 6 comments

Comments

@beru
Copy link
Contributor

beru commented Apr 22, 2025

Windows on ARM (ARM版Windows) 向けのデバイスが出回ってきているのでそれへの対応を考えるissueです。

@beru
Copy link
Contributor Author

beru commented Apr 22, 2025

Windows SDK 10.0.26100.0 から32-bit ARMには未対応になったので (link) ARM64への対応になると思います。

個人的に確認に使おうと思っているハードウェアは、

  • QualcommのSnapdragonプロセッサを搭載したWindows PC
  • Raspberry Pi 5

MicrosoftがAMDやIntelのx64プロセッサだけではなくてARM64のWindows PCを売りたい理由は良く分からないですが、ARM/Qualcomm/Mediatekなどがスマフォやタブレット以外だけではなくてPCでも彼らのプロセッサを使ってもらいたいからかな?まだ比較的未成熟だと思いますがせっかくなので対応環境を増やしておきたいです。

@beru
Copy link
Contributor Author

beru commented Apr 22, 2025

Visual Studio の Configuration Manager で Active solution platform のドロップダウンから <New...> を選択して既存のWin32とx64以外のプラットフォームの設定を追加できます。

Image

ここでARMではなくて

Image

ARM64を選択する事で最近の64bitのArm版Windows向けの構成を用意出来ます。

Image

ビルドすると ARM64\Release\sakura.exe ファイルが作られますが、下記のメッセージが出力されます。

sakura\sakura\ExtractArchives.targets(75,5): error MSB4044: The "ExtractArchive" task was not given a value for the required parameter "InternalPath".

これは sakura/ExtractArchives.targets ファイルに x64 と Win32 向けの記述がありますが ARM64 向けの記述が無い為に起きているように見えます。installer/externals フォルダ以下にある bregonig と universal-ctags のバイナリは公式サイトでもARM64向けのバイナリ配布はされていない為、ARM64向けのこれらの用意は自前で行う必要がありそうです。

@beru
Copy link
Contributor Author

beru commented Apr 23, 2025

Visual Studio 2022 をARM64のWindows PCにインストールしてサクラエディタをビルドしてみました。

sakura/funccode.targets ファイルにWin32ビルドの HeaderMake.exe を使う記述があってそれが問題になりましたが、sakura.exe は問題なく生成されて動作しました。

検索画面で正規表現のチェックを付けると下記のメッセージボックスが表示されましたが、メッセージ文字列の調整が必要ですね。

Image

---------------------------
正規表現エラー
---------------------------
bregonig.dll のロードに失敗しました。

正規表現を利用するには Unicode/x64 版の bregonig.dll が必要です。

入手方法はヘルプを参照してください。
---------------------------
OK   
---------------------------

@berryzplus
Copy link
Contributor

結局「やりたい?」に尽きるんですよね。

vcpkgもCMakeも使いたくない、の状況だと対応がめんどいですが、やれないかと言えばそうでもないわけで。

@beru
Copy link
Contributor Author

beru commented Apr 24, 2025

少し前に対応してほしい的なメールが来たのでそろそろ対応しとくかと思ってレノボの安めのノートPCを衝動買いしました。少しずつしか進められないと思いますがやってみます。

@beru
Copy link
Contributor Author

beru commented Apr 24, 2025

bregonig.dll の用意

  • Developer Command Prompt を起動
  • VsDevCmd.bat -host_arch=arm64 -arch=arm64

鬼雲のビルド

git clone https://github.com/k-takata/Onigmo.git
cd Onigmo
build_nmake.cmd ARCH=arm64

bregonigのビルド

git clone https://github.com/k-takata/bregonig.git
cd bregonig\src
nmake ONIG_DIR=..\..\onigmo TARGET_CPU=arm64

下記のように Makefile を変更して /DYBNAMICBASE を指定するように変更する必要がありました。

#LDFLAGS = /DLL /nologo /MAP /BASE:$(BASEADDR) /merge:.rdata=.text
LDFLAGS = /DLL /nologo /MAP /DYNAMICBASE /merge:.rdata=.text

src\objarm64\bregonig.dll ファイルを sakura.exe と同じ場所にコピーしてからサクラエディタの検索で正規表現が使える事を確認しました。

Image

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