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

  1. changed the title [-]Fail to compile postgresql extension[/-] [+][illumos] Fail to compile postgresql extension[/+] on Nov 9, 2017
  2. mamash commented on Nov 9, 2017

    @mamash

    It's a GNU ld arg that has no place in the Sun linker that Illumos uses. Unfortunately it's fairly common for devs out there to assume the presence of GNU ld always.

    pkgsrc itself typically filters out such args gracefully, but that would apply only if redislog had a pkgsrc package. I'll track down where --as-needed is coming from and remove it from the pgxs Makefiles.

  3. self-assigned this
    on Nov 9, 2017
  4. benjamin-bergia commented on Nov 9, 2017

    @benjamin-bergia
    Author

    @mamash cool thank you.

  5. benjamin-bergia commented on Nov 10, 2017

    @benjamin-bergia
    Author

    By the way, if I were to build a package for redislog, would there be any chance to get it in the repo?

  6. mamash commented on Nov 10, 2017

    @mamash

    Yep, I just created databases/postgresql-redislog in pkgsrc trunk, though it will only hit the production packages in 2017Q4. I committed the fix for the PostgreSQL pgxs makefiles too.

  7. benjamin-bergia commented on Nov 12, 2017

    @benjamin-bergia
    Author

    @mamash thank you very much. I will close this.

  8. added a commit that references this issue on Nov 30, 2017
    8e02d70
  9. added a commit that references this issue on Dec 18, 2017
  10. added a commit that references this issue on Apr 26, 2018
  11. added a commit that references this issue on Nov 13, 2018
  12. added a commit that references this issue on Dec 17, 2018
  13. 167 remaining items

  14. added a commit that references this issue on Jul 13, 2026
  15. added a commit that references this issue on Aug 4, 2026
  16. added a commit that references this issue on Sep 28, 2026
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