msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.28k stars 1.21k forks source link

libncurses depencencies #3531

Open Mistuke opened 6 years ago

Mistuke commented 6 years ago

The libncurses in the repo somehow has a dependency on the vc++ 2015 runtime as it references __acrt_iob_func which is rather weird considering the PKGBUILD doesn't change the crt from the default.

And indeed building from source builds the same 6.1.20180127-1 but without this symbol.

So the version in the repo seems to diverge. Was this intended? As it means to use libncurses the gcc specs file has to be changed (as not to link against multiple crt versions)?

GCC's default configuration fails to link

C:/msys64/mingw64/lib/../lib/libncursesw.a(lib_setup.o):(.text+0x5e0): undefined reference to `__imp___acrt_iob_func'
C:/msys64/mingw64/lib/../lib/libncursesw.a(lib_setup.o):(.text+0x610): undefined reference to `__imp___acrt_iob_func'
C:/msys64/mingw64/lib/../lib/libncursesw.a(lib_setup.o):(.text+0x6c1): undefined reference to `__imp___acrt_iob_func'
C:/msys64/mingw64/lib/../lib/libncursesw.a(lib_setup.o):(.text+0x6eb): undefined reference to `__imp___acrt_iob_func'
C:/msys64/mingw64/lib/../lib/libncursesw.a(lib_tputs.o):(.text+0x37): undefined reference to `__imp___acrt_iob_func'
C:/msys64/mingw64/lib/../lib/libncursesw.a(lib_tputs.o):(.text+0x12a): more undefined references to `__imp___acrt_iob_func' follow
collect2.exe: error: ld returned 1 exit status
mati865 commented 6 years ago

New mingw-w64 also provides this symbol, either your toolchain is outdated or ncurses need rebuild.

Mistuke commented 6 years ago

I'm using a GCC 7.2.0.

I don't see the symbol in msvcrt so where does the new mingw-w64 expect the symbol from?

dumpbin /exports c:\Windows\System32\msvcrt.dll | findstr acrt_iob_func

returns nothing.

Mistuke commented 6 years ago

Is it implemented internally in a newer mingw-w64 crt? Is so that's slightly annoying as it's a backwards incompatible change...

mati865 commented 6 years ago

It was made to fix ucrt linking.

Symbol is defined here:

$ nm /mingw64/x86_64-w64-mingw32/lib/libcrtdll.a | grep acrt
lib64_libcrtdll_a-acrt_iob_func.o:
0000000000000000 T __acrt_iob_func
0000000000000000 D __imp___acrt_iob_func

With all packages updated it shouldn't cause much problems but old libs libs might need rebuild.

Mistuke commented 6 years ago

Ah I see, that's a bit unfortunate. We're using the mingw-w64 toolchains in the Haskell compiler, but this effectively means ncurses is now broken for all previously released toolchains as they are frozen to particular versions.

I guess I'll just have to provide a build compiled against an older mingw-w64 for users...