mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2025-10-25 18:32:22 +00:00
fix windows build error
This commit is contained in:
@@ -16,12 +16,10 @@ cd ..
|
||||
git clone https://github.com/ftk/quickjspp --depth=1
|
||||
cd quickjspp
|
||||
patch quickjs/quickjs-libc.c -i ../scripts/patches/0001-quickjs-libc-add-realpath-for-Windows.patch
|
||||
# 对 quickjs/quickjs.c 应用自动补丁,添加 weak 属性,避免 mingw 重复定义冲突
|
||||
# 这里假设 __mingw_fe_pc53_env、__mingw_fe_pc64_env 和 __mingw_fe_dfl_env 均以 int 开头定义
|
||||
sed -i 's/^int __mingw_fe_pc53_env/__attribute__((weak)) int __mingw_fe_pc53_env/' quickjs/quickjs.c
|
||||
sed -i 's/^int __mingw_fe_pc64_env/__attribute__((weak)) int __mingw_fe_pc64_env/' quickjs/quickjs.c
|
||||
sed -i 's/^int __mingw_fe_dfl_env/__attribute__((weak)) int __mingw_fe_dfl_env/' quickjs/quickjs.c
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .
|
||||
# 通过 -fno-builtin 禁用内建函数,防止 GCC 插件生成额外的符号(例如 __mingw_fe_pc53_env 等)
|
||||
cmake -G "Unix Makefiles" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_FLAGS="-fno-builtin" .
|
||||
make quickjs -j4
|
||||
install -d "$MINGW_PREFIX/lib/quickjs/"
|
||||
install -m644 quickjs/libquickjs.a "$MINGW_PREFIX/lib/quickjs/"
|
||||
|
||||
Reference in New Issue
Block a user