Vcpkg: [mpg123] Building on ARM

Created on 4 May 2020  路  8Comments  路  Source: microsoft/vcpkg

Is your feature request related to a problem? Please describe.
mpg123 supports ARM architectures; however, the portfile, automatically fails builds on either ARM architectures __or__ UWP. ARM Windows support was added with #7934 so this might be a slight oversight. It seems that the intention is to fail builds on arm-uwp triplets, but vcpkg_fail_port_install operates on the disjunction of its parameters and not the conjunction.

Another issue is with cross-compilation; vcpkg ports that build with CMake can be cross-compiled easily by writing an appropriate triplet for the toolchain and setting CC and CXX environment variables. However, mpg123 builds with autoconf, so the cross-compiler prefix must be passed to ./configure via the --host parameter.

Proposed solution
I customized the portfile locally and this works specifically to cross-compile to arm64. Modified portfile and corresponding triplet. However, I think it would be appropriate to genericize this approach so it can be used for other compiler settings without locally editing the portfile, but I'm not familiar enough with the vcpkg approach to proceed further, so I'm looking for suggestions and pointers.

port-feature

Most helpful comment

@kevinlul We already have vcpkg_configure_make / vcpkg_build_make / vcpkg_install_make and it can use autoconf.
So, I think it's best to rewrite the build process on non-Windows.

All 8 comments

Hi @kevinlul, thanks for reporting this issue!
Could you create a PR to fix it?

Thansk.

Hi @JackBoosY , I created this issue to ask about how to go about things. I've started on the work here but I haven't figured out the key parts under vcpkg right.

I know you can set environment variables for the called process directly with set(ENV{VAR} blah blah), add switches to the vcpkg_execute_required_process call, or write a custom build script like with ffmpeg.

I don't know how to read the compiler prefix for autoconf though from CMAKE_C_COMPILER and pass it via the --host switch to configure. This is the only way to cross-compile autoconf projects and it doesn't look like any port is set up for this. I think I could read it by calling the compiler with -dumpmachine and reading stdout, but this for GGC/Clang.

The portfile is tested on both ARM32 and ARM64 Desktop, but we still need to figure out how to get UWP working.

Not sure why the current master blocks ARM desktop as well...
But now with UWP support added, nothing should be blocked (for Windows) now.

Close this issue via #11287 merged.

@JackBoosY This issue wasn't just about the autofailing -- it's about how to pass the compilers specified in a vcpkg triplet or CMake toolchain file to autoconf under vcpkg.

Are there examples of specifying compiler prefixes to autoconf in existing ports?

@kevinlul We already have vcpkg_configure_make / vcpkg_build_make / vcpkg_install_make and it can use autoconf.
So, I think it's best to rewrite the build process on non-Windows.

Was this page helpful?
0 / 5 - 0 ratings