Skip to content

Fix for cross compiling for android#291

Open
talregev wants to merge 1 commit intoalgebraic-solving:masterfrom
talregev:TalR/fix_android
Open

Fix for cross compiling for android#291
talregev wants to merge 1 commit intoalgebraic-solving:masterfrom
talregev:TalR/fix_android

Conversation

@talregev
Copy link

Fix for cross compiling for android

@talregev talregev mentioned this pull request Mar 12, 2026
13 tasks
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([floor getdelim gettimeofday memmove memset pow sqrt strchr strstr strtol])
AC_CHECK_FUNCS([floor getdelim gettimeofday memmove memset malloc realloc pow sqrt strchr strstr strtol])
Copy link

@dg0yt dg0yt Mar 12, 2026

Choose a reason for hiding this comment

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

Note that this changes the meaning of the result macros. The change is valid if msolve only depends on the availability of the functions, not on being "compatible with the GNU C library" malloc/realloc at runtime.

Copy link
Author

Choose a reason for hiding this comment

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

Do you have a better solution?

Copy link
Contributor

Choose a reason for hiding this comment

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

msolve depends heavily on malloc/realloc, so this should not be a problem.

@talregev talregev requested a review from dg0yt March 12, 2026 16:03
@wegank wegank mentioned this pull request Mar 16, 2026
@talregev
Copy link
Author

For the maintainers, This PR was approve as a patch in vcpkg. FYI.
microsoft/vcpkg#50415

@dg0yt
Copy link

dg0yt commented Mar 19, 2026

For the maintainers, This PR was approve as a patch in vcpkg. FYI. microsoft/vcpkg#50415

This is not thorough endorsement. vcpkg builds ports, but it doesn't run any tests. It doesn't answer if msolve actually depends on the specific runtime behavior checked by AC_FUNC_MALLOC.

To be clear, I'm happy about removing configuration tests which depend on running executables on the target platform. It is a barrier for generic cross builds recipes. But you probably don't want to enable UB by dereferencing the result of malloc(0) when it is not a valid pointer.

@talregev
Copy link
Author

@dg0yt Do you have any solution for cross compiling android?

@dg0yt
Copy link

dg0yt commented Mar 21, 2026

@dg0yt Do you have any solution for cross compiling android?

The general solution is to run the configuration check on the target machine (emulator), capture the result, and pass it into the cross build. For these autotools macros, it can probably be done by injecting ac_cv_func_malloc_0_nonnull etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants