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

Use preinstalled version of MinGW on AppVeyor #132

Closed
vitaut opened this issue Mar 10, 2015 · 21 comments
Closed

Use preinstalled version of MinGW on AppVeyor #132

vitaut opened this issue Mar 10, 2015 · 21 comments

Comments

@vitaut
Copy link
Contributor

vitaut commented Mar 10, 2015

In a long term it would be better to ditch AppVeyor altogether because it's painfully slow even without installing MinGW.

@vitaut
Copy link
Contributor Author

vitaut commented Mar 13, 2015

Some of the issues with MinGW on AppVeyor:

  1. fileno is a macro (WTF?)
  2. strerror_r is unavailable while (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE condition is satisfied (WTF^2)

@vitaut
Copy link
Contributor Author

vitaut commented Mar 16, 2015

More errors:

In file included from C:\cppformat\posix.h:38:0,
                 from C:\cppformat\posix.cc:33:
C:\cppformat\posix.cc: In member function 'int fmt::BufferedFile::fileno() const
':
C:\cppformat\posix.h:64:34: error: expected id-expression before '(' token
 #  define FMT_POSIX_CALL(call) ::_##call
                                  ^
C:\cppformat\posix.cc:102:12: note: in expansion of macro 'FMT_POSIX_CALL'
   int fd = FMT_POSIX_CALL(fileno(file_));
            ^
In file included from C:\cppformat\posix.cc:33:0:
C:\cppformat\posix.cc: In member function 'fmt::LongLong fmt::File::size() const
':
C:\cppformat\posix.cc:142:50: error: 'GetFileSizeEx' was not declared in this sc
ope
   if (!FMT_SYSTEM(GetFileSizeEx(handle, &filesize)))
                                                  ^
C:\cppformat\posix.h:61:27: note: in definition of macro 'FMT_SYSTEM'
 # define FMT_SYSTEM(call) call
                           ^

@vitaut
Copy link
Contributor Author

vitaut commented Mar 17, 2015

Item 2 fixed in 341b98c.

@vitaut
Copy link
Contributor Author

vitaut commented Mar 17, 2015

And one more:

C:\cppformat\test\test-main.cc:32:21: fatal error: crtdbg.h: No such file or dir
ectory
 # include <crtdbg.h>
                     ^

@vitaut
Copy link
Contributor Author

vitaut commented Mar 17, 2015

GetFileSizeEx error fixed in 5aecd49.

@vitaut
Copy link
Contributor Author

vitaut commented Mar 17, 2015

What a mess:

In file included from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\cmath:44:0,
                 from C:\cppformat\test\format-test.cc:31:
c:\mingw\include\math.h: In function 'float hypotf(float, float)':
c:\mingw\include\math.h:635:30: error: '_hypot' was not declared in this scope
 { return (float)(_hypot (x, y)); }
                              ^

@vitaut
Copy link
Contributor Author

vitaut commented Mar 17, 2015

The last issue looks like a bug in MinGW: http://ehc.ac/p/mingw/bugs/2250/

@vitaut
Copy link
Contributor Author

vitaut commented Mar 17, 2015

crtdbg.h issues fixed in a530052.

@tkelman
Copy link

tkelman commented Mar 17, 2015

mingw.org is obsolete and I'm not sure it's worth the hassle of dealing with it, really. Here's an example of how to run with mingw-w64 which should be much less painful to work with: tkelman/libgit2@4c88fd7

@vitaut
Copy link
Contributor Author

vitaut commented Mar 17, 2015

Thanks, @tkelman. I'm doing this not because it is easy but because it is hard =). I was using mingw-w64 before, but I think C++ Format should work on legacy platforms such as the default MinGW installation. Besides it's a good portability test and the fixes I made so far are useful in general and not specific to this version of MinGW (with one exception).

@tkelman
Copy link

tkelman commented Mar 17, 2015

Aren't you trying to use latest C++11 and other features? That sounds needlessly challenging on a barely-maintained toolchain, but go for it if it's worth the trouble.

@vitaut
Copy link
Contributor Author

vitaut commented Mar 17, 2015

Yes, I'm using C++11 features if available, but support legacy (C++98/03) compilers because they are still widespread.

@vitaut
Copy link
Contributor Author

vitaut commented Mar 19, 2015

Workaround cmath bug in f49ab8e.

@vitaut
Copy link
Contributor Author

vitaut commented Mar 19, 2015

A few more errors:

C:\cppformat\test\posix-test.cc:100:1: error: 'errno_t' does not name a type
 errno_t test::sopen_s(
 ^
C:\cppformat\test\posix-test.cc:108:61: error: 'DWORD test::GetFileSize(HANDLE, LPDWORD)' should have been declared inside 'test'
 DWORD test::GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh) {
                                                             ^
C:\cppformat\test\posix-test.cc: In function 'DWORD test::GetFileSize(HANDLE, LPDWORD)':
C:\cppformat\test\posix-test.cc:108:61: error: 'DWORD test::GetFileSize(HANDLE, LPDWORD)' conflicts with a previous declaration
In file included from c:\mingw\include\windows.h:50:0,
                 from C:\cppformat\test\posix-test.h:37,
                 from C:\cppformat\test\posix-test.cc:31:
c:\mingw\include\winbase.h:1619:25: note: previous declaration 'DWORD GetFileSize(HANDLE, PDWORD)'
 WINBASEAPI DWORD WINAPI GetFileSize(HANDLE,PDWORD);
                         ^

@vitaut
Copy link
Contributor Author

vitaut commented May 6, 2015

Fixed MinGW build in 40681e6, but there are test failures:

The following tests FAILED:
          2 - format-test (Failed)
          6 - posix-test (Failed)

@vitaut
Copy link
Contributor Author

vitaut commented May 6, 2015

And gazillion of warnings of the form

cppformat\test\mock-allocator.h:40:1: warning: invoking macro GMOCK_MOCKER_ argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 [enabled by default]

@vitaut
Copy link
Contributor Author

vitaut commented May 7, 2015

format-test failure:

[ RUN      ] WriterTest.WriteLongDouble
C:\cppformat\test\format-test.cc:270: Failure
Value of: (Writer<char>() << value).str()
  Actual: 4.2
Expected: -7.89773e-278

C:\cppformat\test\format-test.cc:271: Failure
Value of: (Writer<char>() << value).str()
  Actual: -4.2
Expected: -7.89773e-278

C:\cppformat\test\format-test.cc:272: Failure
Value of: (Writer<char>() << value).str()
  Actual: 3.3621e-4932
Expected: -0

C:\cppformat\test\format-test.cc:273: Failure
Value of: (Writer<char>() << value).str()
  Actual: 1.18973e+4932
Expected: -1.#QNAN

[  FAILED  ] WriterTest.WriteLongDouble (14 ms)

See also http://stackoverflow.com/q/30080618/471164.

@vitaut
Copy link
Contributor Author

vitaut commented May 8, 2015

Fixed format-test in 3e03934.

@vitaut
Copy link
Contributor Author

vitaut commented May 8, 2015

posix-test failures:

[ RUN      ] FileTest.OpenRetry
unknown file: Failure
C++ exception with description "cannot open file test: Permission denied" thrown
 in the test body.
[  FAILED  ] FileTest.OpenRetry (0 ms)
[ RUN      ] FileTest.Size
unknown file: Failure
C++ exception with description "cannot open file test: Permission denied" thrown
 in the test body.
[  FAILED  ] FileTest.Size (0 ms)
[ RUN      ] FileTest.MaxSize
unknown file: Failure
C++ exception with description "cannot open file test: Permission denied" thrown
 in the test body.
[  FAILED  ] FileTest.MaxSize (0 ms)
[ RUN      ] BufferedFileTest.OpenRetry
unknown file: Failure
C++ exception with description "cannot open file test: Permission denied" thrown
 in the test body.
[  FAILED  ] BufferedFileTest.OpenRetry (15 ms)

@vitaut
Copy link
Contributor Author

vitaut commented May 11, 2015

Most issues have been solved, but Appveyor uses even more broken version of MinGW:

C:\projects\cppformat\test\posix-test.cc:90:43: error: 'int test::_fstat64i32(int, _stat64i32*)' should have been declared inside 'test'
 int (test::fstat)(int fd, struct stat *buf) {
                                           ^
C:\projects\cppformat\test\posix-test.cc: In function 'int test::_fstat64i32(int, _stat64i32*)':
C:\projects\cppformat\test\posix-test.cc:90:43: error: 'int test::_fstat64i32(int, _stat64i32*)' conflicts with a previous declaration
In file included from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\cwchar:44:0,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\postypes.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\char_traits.h:40,
                 from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\string:40,
                 from C:\projects\cppformat\test\gtest-extra.h:31,
                 from C:\projects\cppformat\test\posix-test.cc:43:
c:\mingw\include\wchar.h:706:32: note: previous declaration 'int _fstat64i32(int, _stat64i32*)'
 __CRT_MAYBE_INLINE int __cdecl _fstat64i32(int desc, struct _stat64i32 *_stat) {
                                ^
test\CMakeFiles\posix-test.dir\build.make:54: recipe for target 'test/CMakeFiles/posix-test.dir/posix-test.cc.obj' failed

@vitaut
Copy link
Contributor Author

vitaut commented May 12, 2015

As of 640445f all compile errors are fixed even on broken versions on MinGW. Only remains to fix warnings.

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

2 participants