Skip to content

[illumos] Fail to compile postgresql extension #39

Description

@benjamin-bergia

I have been trying to compile https://github.com/2ndquadrant-it/redislog and end-up with the following error:

# make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -pipe -O2 -pipe -O2 -D_FORTIFY_SOURCE=2 -I/opt/local/include -I/opt/local/include/ncurses -DLDAP_DEPRECATED -I/usr/include -fPIC -I. -I./ -I/opt/local/include/postgresql/server -I/opt/local/include/postgresql/internal -I/opt/local/include -I/opt/local/include/ncurses -DLDAP_DEPRECATED -I/usr/include -I/opt/local/include/libxml2 -I/opt/local/include   -c -o redislog.o redislog.c
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -pipe -O2 -pipe -O2 -D_FORTIFY_SOURCE=2 -I/opt/local/include -I/opt/local/include/ncurses -DLDAP_DEPRECATED -I/usr/include -fPIC -shared -o redislog.so redislog.o -L/opt/local/lib -L/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.4 -Wl,-R/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.4 -L/opt/local/lib -Wl,-R/opt/local/lib -L/usr/lib/amd64 -Wl,-R/usr/lib/amd64 -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib  -Wl,--as-needed -Wl,-R'/opt/local/lib'  -lhiredis 
ld: fatal: unrecognized option '--as-needed'
ld: fatal: use the -z help option for usage information
collect2: error: ld returned 1 exit status
/opt/local/lib/postgresql/pgxs/src/makefiles/../../src/Makefile.shlib:315: recipe for target 'redislog.so' failed
make: *** [redislog.so] Error 1

After some research I found out that removing the flag in /opt/local/lib/postgresql/pgxs/src/Makefile.global solves the issue:

--- /opt/local/lib/postgresql/pgxs/src/Makefile.global  2017-10-03 16:54:05.000000000 +0000
+++ Makefile.global     2017-11-09 07:42:08.015102230 +0000
@@ -277,7 +277,7 @@
 else
   LDFLAGS = -L$(top_builddir)/src/port -L$(top_builddir)/src/common
 endif
-LDFLAGS += -L/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.4 -Wl,-R/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.4 -L/opt/local/lib -Wl,-R/opt/local/lib -L/usr/lib/amd64 -Wl,-R/usr/lib/amd64 -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib  -Wl,--as-needed
+LDFLAGS += -L/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.4 -Wl,-R/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.4 -L/opt/local/lib -Wl,-R/opt/local/lib -L/usr/lib/amd64 -Wl,-R/usr/lib/amd64 -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib
 
 LDFLAGS_EX = 
 # LDFLAGS_SL might have already been assigned by calling makefile

Unfortunately, I don't know if this change as any other side effect. I tested with both postgres 9.2 and 10 on base-64-lts 15.4.0 and base-64 17.3.0 respectively.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions