Re: PostgreSQL 9.4 InterlockedCompareExchange appearing in mingw64-w32 causing issue with PostGIS win32 load

From: "Paragon Corporation" <lr(at)pcorp(dot)us>
To: "'Paragon Corporation'" <lr(at)pcorp(dot)us>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PostgreSQL 9.4 InterlockedCompareExchange appearing in mingw64-w32 causing issue with PostGIS win32 load
Date: 2014-05-23 06:28:34
Message-ID: 286FBE756DA043A881A289C539AD2ED3@O
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

-- REVISED NOTE --
> Hm. s_lock.h does define TAS() in terms of InterlockedCompareExchange()
if WIN32_ONLY_COMPILER is defined ... but that code hasn't changed in quite
a long time. It
> seems like the combination of an extension built with WIN32_ONLY_COMPILER
and a core built without that flag should never have worked, if the core is
what has to link
> in InterlockedCompareExchange.

> I wonder if there is something you're doing that results in inlining a
spinlock call given the 9.4 headers, but did not previously. Can you narrow
down what part of
> your code is giving rise to the undefined reference?

> regards, tom lane

Tom,

Does it with all extensions, not just PostGIS (before (9.3.4 and before) I
could swap between say for example hstore mingw compiled and VC compiled and
had no issue)
And this extra InterlockedComparedExchange export did not appear in the
extension dlls.

The InterlockedCompareExchange@ export as you guessed shows in the
extension .dll postgres.exe reference but not clear where to tell where that
is coming thru.

I found this thread which sounds like the situation I am running into, but
not sure why it would be suddenly an issue now unless nothing is being
exported anymore
http://sourceforge.net/p/mingw-w64/mailman/message/31128245/

I'm compiling PostgreSQL the same way in both 9.3 and 9.4:

With something that looks like this:
export MINGHOST=i686-w64-mingw32
PG_VER=9.4

./configure --prefix=${PROJECTS}/postgresql/rel/pg${PG_VER}\
--build=${MINGHOST} \
--with-pgport=8443 --disable-float8-byval --enable-cassert
--enable-debug \
--enable-integer-datetimes --without-zlib

With just the PG_VER being different.

What I did notice is that in 9.3, the config.log shows this for

9.4:
LDFLAGS=-Wl,--allow-multiple-definition -Wl,--disable-auto-import
-Wl,--as-needed

and
9.3:
LDFLAGS=-Wl,--allow-multiple-definition -Wl,--as-needed

I read thru the threads on mailing list and confirmed it was an intended
change.

I thought maybe the --disable-auto-import was doing something.

Trying to override the flag with

When I do any of the below did not work
export LDFLAGS=-Wl,--allow-multiple-definition -Wl,--enable-auto-import
-Wl,--as-needed
export LDFLAGS="-Wl,--allow-multiple-definition -Wl,--enable-auto-import
-Wl,--as-needed"
export LDFLAGS=-Wl,--allow-multiple-definition -Wl,--as-needed

However I was able to override it by changing the:
/src/template/win32 (trying both )

LDFLAGS="-Wl,--allow-multiple-definition -Wl,--enable-auto-import"

And the old 9.3.4
LDFLAGS="-Wl,--allow-multiple-definition"

And concluded that was not the issue since the export of this symbol still
happens.

Any other thoughts?

Thanks,
Regina

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2014-05-23 07:13:03 Re: Allowing join removals for more join types
Previous Message Atri Sharma 2014-05-23 04:55:32 Re: Congrats Andres Freund, the newest PostgreSQL Commiter!