Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to compile on GCC 6.1 mingw-w64 #41

Closed
TimothyGu opened this issue Apr 30, 2016 · 3 comments
Closed

Fails to compile on GCC 6.1 mingw-w64 #41

TimothyGu opened this issue Apr 30, 2016 · 3 comments

Comments

@TimothyGu
Copy link
Contributor

A user reported that with GCC 6.1.0 and mingw-w64 fdk-aac fails to compile.

libAACenc/src/aacEnc_rom.cpp:661:1: error: narrowing conversion of '2180108801u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
 };
 ^
libAACenc/src/aacEnc_rom.cpp:661:1: error: narrowing conversion of '2435191937u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:661:1: error: narrowing conversion of '2914591489u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:661:1: error: narrowing conversion of '3560484608u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '2147483649u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
 };
 ^
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '2276992735u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '2649899348u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '3221225445u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:665:1: error: narrowing conversion of '3922060664u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2156644481u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
 };
 ^
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2229462401u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2372618753u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2581238273u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '2848216833u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '3164462721u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '3519206656u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:674:1: error: narrowing conversion of '3900368192u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2147483649u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
 };
 ^
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2184048624u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2292498406u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2469139869u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '2707957698u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '3000819239u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '3337751441u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '3707280484u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]
libAACenc/src/aacEnc_rom.cpp:681:1: error: narrowing conversion of '4096822497u' from 'unsigned int' to 'FIXP_DBL {aka long int}' inside { } [-Wnarrowing]

I'm not 100% certain if this is a GCC bug or not.

Full log is available at https://gist.githubusercontent.com/starius/f0a78ec2f1fbe92d92f250e4ff22bc51/raw/cbf726fb7702c5719662ed1cff14d3c346a3092e/fdk-aac_x86_64-w64-mingw32.shared

@mstorsjo
Copy link
Owner

It's not a GCC bug, but a case that newer GCC versions has changed the default C++ standard version from the old (-std=c++98 perhaps) to some of the newer versions (11 or 14), and the newer versions have gotten more strict about this.

I've talked to Fraunhofer about it, and the're aware that the code isn't compliant with the newer versions, and they're thinking about how/when to fix it. (And even if they fix it and deliver a new code drop to google, there's no guarantee that google includes it in the next Android release. At one point, they had delivered a fix for crashes with >= 64 kHz, which google didn't include in the following release.)

Fixing these is tedious (adding suffixes/casts/whatever to large tables), but I guess the best fix is just to add -std=c++98 (or similar) in the makefile. Can you try that (in case you have a new enough GCC to reproduce) and do a pull request if you get it verified that it fixes the issue?

@adonais
Copy link

adonais commented May 4, 2016

You may add CXX flags such as -wno-narrowing.
../configure --prefix=/mingw/3rdparty/fdk-aac CXXFLAGS="-O2 -msse2 -Wno-narrowing -std=gnu++11"

@mstorsjo
Copy link
Owner

Fixed in 15b128d.

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

No branches or pull requests

3 participants