Hello,
When I try to build x265 with ucrtbase (instead of msvcrt) I get errors:
f:/msys/m64-82/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libucrt.a(dtwcs00041.o):(.text+0x0):
multiple definition of `_fseeki64';
f:/msys/m64-82/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingwex.a(lib64_libmingwex_a-fseeko64.o):fseeko64.c:(.text+0x350):
first defined here
f:/msys/m64-82/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
f:/msys/m64-82/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libucrt.a(dtwcs00045.o):(.text+0x0):
multiple definition of `_ftelli64';
f:/msys/m64-82/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingwex.a(lib64_libmingwex_a-fseeko64.o):fseeko64.c:(.text+0x130):
first defined here
f:/msys/m64-82/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
f:/msys/m64-82/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingwex.a(lib64_libmingwex_a-fseeko64.o):fseeko64.c:(.rdata$.refptr.__imp___pioinfo[.refptr.__imp___pioinfo]+0x0):
undefined reference to `__imp___pioinfo'
collect2.exe: error: ld returned 1 exit status
Problem is in libstdc++.a which uses fseeko64 from libmingwex.
My proposition is:
we could build two libmingwex -- libmingwex for msvcrt and libmingwex10 for
msvcr100 and above, leave fseeko64 in libmingwex* and remove _fseeki64 and
_ftelli64 from libmingwex10.
For msvcrt spec file should be without changes
... -lmoldname -lmingwex -lmsvcrt
for ucrtbase (and similar for msvcr120/110/100)
... -lmoldname -lmingwex10 -lucrtbase
I've attached patch proposition that do what I described (you need to execute
automake in mingw-w64-crt folder before build).
Now I can build and execute x265 (ucrt build).
I am not sure if it is the best way -- to make two libmingwex* and only one
libstdc++.
So my question is -- we should go in this direction or not?
Regards,
Mateusz
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 079dc5a4..f6ffd922 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -658,6 +658,10 @@ lib32_LIBRARIES += lib32/libmingwex.a
lib32_libmingwex_a_CPPFLAGS=$(CPPFLAGS32) $(extra_include) $(AM_CPPFLAGS)
lib32_libmingwex_a_SOURCES = $(src_libmingwex) $(src_libmingwex32)
$(src_dfp_math)
+lib32_LIBRARIES += lib32/libmingwex10.a
+lib32_libmingwex10_a_CPPFLAGS=$(CPPFLAGS32) -D__MINGW_LIBMINGWEX10
$(extra_include) $(AM_CPPFLAGS)
+lib32_libmingwex10_a_SOURCES = $(src_libmingwex) $(src_libmingwex32)
$(src_dfp_math)
+
lib32_LIBRARIES += lib32/libmoldname.a
lib32_libmoldname_a_CPPFLAGS=$(CPPFLAGS32) $(extra_include) $(AM_CPPFLAGS)
lib32_libmoldname_a_SOURCES = $(src_libm)
@@ -992,6 +996,10 @@ lib64_LIBRARIES += lib64/libmingwex.a
lib64_libmingwex_a_CPPFLAGS=$(CPPFLAGS64) $(extra_include) $(AM_CPPFLAGS)
lib64_libmingwex_a_SOURCES = $(src_libmingwex) $(src_libmingwex64)
$(src_dfp_math)
+lib64_LIBRARIES += lib64/libmingwex10.a
+lib64_libmingwex10_a_CPPFLAGS=$(CPPFLAGS64) -D__MINGW_LIBMINGWEX10
$(extra_include) $(AM_CPPFLAGS)
+lib64_libmingwex10_a_SOURCES = $(src_libmingwex) $(src_libmingwex64)
$(src_dfp_math)
+
lib64_LIBRARIES += lib64/libmoldname.a
lib64_libmoldname_a_CPPFLAGS=$(CPPFLAGS64) $(extra_include) $(AM_CPPFLAGS)
lib64_libmoldname_a_SOURCES = $(src_libm)
diff --git a/mingw-w64-crt/stdio/fseeko64.c b/mingw-w64-crt/stdio/fseeko64.c
index 5905aa22..a36c89ce 100644
--- a/mingw-w64-crt/stdio/fseeko64.c
+++ b/mingw-w64-crt/stdio/fseeko64.c
@@ -3,12 +3,18 @@
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+#ifdef __MINGW_LIBMINGWEX10
+#undef __MSVCRT_VERSION__
+#define __MSVCRT_VERSION__ 0x1000
+#endif
+
#include <stdio.h>
#include <io.h>
#include <errno.h>
#include <windows.h>
#include <internal.h>
+#if __MSVCRT_VERSION__ < 0x1000
struct oserr_map {
unsigned long oscode; /* OS values */
int errnocode; /* System V codes */
@@ -103,6 +109,7 @@ int __cdecl _flush (FILE *str)
stream->_cnt = 0ll;
return rc;
}
+#endif /* __MSVCRT_VERSION__ < 0x1000 */
int fseeko64 (FILE* stream, _off64_t offset, int whence)
{
@@ -130,6 +137,7 @@ int fseeko64 (FILE* stream, _off64_t offset, int whence)
return fsetpos (stream, &pos);
}
+#if __MSVCRT_VERSION__ < 0x1000
int __cdecl _fseeki64(FILE *str,__int64 offset,int whence)
{
FILE *stream;
@@ -256,3 +264,4 @@ void mingw_dosmaperr (unsigned long oserrno)
else
errno = EINVAL;
}
+#endif /* __MSVCRT_VERSION__ < 0x1000 */
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index c79d7054..0a167a26 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -609,31 +609,20 @@ int vsnprintf (char *__stream, size_t __n, const char
*__format, __builtin_va_li
/* Shouldn't be any fseeko32 in glibc, 32bit to 64bit casting should be fine
*/
/* int fseeko32(FILE* stream, _off_t offset, int whence);*/ /* fseeko32
redirects to fseeko64 */
-#if __MSVCRT_VERSION__ >= 0x1400
+#if __MSVCRT_VERSION__ >= 0x1000
// Mark these as _CRTIMP to avoid trying to link in the mingwex versions.
_CRTIMP int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin);
_CRTIMP __int64 __cdecl _ftelli64(FILE *_File);
- __mingw_static_ovr int fseeko(FILE *_File, _off_t _Offset, int _Origin) {
- return fseek(_File, _Offset, _Origin);
- }
- __mingw_static_ovr int fseeko64(FILE *_File, _off64_t _Offset, int _Origin) {
- return _fseeki64(_File, _Offset, _Origin);
- }
- __mingw_static_ovr _off_t ftello(FILE *_File) {
- return ftell(_File);
- }
- __mingw_static_ovr _off64_t ftello64(FILE *_File) {
- return _ftelli64(_File);
- }
#else
__MINGW_EXTENSION int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int
_Origin);
__MINGW_EXTENSION __int64 __cdecl _ftelli64(FILE *_File);
+#endif
+
int fseeko64(FILE* stream, _off64_t offset, int whence);
int fseeko(FILE* stream, _off_t offset, int whence);
/* Returns truncated 64bit off_t */
_off_t ftello(FILE * stream);
_off64_t ftello64(FILE * stream);
-#endif
#ifndef _FILE_OFFSET_BITS_SET_FSEEKO
#define _FILE_OFFSET_BITS_SET_FSEEKO
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public