Re: Linker errors while creating a PostgreSQL C extension function.

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "TalGloz" <glozmantal(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Linker errors while creating a PostgreSQL C extension function.
Date: 2018-08-19 16:59:14
Message-ID: 2455c526-58ab-4f2b-a9c0-f2b2890ca365@manitou-mail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

TalGloz wrote:

> If yes then the -lseal is added with the $(LDFLAGS) at the end of the
> command.

But it doesn't happen because LDFLAGS is overriden by the
makefile included just after you set it. The relevant part
copy-pasted from your mail:

LDFLAGS = -L$(INCLUDE_SEAL_LIB) -llibseal.a -lpthread
include $(PGXS)
seal_diff_cpp.so: seal_diff_cpp.o
$(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so
seal_diff_cpp.o $(LDFLAGS)

As as solution, you could leave LDFLAGS alone and use a different
variable, or include $(PGXS) first and *append* your options to
LDFLAGS if your prefer.
For instance (replacing -llibseal.a with -lseal while at it):

SEAL_LDFLAGS = -L$(INCLUDE_SEAL_LIB) -lseal -lpthread
include $(PGXS)
seal_diff_cpp.so: seal_diff_cpp.o
$(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so
seal_diff_cpp.o $(LDFLAGS) $(SEAL_LDFLAGS)

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raghavendra Rao J S V 2018-08-19 17:22:00 How to create a log file in pg_log directory for each execution of my function.
Previous Message Dmitry Igrishin 2018-08-19 16:52:10 Re: Linker errors while creating a PostgreSQL C extension function.