Fix build on Linux using portable function