On Wed, 21 Nov 2018, Mateusz wrote:

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

In general, so far, when using ucrt, we rely on a number of redirections in headers, so that an object file built for an older crt version won't necessarily work with the newer one. The exception to this, so far, has been the main CRT startup files and libmingw32/libmingwex. (We haven't checked all of libmingwex exhaustively, but only the parts that have been pulled in by code built in this setup.)

In your case, the issue is that libstdc++.a contains a whole lot of object files built targeting another crt version.

I would very much prefer not to have two separate versions of libmingwex. Instead it's often possible to tweak what libmingwex does, and tweak the headers and actual functions/stubs exported by libmsvcrt.a and libucrtbase.a so that the same single build of libmingwex.a works with both.

If the __pioinfo function is the only issue with a libstdc++.a built against libmsvcrt.a but linked against libucrtbase.a, it might be worthwhile to try to work around it. To do that, the first step would be to look up what it is used for and what the replacing functionality is in ucrtbase. After that, one can e.g. change the headers to redirect the __piofunction to use the new ucrtbase mechansim in general, and add a wrapper in libmsvcr*.a that provides this interface. See e.g. src_msvcrt_common in mingw-w64-crt/Makefile.am for a few cases of doing this so far.

A different strategy would be to move the helpers that differ depending on crt version from libmingwex.a into libmsvcr*.a and libucrtbase.a instead, to allow different versions/sets of them that actually match the CRT they are to be used with. In this case, move the parts that you wanted to differentiate in libmingwex into libmsvcr*.a and libucrtbase.a.

// Martin


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to