Author Topic: common/mptAlloc.cpp:61:20: error: 'aligned_alloc' is not a member of 'std'"  (Read 679 times)

Offline Reino

  • Shy artist
  • Posts: 3
Hello,

I'm cross-compiling (on Windows using Cygwin, MinGW and GCC) libopenmpt for inclusion in FFmpeg. I've updated from 'libopenmpt-0.3.13+release.autotools.tar.gz' to 'libopenmpt-0.4.4+release.autotools.tar.gz' and am now getting the following error:
Code: [Select]
common/mptAlloc.cpp:61:20: error: 'aligned_alloc' is not a member of 'std'
I've done some searching and was able to fix with...
Code: [Select]
export CXXFLAGS="-std=gnu++11"...before running 'configure' and 'make'.
But I was wondering if this is the right approach/fix.

-- Reino

Offline manx

  • OpenMPT Developers
  • *****
  • Posts: 227
Just to clarify: you are using MinGW in a Cygwin environment and "cross-compile" to native(/MinGW) Windows?

I have not used cygwin in years, and this particular setup is thus untested for libopenmpt. It should work though.

Which GCC is MinGW using? Which MinGW/msys variant (mingw32 or mingw-w64)?

Anyway, I'll assume MinGW-w64 with what looks like GCC version >= 8.1 for now, which means that configure will enable -std=c++17, which in turn makes mptAlloc.cpp expect working C++17, which GCC/libstdc++ fail to provide on MinGW.
Can you please try the attached patch (and avoid export CXXFLAGS="-std=gnu++11")?

Sorry for the delayed answer. OpenMPT team was busy at Revision demoparty.

Offline Reino

  • Shy artist
  • Posts: 3
Just to clarify: you are using MinGW in a Cygwin environment and "cross-compile" to native(/MinGW) Windows?
[...]
Which GCC is MinGW using? Which MinGW/msys variant (mingw32 or mingw-w64)?
That's exactly right. I'm using this MinGW-w64 build script. Locally I'm already using GCC 8.3.

Can you please try the attached patch (and avoid export CXXFLAGS="-std=gnu++11")?
No errors while compiling libopenmpt. Successfully created a FFmpeg binary with it. Tracker/module files are played/rendered perfectly.
I think it's save to say your patch is a success. Thanks a lot!

Offline manx

  • OpenMPT Developers
  • *****
  • Posts: 227
Can you please try the attached patch (and avoid export CXXFLAGS="-std=gnu++11")?
No errors while compiling libopenmpt. Successfully created a FFmpeg binary with it. Tracker/module files are played/rendered perfectly.
I think it's save to say your patch is a success. Thanks a lot!

Great. Fix applied as r11566 (libopenmpt 0.5) and r11567 (libopenmpt 0.4). Will be in the next released update (which will be in a couple of weeks, probably).

Offline Reino

  • Shy artist
  • Posts: 3
Thank you.