John Warburton
2016-Feb-09 21:31 UTC
[flac-dev] Compilation failure using mingw-w64 and gcc-5.3.0
Thank you for the feedback. This is cross-compiling for mingw-w64-x86_64 using gcc-5.3.0 and mingw-w64-4.0.4 on GNU/Linux. Upon attempting to compile now, a large number of errors occur in flac/decode.c which I have placed at the end of this email. They are eased by adding this to decode.c: #if _WIN32 #include <windows.h> #include <shlobj.h> #endif ...among the headers. Then, this error results when attempting to link flac.exe: decode.o:decode.c:(.text+0x4fe1): undefined reference to `CreateFile_utf8' decode.o:decode.c:(.text+0x50fb): undefined reference to `CreateFile_utf8' ../../src/share/grabbag/.libs/libgrabbag.a(file.o):file.c:(.text+0x156): undefined reference to `CreateFile_utf8' ../../src/share/grabbag/.libs/libgrabbag.a(file.o):file.c:(.text+0x188): undefined reference to `CreateFile_utf8' collect2: error: ld returned 1 exit status Makefile:487: recipe for target 'flac.exe' failed I believe the developers have been attending to code relevant to this error in the recent past. Without adding the headers above, this compiler bail-out happens: make[3]: Entering directory '/home/admin/development/MultimediaTools-mingw-w64/sandbox/x86_64/flac/src/flac' depbase=`echo analyze.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I./include -I../../include -DNDEBUG -D__MSVCRT_VERSION__=0x0601 -I/home/admin/development/MultimediaTools-mingw-w64/sandbox/mingw-w64-x86_64/x86_64-w64-mingw32/include -O3 -funroll-loops -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline -Wdeclaration-after-statement -D_FORTIFY_SOURCE=2 -msse2 -MT analyze.o -MD -MP -MF $depbase.Tpo -c -o analyze.o analyze.c &&\ mv -f $depbase.Tpo $depbase.Po depbase=`echo decode.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I../.. -I../.. -I./include -I../../include -DNDEBUG -D__MSVCRT_VERSION__=0x0601 -I/home/admin/development/MultimediaTools-mingw-w64/sandbox/mingw-w64-x86_64/x86_64-w64-mingw32/include -O3 -funroll-loops -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline -Wdeclaration-after-statement -D_FORTIFY_SOURCE=2 -msse2 -MT decode.o -MD -MP -MF $depbase.Tpo -c -o decode.o decode.c &&\ mv -f $depbase.Tpo $depbase.Po decode.c: In function 'DecoderSession_destroy': decode.c:270:5: error: unknown type name 'HANDLE' HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:270:17: warning: implicit declaration of function 'CreateFile_utf8' [-Wimplicit-function-declaration] HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:270:5: warning: nested extern declaration of 'CreateFile_utf8' [-Wnested-externs] HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:270:49: error: 'GENERIC_READ' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:270:49: note: each undeclared identifier is reported only once for each function it appears in decode.c:270:62: error: 'GENERIC_WRITE' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:270:77: error: 'FILE_SHARE_READ' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:270:93: error: 'FILE_SHARE_WRITE' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:270:117: error: 'OPEN_EXISTING' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:270:132: error: 'FILE_ATTRIBUTE_NORMAL' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:271:14: error: 'INVALID_HANDLE_VALUE' undeclared (first use in this function) if(fh != INVALID_HANDLE_VALUE) { ^ decode.c:272:9: warning: implicit declaration of function 'GetFileType' [-Wimplicit-function-declaration] if(GetFileType(fh) == FILE_TYPE_DISK) { ^ decode.c:272:6: warning: nested extern declaration of 'GetFileType' [-Wnested-externs] if(GetFileType(fh) == FILE_TYPE_DISK) { ^ decode.c:272:28: error: 'FILE_TYPE_DISK' undeclared (first use in this function) if(GetFileType(fh) == FILE_TYPE_DISK) { ^ decode.c:273:7: error: unknown type name 'LARGE_INTEGER' LARGE_INTEGER size; ^ decode.c:274:11: error: request for member 'QuadPart' in something not a structure or union size.QuadPart = written_size; ^ decode.c:275:10: warning: implicit declaration of function 'SetFilePointerEx' [-Wimplicit-function-declaration] if(SetFilePointerEx(fh, size, NULL, FILE_CURRENT)) /* correct the file size */ ^ decode.c:275:7: warning: nested extern declaration of 'SetFilePointerEx' [-Wnested-externs] if(SetFilePointerEx(fh, size, NULL, FILE_CURRENT)) /* correct the file size */ ^ decode.c:275:43: error: 'FILE_CURRENT' undeclared (first use in this function) if(SetFilePointerEx(fh, size, NULL, FILE_CURRENT)) /* correct the file size */ ^ decode.c:276:8: warning: implicit declaration of function 'SetEndOfFile' [-Wimplicit-function-declaration] SetEndOfFile(fh); ^ decode.c:276:8: warning: nested extern declaration of 'SetEndOfFile' [-Wnested-externs] decode.c:278:6: warning: implicit declaration of function 'CloseHandle' [-Wimplicit-function-declaration] CloseHandle(fh); ^ decode.c:278:6: warning: nested extern declaration of 'CloseHandle' [-Wnested-externs] decode.c: In function 'DecoderSession_process': decode.c:386:3: error: unknown type name 'HANDLE' HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:386:47: error: 'GENERIC_READ' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:386:60: error: 'GENERIC_WRITE' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:386:75: error: 'FILE_SHARE_READ' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:386:91: error: 'FILE_SHARE_WRITE' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:386:115: error: 'OPEN_EXISTING' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:386:130: error: 'FILE_ATTRIBUTE_NORMAL' undeclared (first use in this function) HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); ^ decode.c:387:12: error: 'INVALID_HANDLE_VALUE' undeclared (first use in this function) if(fh != INVALID_HANDLE_VALUE) { ^ decode.c:388:27: error: 'FILE_TYPE_DISK' undeclared (first use in this function) if (GetFileType(fh) == FILE_TYPE_DISK) { ^ decode.c:389:5: error: unknown type name 'LARGE_INTEGER' LARGE_INTEGER size; ^ decode.c:390:9: error: request for member 'QuadPart' in something not a structure or union size.QuadPart = d->total_samples * d->channels * ((d->bps+7)/8); ^ decode.c:392:10: error: request for member 'QuadPart' in something not a structure or union size.QuadPart += 512; ^ decode.c:397:13: error: request for member 'QuadPart' in something not a structure or union size.QuadPart += d->foreign_metadata->blocks[i].size; ^ decode.c:402:41: error: 'FILE_CURRENT' undeclared (first use in this function) if(SetFilePointerEx(fh, size, NULL, FILE_CURRENT)) /* tell filesystem the expected filesize to eliminate fragmentation */ ^ Makefile:506: recipe for target 'decode.o' failed make[3]: *** [decode.o] Error 1 make[3]: Leaving directory '/home/admin/development/MultimediaTools-mingw-w64/sandbox/x86_64/flac/src/flac' Makefile:428: recipe for target 'all-recursive' failed make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory '/home/admin/development/MultimediaTools-mingw-w64/sandbox/x86_64/flac/src' Makefile:483: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/admin/development/MultimediaTools-mingw-w64/sandbox/x86_64/flac' Makefile:415: recipe for target 'all' failed make: *** [all] Error 2 Build failure. Please see error messages above. On Tue, Feb 9, 2016 at 7:12 PM, Erik de Castro Lopo <mle+la at mega-nerd.com> wrote:> > I think this was a temporary failure and it should be working again > now. > > Erik >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20160209/466e8337/attachment-0001.htm
John Warburton wrote:> Thank you for the feedback. > > This is cross-compiling for mingw-w64-x86_64 using gcc-5.3.0 and > mingw-w64-4.0.4 on GNU/Linux. > > Upon attempting to compile now, a large number of errors occur in > flac/decode.c which I have placed at the end of this email. They are eased > by adding this to decode.c: > > #if _WIN32 > #include <windows.h> > #include <shlobj.h> > #endif > > ...among the headers. > > Then, this error results when attempting to link flac.exe: > > decode.o:decode.c:(.text+0x4fe1): undefined reference to `CreateFile_utf8' > decode.o:decode.c:(.text+0x50fb): undefined reference to `CreateFile_utf8' > ../../src/share/grabbag/.libs/libgrabbag.a(file.o):file.c:(.text+0x156): > undefined reference to `CreateFile_utf8' > ../../src/share/grabbag/.libs/libgrabbag.a(file.o):file.c:(.text+0x188): > undefined reference to `CreateFile_utf8' > collect2: error: ld returned 1 exit status > Makefile:487: recipe for target 'flac.exe' failed > > I believe the developers have been attending to code relevant to this error > in the recent past.It seems that some patch was partially applied. Two possible fixes for the problem are attached. The first adds missing defines to src/flac/decode.c and src/share/grabbag/file.c The second removes #ifdef...#endif directives from windows_unicode_filenames.(c|h) (they're mutually exclusive - there's no point in applying both of them) -------------- next part -------------- A non-text attachment was scrubbed... Name: fix_variant1.patch Type: application/octet-stream Size: 745 bytes Desc: not available Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20160210/8d0c1114/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: fix_variant2.patch Type: application/octet-stream Size: 1263 bytes Desc: not available Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20160210/8d0c1114/attachment-0001.obj
lvqcl wrote:> The second removes #ifdef...#endif directives from windows_unicode_filenames.(c|h)Thats the one I chose. Thanks. Actually cross compiled from Linux to Windows to test it. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/