Skip to content
This repository was archived by the owner on Feb 27, 2026. It is now read-only.

添加更多系统的架构和兼容性识别#71

Merged
Hill23333 merged 27 commits intoPCL-Community:mainfrom
AnemoFlower:main
May 8, 2025
Merged

添加更多系统的架构和兼容性识别#71
Hill23333 merged 27 commits intoPCL-Community:mainfrom
AnemoFlower:main

Conversation

@AnemoFlower
Copy link
Copy Markdown
Contributor

@AnemoFlower AnemoFlower commented Apr 26, 2025

通过 file -L ... 判断文件架构。
-L 参数会递归解析符号链接,输出格式:

/usr/bin/java: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=2d06c32477208907961eec451ac46d1871803913, for GNU/Linux 3.7.0, stripped

命令仅在 Ubuntu 上经过测试。

自提交 06a7930 起,Linux 架构通过读取 ELF 文件头判断。
自提交 874c314 起,Windows 架构通过读取 PE 文件头判断,macOS 架构通过读取 mach-O 文件头判断。

@AnemoFlower
Copy link
Copy Markdown
Contributor Author

搁这刷PR呢

@AnemoFlower AnemoFlower changed the title 针对其他类 Unix 系统设置兼容性 针对 Linux 系统设置兼容性 Apr 27, 2025
Copy link
Copy Markdown
Member

@AMagicPear AMagicPear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好像已经和标题对不上了

@AnemoFlower
Copy link
Copy Markdown
Contributor Author

好像已经和标题对不上了

雀食

@AMagicPear
Copy link
Copy Markdown
Member

话说,file -L 在 mac 也能用,那 mac 还有必要单独用 lipo 判断吗

@AnemoFlower
Copy link
Copy Markdown
Contributor Author

AnemoFlower commented Apr 27, 2025

话说,file -L 在 mac 也能用,那 mac 还有必要单独用 lipo 判断吗

输出不一样

yizhimcqiu@MacBook-Air ~ % file -L /usr/bin/java
/usr/bin/java: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/java (for architecture x86_64):	Mach-O 64-bit executable x86_64
/usr/bin/java (for architecture arm64e):	Mach-O 64-bit executable arm64e

(可恶的Gitify,有新Notification不通知我)

@AMagicPear
Copy link
Copy Markdown
Member

现在这个在 Linux 上测试有问题。这是在 Codespace 的 Ubuntu 环境下:
截屏2025-04-29 12 13 12
系统架构是 X64,但现在 Linux 的代码检测出来的文件架构是 X86。理论上应该是 X64 才对。
截屏2025-04-29 12 15 52

@AnemoFlower
Copy link
Copy Markdown
Contributor Author

AnemoFlower commented Apr 29, 2025

现在这个在 Linux 上测试有问题。这是在 Codespace 的 Ubuntu 环境下:

Hill 不是说周末写个库吗,理论上这个 PR 可以 Close 了(

@AnemoFlower AnemoFlower changed the title 针对 Linux 系统设置兼容性 添加更多系统的架构和兼容性识别 May 5, 2025
@AnemoFlower
Copy link
Copy Markdown
Contributor Author

将判断架构的代码迁移到 ArchitectureUtils.cs 中,使用自己的枚举类而不是 System.Runtime.InteropServices.Architecture,并在 JavaData.cs 中判断架构是否匹配和转译支持。

@AnemoFlower
Copy link
Copy Markdown
Contributor Author

现在这个在 Linux 上测试有问题。这是在 Codespace 的 Ubuntu 环境下:

Hill 不是说周末写个库吗,理论上这个 PR 可以 Close 了(

周二了……

@Hill23333 Hill23333 merged commit aad2d8e into PCL-Community:main May 8, 2025
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants