fix clang warnings (#3915)
- fix clang warnings: check linker flags
building for neoverse-n1 (-DADLINK) with clang warns about unsupported linker flags:
clang: warning: optimization flag '-fuse-linker-plugin' is not supported [-Wignored-optimization-argument] clang: warning: argument unused during compilation: '-fuse-ld=gold' [-Wunused-command-line-argument]add check for ld.gold and only use it if available
Signed-off-by: Pepper Gray hello@peppergray.xyz
- fix clang warnings: use portable inttypes
building using clang warns about format specifier mismatch
src/os/sysinfo.c:173:26: warning: format specifies type 'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat] 173 | sprintf(str, "%llu", info->frequency); | ~~~~ ^~~~~~~~~~~~~~~ | %lu src/os/sysinfo.c:193:129: warning: format specifies type 'int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat] 193 | snprintf(branding, sizeof(branding), BOX64_BUILD_INFO_STRING_SHORT " on %.*s @%04d MHz", 28, box64_sysinfo.cpuname, box64_sysinfo.frequency / 1000000); | ~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | %04luuse inttypes format macros instead of format specifiers directly
Signed-off-by: Pepper Gray hello@peppergray.xyz
- fix clang warnings: print missing argument
building using clangs warns about an unused parameter:
src/emu/x64int3.c:208:117: warning: data argument not used by format string [-Wformat-extra-args] 208 | snprintf(buff, 256, "%04d|%p: Calling %s(\"%s\")", tid, *(void**)(R_RSP), s, (tmp)?tmp:"(nil)", (tmp2)?tmp2:"nil"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^print the missing parameter
Signed-off-by: Pepper Gray hello@peppergray.xyz
- fix clang warnings: use array indexing
building using clang warns about the way the signature is formated:
src/wrapped/wrappedvulkan_private.h:80:1: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int] src/libtools/vulkanoverlay.c:133:94: note: expanded from macro 'GO_vFpff' 133 | #define GO_vFpff(A, B, N) static void my_##A##_##N(void* a, float b, float c) {F3(A, #B +2, N);} | ~~~~~~~~~^~~~~~ src/wrapped/wrappedvulkan_private.h:80:1: note: use array indexing to silence this warningfollow compiler suggestion and replace
#B +2with&(#B)[2]Signed-off-by: Pepper Gray hello@peppergray.xyz
- fix clang warnings: remove extraneous parentheses
building using clang warns about extraneous parentheses
src/wrapped32/wrappeddbus.c:541:18: warning: equality comparison with extraneous parentheses [-Wparentheses-equality] 541 | if((type == (int)'s')) { | ~~~~~^~~~~~~~~~~ src/wrapped32/wrappeddbus.c:541:18: note: remove extraneous parentheses around the comparison to silence this warningSigned-off-by: Pepper Gray hello@peppergray.xyz
- fix clang warnings: use proper type in function signature
building on clang warns about type mismatch:
src/wrapped/wrappedgmp.c:158:38: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] 158 | return my->__gmp_vasprintf(strp, fmt, VARARGS); | ^~~ 165 | return my->__gmp_vfprintf(stream, fmt, VARARGS); | ^~~ 176 | return my->__gmp_vasprintf(strp, fmt, VARARGS); | ^~~ 187 | return my->__gmp_vfprintf(stream, fmt, VARARGS); | ^~~modifiy definition to use the actual type instead of void.
Signed-off-by: Pepper Gray hello@peppergray.xyz
- fix clang warnings: excess elements in initalizer
building using clang warns about excess elements in initalizer:
src/wrapped/wrappercallback.h:16:53: warning: excess elements in struct initializer [-Wexcess-initializers] 16 | static TYPENAME(LIBNAME) TYPENAME2(my_, LIBNAME) = {0}; | ^remove redundant initalization of static elements
Signed-off-by: Pepper Gray hello@peppergray.xyz
- fix clang warnings: remove excessive argument
building using clans warns about too many arguments:
src/wrapped32/wrappedopenal.c:104:41: warning: too many arguments in call to 'fillALProcWrapper32' 104 | fillALProcWrapper32(emu->context); | ~~~~~~~~~~~~~~~~~~~ ^ src/wrapped32/wrappedopenal.c:104:28: warning: passing arguments to 'fillALProcWrapper32' without a prototype is deprecated in all versions of C and is not supported in C23 [-Wdeprecated-non-prototype] 104 | fillALProcWrapper32(emu->context); | ^fillALProcWrapper32 takes no arguments
Signed-off-by: Pepper Gray hello@peppergray.xyz
Signed-off-by: Pepper Gray hello@peppergray.xyz
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Box64:Linux 用户空间 x86-64 模拟器(支持原生库)
官网 | 更新日志 | English | Українська | Report an Error
请查看我们的游戏兼容性列表:https://box86.org/app/,并请帮助我们改进它!
Box64 可以在非 x86_64 Linux 主机系统(比如 Arm)上运行 x86_64 Linux 程序(比如游戏),目前仅支持 64 位小端主机系统。
Box64 可以使用本机原生的系统库(libc、libm、SDL、OpenGL),有着易于集成的特性和令人惊讶的性能。如需性能基准测试,请查看此分析。
借助适用于 Arm,RISC-V 以及龙架构平台的 DynaRec,Box64 的速度比单独使用解释器快 5-10 倍。如需深入了解 DynaRec,请参考此文章。
Logo 由 @grayduck 制作,感谢!
使用方法
$ box64 ./program [args]运行 Linux x86_64 程序。$ box64 -k杀死所有模拟的进程。$ box64-bash进入 x86_64 bash 环境。Box64 还提供了环境变量和 Rc 文件来控制其行为。有关详细信息请参阅使用文档。
编译和安装
版本历史
请参阅变更日志了解版本更新说明。
平台兼容性说明
Box64 直接转换 x86_64 函数调用到本机原生库,因此需要主机系统上的 64 位库。对于 32 位二进制文件,请使用 Box86 或 Box32。
注意事项
uname -m判断当前架构,请使用box64 script.sh的方式运行以便让 Box64 接管。配置
Box64 的配置文件位于
/etc/box64.box64rc和~/.box64rc,均为.ini格式的文件。如果您不想使用默认的/etc/box64.box64rc文件,请将其复制到~/.box64rc以确保兼容性。配置项的优先级:
~/.box64rc>/etc/box64.box64rc> 命令行。更多信息,请参阅使用文档。
特定平台的其他说明
Unity 游戏
MESA_GL_VERSION_OVERRIDE=3.2和BOX64_DYNAREC_STRONGMEM=1以防止卡死并启用强内存模式。PAN_MESA_DEBUG=gl3以强制更高的 OpenGL Profile。如果游戏可以启动但在显示任何内容之前意外退出,这个设置可能会有所帮助。Steam
Box64 支持 Linux Steam 和 Windows Steam,更多细节请参考Steam 文档。
Wine
Box64 支持 Wine64 和 Proton。对于 32 位组件,需要 Box86。配备 Box64 和 Box86 的系统可以运行 32 位和 64 位的 Windows 程序。
提示:您可以使用 Wine WOW64 版本在仅限 Box64 的环境中运行 x86 Windows 程序,这项支持仍处于实验阶段,但在大多数情况下都可以工作。
有关更多信息,请参阅 Wine 使用说明。
结语
我要感谢所有为 box64 开发做出贡献的人。 贡献方式有很多种:代码贡献、财务帮助、捐赠捐赠和广告合作! 以下感谢不分先后:
我还要感谢很多人,即使他们只参与了一次本项目。
(如果你的项目中使用了Box64,请不要忘记提及!)