During stage 2 bootstrap on cygwin ncurses fails to build, complaining that there are a number of variables in ncurses/names.c that cause error: variable ‘strfnames’ definition is marked dllimport. Reproducible: Always
Created attachment 785828 [details] ncurses build.log for failure on cygwin
Created attachment 785831 [details] cywgin emerge.info from gentoo/tmp/bin/emerge in stage2
x64-cygwin is actually no longer supported (lack of resources/interest). Do you want to persue supporting Cygwin?
> x64-cygwin is actually no longer supported (lack of resources/interest). This is somehow not entirely surprising given that WSL and friends exist these days. Might be worth updating the wiki to that effect. > Do you want to persue supporting Cygwin? I guess I have already started in a sense? https://github.com/gentoo/prefix/pull/7 gets the build to stage2, at which point I encounter this ncurses bug.
I ran into this as well. I think I've at least figured out what the cause of that error is cygwin unconditionally passes --enable-reentrant when building ncurses: https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/ncurses.git;a=blob;f=ncurses.cygport;h=9c23b995aa288a7288ece29c073876f4d3e0247f;hb=HEAD#l54 But gentoo only does so for a subset of targets: https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/ncurses/ncurses-6.3_p20221203-r2.ebuild?id=665eceefafe15f59b67ca652bb60cf830368b64a#n327 and that configure switch appears to be what causes the build failure. I locally modified the ebuild to unconditionally pass --enable-reentrant and got the ncurses build a bit further along: rses-6.3/ncurses/tinfo/make_keys.c -L/home/pefol/gentoo/tmp/usr/lib /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/pefol/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-6.3_p20220924/temp/ccI6qDMj.o:make_keys.c:(.text+0x2b7): undefined reference to `__imp__nc_strnames' /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/pefol/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-6.3_p20220924/temp/ccI6qDMj.o:make_keys.c:(.text+0x2d8): undefined reference to `__imp__nc_strfnames' /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/pefol/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-6.3_p20220924/temp/ccI6qDMj.o:make_keys.c:(.text+0x34d): undefined reference to `__imp__nc_strnames' /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/pefol/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-6.3_p20220924/temp/ccI6qDMj.o:make_keys.c:(.text+0x3e2): undefined reference to `__imp__nc_strfnames' /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/pefol/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-6.3_p20220924/temp/ccI6qDMj.o:make_keys.c:(.text+0x3fb): undefined reference to `__im p__nc_strfnames' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:260: make_keys.exe] Error 1 Note that the python build has bitrotted since https://github.com/gentoo/prefix/pull/7, so I needed to point it at a 3.9 build as well to even get this far.
And that failure is because make_keys is built with BUILD_CPPFLAGS: https://github.com/mirror/ncurses/blob/e27924b560884229fa4c9cf5a90778aa6b7e5e96/ncurses/Makefile.in#L110 Which doesn't set -DBUILDING_NCURSES that is relied on here: https://github.com/mirror/ncurses/blob/e27924b560884229fa4c9cf5a90778aa6b7e5e96/include/ncurses_dll.h.in#L70 So hacking up the ebuild further to pass -DBUILDING_NCURSES gets us to: https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/ncurses/ncurses-6.3_p20221203-r2.ebuild?id=665eceefafe15f59b67ca652bb60cf830368b64a#n354 where the multilib_is_native_abi check is wrong and causes us to use built-in make rules: /usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: /home/pefol/gentoo/tmp/var/tmp/portage/sys-libs/ncurses-6.3_p20220924/temp/cchmLYuj.o:tic.c:(.rdata$.refptr._nc_tparm_err[.refptr._nc_tparm_err]+0x0): undefined reference to `_nc_tparm_err' collect2: error: ld returned 1 exit status make: *** [<builtin>: tic] Error 1 Fixing that to use get_exeext is enough for ncurses to emerge successfully: >>> sys-libs/ncurses-6.3_p20220924 merged.
Note that https://github.com/gentoo/prefix/pull/18 is also required to even get that far.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82564c2f5d5f46e6e7bb0c082f98f39071e2b75d commit 82564c2f5d5f46e6e7bb0c082f98f39071e2b75d Author: Peter Foley <pefoley2@pefoley.com> AuthorDate: 2023-02-22 03:56:25 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-02-22 07:42:17 +0000 sys-libs/ncurses: Fix cygwin build Force -DBUILDING_NCURCES for build tools to avoid dllimport errors. Update tic build to use get_exeext, which fixes native builds. Bug: https://bugs.gentoo.org/852665 Signed-off-by: Peter Foley <pefoley2@pefoley.com> Closes: https://github.com/gentoo/gentoo/pull/29713 Signed-off-by: Sam James <sam@gentoo.org> sys-libs/ncurses/ncurses-6.3_p20221203-r2.ebuild | 21 ++++++++------------- sys-libs/ncurses/ncurses-6.4.ebuild | 19 +++++++------------ 2 files changed, 15 insertions(+), 25 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=b2820767f0a995c1330a6168a77cda45577255f0 commit b2820767f0a995c1330a6168a77cda45577255f0 Author: Peter Foley <pefoley2@pefoley.com> AuthorDate: 2023-02-22 04:04:36 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-02-22 07:44:40 +0000 Fix prefix python bootstrap for cygwin Upstream cygwin doesn't ship python 3.10 yet, and the patches in the 3.9 tarball don't apply cleanly. As a consequence, cygwin bootstrap has been broken since fd1c9f9b6b838173e6f7df0cb8cc5114e55f6c56. Fix this by using 3.9 to bootstrap for cygwin only. Bug: https://bugs.gentoo.org/852665 Signed-off-by: Peter Foley <pefoley2@pefoley.com> Closes: https://github.com/gentoo/prefix/pull/18 Signed-off-by: Sam James <sam@gentoo.org> scripts/bootstrap-prefix.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
I think this is fixed by the above?