xmake-io / xmake-repo

📦 An official xmake package repository
https://xrepo.xmake.io
Apache License 2.0
688 stars 403 forks source link

feat: add libvpx #2255

Open DreamOfIce opened 1 year ago

DreamOfIce commented 1 year ago

你在什么场景下需要该功能?

最近有个项目需要libvpx,所以想把它加入到xmake-repo中

描述可能的解决方案

添加package libvpx(本人有意愿去实现)

描述你认为的候选方案

No response

其他信息

No response

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


In what scenario do you need this function?

Recently a project needs libvpx, so I want to add it to xmake-repo

describe possible solutions

Add package libvpx (I am willing to implement it)

Describe what you think is a candidate

No response

other information

No response

waruqi commented 1 year ago

直接给 pr 过来

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


directly to pr

DreamOfIce commented 1 year ago

直接给 pr 过来

行,另外svt-av1我也做一个吧

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


direct to pr

OK, I will also make one for svt-av1

DreamOfIce commented 1 year ago

@waruqi 这个--host是 package.tools.autoconf 自动加的吗,怎么关掉? https://github.com/xmake-io/xmake-repo/actions/runs/5424594804

DreamOfIce commented 1 year ago

还有wasm构建,为什么调用emcc后会出现g++? 在本地执行相同命令正常通过,也不会出现任何g++字眼

# https://github.com/xmake-io/xmake-repo/actions/runs/5424594811

./configure --enable-static --target=generic-gnu --prefix=/home/runner/.xmake/packages/l/libvpx/1.13.0/10b7e7f804734eb9bce0c45b67fd62a5
  enabling vp8_encoder
  enabling vp8_decoder
  enabling vp9_encoder
  enabling vp9_decoder
Configuring for target 'generic-gnu'
  enabling generic
  enabling unit_tests
  enabling webm_io
  enabling libyuv
Toolchain is unable to link executables

Configuration failed. This could reflect a misconfiguration of your
toolchains, improper options selected, or another problem. If you
don't see any useful error messages above, the next step is to look
at the configure error log file (config.log) to determine what
configure was trying to do when it died.

# config.log

check_cpp
BEGIN /tmp/vpx-conf-120089-10724.c
     1  #include "stdio.h"
     2  int x;
END /tmp/vpx-conf-120089-10724.c
/root/emsdk/upstream/emscripten/emcc -DNDEBUG -O3 -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wextra-semi -Wextra-semi-stmt -Wfloat-conversion -Wformat=2 -Wparentheses-equality -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuninitialized -Wunreachable-code-loop-increment -Wunused -Wextra -Wundef -Wframe-larger-than=52000 -std=gnu89 -Wshorten-64-to-32 -E -o /tmp/vpx-conf-120089-10724.o /tmp/vpx-conf-120089-10724.c
check_ld
check_cc
BEGIN /tmp/vpx-conf-120089-10724.c
     1  int main(void) {return 0;}
END /tmp/vpx-conf-120089-10724.c
/root/emsdk/upstream/emscripten/emcc -DNDEBUG -O3 -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wextra-semi -Wextra-semi-stmt -Wfloat-conversion -Wformat=2 -Wparentheses-equality -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuninitialized -Wunreachable-code-loop-increment -Wunused -Wextra -Wundef -Wframe-larger-than=52000 -std=gnu89 -Wshorten-64-to-32 -c -o /tmp/vpx-conf-120089-10724.o /tmp/vpx-conf-120089-10724.c
g++ -o /tmp/vpx-conf-120089-10724.x /tmp/vpx-conf-120089-10724.o -lpthread
/tmp/vpx-conf-120089-10724.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
waruqi commented 1 year ago

@waruqi 这个--host是 package.tools.autoconf 自动加的吗,怎么关掉? https://github.com/xmake-io/xmake-repo/actions/runs/5424594804

关不掉的。这个包的 configure 是它自己写的,不是标准的 autoconf 生成的。。所以走 tools.autoconf 不适用。。

你只能走 os.vrunv 自己去传参运行 ./configure 。。不用 tools.autoconf

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


@waruqi Is --host automatically added by package.tools.autoconf, how to turn it off? https://github.com/xmake-io/xmake-repo/actions/runs/5424594804

Can't be turned off. The configure of this package is written by itself, not generated by standard autoconf. . So go tools.autoconf does not apply. .

You can only use os.vrunv to pass parameters and run ./configure by yourself. . without tools.autoconf

waruqi commented 1 year ago

还有wasm构建,为什么调用emcc后会出现g++? 在本地执行相同命令正常通过,也不会出现任何g++字眼

# https://github.com/xmake-io/xmake-repo/actions/runs/5424594811

./configure --enable-static --target=generic-gnu --prefix=/home/runner/.xmake/packages/l/libvpx/1.13.0/10b7e7f804734eb9bce0c45b67fd62a5
  enabling vp8_encoder
  enabling vp8_decoder
  enabling vp9_encoder
  enabling vp9_decoder
Configuring for target 'generic-gnu'
  enabling generic
  enabling unit_tests
  enabling webm_io
  enabling libyuv
Toolchain is unable to link executables

Configuration failed. This could reflect a misconfiguration of your
toolchains, improper options selected, or another problem. If you
don't see any useful error messages above, the next step is to look
at the configure error log file (config.log) to determine what
configure was trying to do when it died.

# config.log

check_cpp
BEGIN /tmp/vpx-conf-120089-10724.c
     1  #include "stdio.h"
     2  int x;
END /tmp/vpx-conf-120089-10724.c
/root/emsdk/upstream/emscripten/emcc -DNDEBUG -O3 -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wextra-semi -Wextra-semi-stmt -Wfloat-conversion -Wformat=2 -Wparentheses-equality -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuninitialized -Wunreachable-code-loop-increment -Wunused -Wextra -Wundef -Wframe-larger-than=52000 -std=gnu89 -Wshorten-64-to-32 -E -o /tmp/vpx-conf-120089-10724.o /tmp/vpx-conf-120089-10724.c
check_ld
check_cc
BEGIN /tmp/vpx-conf-120089-10724.c
     1  int main(void) {return 0;}
END /tmp/vpx-conf-120089-10724.c
/root/emsdk/upstream/emscripten/emcc -DNDEBUG -O3 -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wextra-semi -Wextra-semi-stmt -Wfloat-conversion -Wformat=2 -Wparentheses-equality -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuninitialized -Wunreachable-code-loop-increment -Wunused -Wextra -Wundef -Wframe-larger-than=52000 -std=gnu89 -Wshorten-64-to-32 -c -o /tmp/vpx-conf-120089-10724.o /tmp/vpx-conf-120089-10724.c
g++ -o /tmp/vpx-conf-120089-10724.x /tmp/vpx-conf-120089-10724.o -lpthread
/tmp/vpx-conf-120089-10724.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status

这个你要调下它那个 configure 脚本了,如果是标准 autoconf ,肯定没问题的,xmake 能自动给他切,但是它这个似乎自己基于 ffmpeg 那个 configure 魔改过的。。参数格式 内部脚本全不同,只能自己分析里面的脚本去适配下切换

DreamOfIce commented 1 year ago

还有wasm构建,为什么调用emcc后会出现g++? 在本地执行相同命令正常通过,也不会出现任何g++字眼

# https://github.com/xmake-io/xmake-repo/actions/runs/5424594811

./configure --enable-static --target=generic-gnu --prefix=/home/runner/.xmake/packages/l/libvpx/1.13.0/10b7e7f804734eb9bce0c45b67fd62a5
  enabling vp8_encoder
  enabling vp8_decoder
  enabling vp9_encoder
  enabling vp9_decoder
Configuring for target 'generic-gnu'
  enabling generic
  enabling unit_tests
  enabling webm_io
  enabling libyuv
Toolchain is unable to link executables

Configuration failed. This could reflect a misconfiguration of your
toolchains, improper options selected, or another problem. If you
don't see any useful error messages above, the next step is to look
at the configure error log file (config.log) to determine what
configure was trying to do when it died.

# config.log

check_cpp
BEGIN /tmp/vpx-conf-120089-10724.c
     1  #include "stdio.h"
     2  int x;
END /tmp/vpx-conf-120089-10724.c
/root/emsdk/upstream/emscripten/emcc -DNDEBUG -O3 -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wextra-semi -Wextra-semi-stmt -Wfloat-conversion -Wformat=2 -Wparentheses-equality -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuninitialized -Wunreachable-code-loop-increment -Wunused -Wextra -Wundef -Wframe-larger-than=52000 -std=gnu89 -Wshorten-64-to-32 -E -o /tmp/vpx-conf-120089-10724.o /tmp/vpx-conf-120089-10724.c
check_ld
check_cc
BEGIN /tmp/vpx-conf-120089-10724.c
     1  int main(void) {return 0;}
END /tmp/vpx-conf-120089-10724.c
/root/emsdk/upstream/emscripten/emcc -DNDEBUG -O3 -Wall -Wdeclaration-after-statement -Wdisabled-optimization -Wextra-semi -Wextra-semi-stmt -Wfloat-conversion -Wformat=2 -Wparentheses-equality -Wpointer-arith -Wtype-limits -Wcast-qual -Wvla -Wimplicit-function-declaration -Wmissing-declarations -Wmissing-prototypes -Wuninitialized -Wunreachable-code-loop-increment -Wunused -Wextra -Wundef -Wframe-larger-than=52000 -std=gnu89 -Wshorten-64-to-32 -c -o /tmp/vpx-conf-120089-10724.o /tmp/vpx-conf-120089-10724.c
g++ -o /tmp/vpx-conf-120089-10724.x /tmp/vpx-conf-120089-10724.o -lpthread
/tmp/vpx-conf-120089-10724.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status

这个你要调下它那个 configure 脚本了,如果是标准 autoconf ,肯定没问题的,xmake 能自动给他切,但是它这个似乎自己基于 ffmpeg 那个 configure 魔改过的。。参数格式 内部脚本全不同,只能自己分析里面的脚本去适配下切换

行,目前各平台除了wasm需要emconfigure ./configure以外,别的都可以直接运行./configure吗?

waruqi commented 1 year ago

如果是标准的 autoconf 生成的 configure,可以直接执行,并且自动支持 wasm

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


If it is the configure generated by standard autoconf, it can be executed directly and automatically supports wasm

DreamOfIce commented 1 year ago

@waruqi 有办法读取到工具链名称嘛,cross的话这里需要指定:

https://github.com/webmproject/libvpx/blob/main/configure#L100

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


@waruqi Is there a way to read the name of the tool chain? For cross, you need to specify it here:

https://github.com/webmproject/libvpx/blob/main/configure#L100

DreamOfIce commented 1 year ago

另外,Fedora构建中看日志已经安装了yasm,怎么还会报错no found? https://github.com/xmake-io/xmake-repo/actions/runs/5429439410/jobs/9874441868#step:6:97

waruqi commented 1 year ago

另外,Fedora构建中看日志已经安装了yasm,怎么还会报错no found? https://github.com/xmake-io/xmake-repo/actions/runs/5429439410/jobs/9874441868#step:6:97

xmake 安装了 yasm,不代表 configure 就能自动找到。。你不告诉它任何信息,它怎么可能找到哪里有 yasm

如果是标准的 autoconf ,走的 tools.autoconf 。。内部会设置各种 pkg-config 相关的路径,让 autoconf 的 configure 能够自动找到它。。但这个 configure 是他们自己搞得,不规范的,并且你手动运行了 configure ,那就要自己去关联 deps 中的各种路径信息,让它找到。。

可以参考 tools.autoconf

https://github.com/xmake-io/xmake/blob/c0d12baa51bc8011e1d813868d8fa56c45ce3c31/xmake/modules/package/tools/autoconf.lua#L364

但不保证对这个 configure 一定有效,具体你要分析这个 configure 的实现和查找逻辑

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


In addition, yasm has been installed in the log of Fedora build, how can it report no found? https://github.com/xmake-io/xmake-repo/actions/runs/5429439410/jobs/9874441868#step:6: 97

xmake installs yasm, but it does not mean configure can find it automatically. . If you don't tell it any information, how can it find out where there is yasm

If standard autoconf, go tools.autoconf. . Various pkg-config related paths will be set internally, so that configure of autoconf can find it automatically. . But this configure is made by themselves, it is not standardized, and you run configure manually, then you have to associate the various path information in deps by yourself and let it find it. .

You can refer to tools.autoconf

https://github.com/xmake-io/xmake/blob/c0d12baa51bc8011e1d813868d8fa56c45ce3c31/xmake/modules/package/tools/autoconf.lua#L364

But there is no guarantee that this configure will be effective. Specifically, you need to analyze the implementation and search logic of this configure

DreamOfIce commented 1 year ago

编译svt-av1中会出现以下错误,这个-lpthreads是xmake加的嘛,直接运行没问题:

wasm-ld: error: unable to find library -lpthreads
emcc: error: '/root/emsdk/upstream/bin/wasm-ld -o cmTC_d37c4.wasm -z noexecstack -z relro -z now CMakeFiles/cmTC_d37c4.dir/CheckFunctionExists.c.o -lpthreads -L/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmpg0d4_0i4libemscripten_js_symbols.so --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export-if-defined=fflush --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__errno_location --export=__get_temp_ret --export=__set_temp_ret --export=__wasm_call_ctors --export-table -z stack-size=65536 --initial-memory=16777216 --no-entry --max-memory=16777216 --stack-first' failed (returned 1)
gmake[1]: *** [CMakeFiles/cmTC_d37c4.dir/build.make:108: cmTC_d37c4.js] Error 1
gmake[1]: Leaving directory '/root/.xmake/cache/packages/2307/s/svt-av1/1.6.0/source/build_d0780ba2/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:140: cmTC_d37c4/fast] Error 2
DreamOfIce commented 1 year ago

@waruqi 有办法读取到工具链名称嘛,cross的话这里需要指定:

https://github.com/webmproject/libvpx/blob/main/configure#L100

以及,这个有什么解决方案吗

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


@waruqi Is there a way to read the name of the tool chain? For cross, you need to specify it here:

https://github.com/webmproject/libvpx/blob/main/configure#L100

And, is there any solution for this?

waruqi commented 1 year ago

编译svt-av1中会出现以下错误,这个-lpthreads是xmake加的嘛,直接运行没问题:

wasm-ld: error: unable to find library -lpthreads
emcc: error: '/root/emsdk/upstream/bin/wasm-ld -o cmTC_d37c4.wasm -z noexecstack -z relro -z now CMakeFiles/cmTC_d37c4.dir/CheckFunctionExists.c.o -lpthreads -L/root/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /tmp/tmpg0d4_0i4libemscripten_js_symbols.so --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export-if-defined=fflush --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__errno_location --export=__get_temp_ret --export=__set_temp_ret --export=__wasm_call_ctors --export-table -z stack-size=65536 --initial-memory=16777216 --no-entry --max-memory=16777216 --stack-first' failed (returned 1)
gmake[1]: *** [CMakeFiles/cmTC_d37c4.dir/build.make:108: cmTC_d37c4.js] Error 1
gmake[1]: Leaving directory '/root/.xmake/cache/packages/2307/s/svt-av1/1.6.0/source/build_d0780ba2/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:140: cmTC_d37c4/fast] Error 2

这是 cmake 里面的,xmake 不会去改 cmake 里面的编译

waruqi commented 1 year ago

https://github.com/webmproject/libvpx/blob/main/configure#L100

参考 tools.autoconf

https://github.com/xmake-io/xmake/blob/c0d12baa51bc8011e1d813868d8fa56c45ce3c31/xmake/modules/package/tools/autoconf.lua#L102

常用平台,可以假定跟 toolchain 绑定,windows -> msvc, android -> ndk, mingw -> mingw

其他交叉编译,只能细粒度拆分 CC, LD CFLAGS,挨个透传

https://github.com/xmake-io/xmake/blob/c0d12baa51bc8011e1d813868d8fa56c45ce3c31/xmake/modules/package/tools/autoconf.lua#L267

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically.


https://github.com/webmproject/libvpx/blob/main/configure#L100

Refer to tools.autoconf

https://github.com/xmake-io/xmake/blob/c0d12baa51bc8011e1d813868d8fa56c45ce3c31/xmake/modules/package/tools/autoconf.lua#L102

Commonly used platforms can be assumed to be bound to toolchain, windows -> msvc, android -> ndk, mingw -> mingw

Other cross-compilers can only split CC and LD CFLAGS in a fine-grained manner, and transparently transmit them one by one

https://github.com/xmake-io/xmake/blob/c0d12baa51bc8011e1d813868d8fa56c45ce3c31/xmake/modules/package/tools/autoconf.lua#L267