Menu

#732 dllimport problem with 'environ' on 32-bit Cygwin

open
nobody
None
5
2018-02-23
2018-02-23
Ken Brown
No

I'm building the current hg tip:

$ hg id
87cf29627c28+ tip

with the latest release of 32-bit Cygwin:

hljjkjjl

The build fails with a link error as follows:

gcc -g -O2 -no-integrated-cpp -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare -Wno-format-nonliteral -Wno-shift-negative-value -O2 -fexpensive-optimizations -fwrapv -fno-strict-aliasing -DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM -DNO_FAST_DISPATCH -DNO_FAST_FLOAT -DNO_FAST_DOUBLE -DNO_ALLOCA -DNO_ADDRESS_SPACE_ASSUMPTIONS -DNO_GENERATIONAL_GC -DNO_SYMBOLFLAGS -DENABLE_UNICODE -DDYNAMIC_FFI -DDYNAMIC_MODULES -Wl,--export-all-symbols spvw.o spvwtabf.o spvwtabs.o spvwtabo.o eval.o control.o encoding.o pathname.o stream.o socket.o io.o funarg.o array.o hashtabl.o list.o package.o record.o weak.o sequence.o charstrg.o debug.o error.o misc.o time.o predtype.o symbol.o lisparit.o i18n.o foreign.o unixaux.o built.o modules.o libgnu.a -lintl -lreadline -lncurses -lffcall -liconv -lsigsegv -o lisp.exe
misc.o: In function C_get_env': /home/kbrown/src/clisp/src/misc.d:215: undefined reference to_imp__environ'
collect2: error: ld returned 1 exit status

The problem was caused by the following gnulib commit:

commit cf56f8f618c48cfadd2499ced58574633d12f129
Author: Bruno Haible bruno@clisp.org
Date: Wed Jan 31 09:04:52 2018 +0100

environ: Fix link error on 64-bit Cygwin.


* lib/unistd.in.h (environ): On Cygwin, redeclare with the
__declspec(dllimport) attribute.
* doc/posix-functions/environ.texi: Mention the Cygwin problem.

Reverting that commit fixes the problem. Since the commit was intended to fix a link error on 64-bit Cygwin, maybe the simplest fix would be to just add dllimport if x86_64 is defined.

Discussion


Log in to post a comment.