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

2018-08-25 Thread TalGloz
I removed the flag --no-undefined and it was compiled and worked like a charm. I needed the flag to spot the linker errors for linking with the external *libseal.a* library. As for my other question regarding the unused linker path *-L"/usr/local/lib"*. I'm using Fedora 28 (RedHat) and in this dis

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

2018-08-21 Thread Laurenz Albe
TalGloz wrote: > Do you or anyone know why is it trying to link with -L/usr/lib64 path and > not -L/usr/local/lib as provided? > > After recompiling the libseal.a with the -fPIC flag and copying it manually > from /usr/local/lib/ to /usr/lib64/ I get those errors: > > g++ -Wl,--no-undefined -shar

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

2018-08-21 Thread TalGloz
Hallo Do you or anyone know why is it trying to link with -L/usr/lib64 path and not -L/usr/local/lib as provided? After recompiling the libseal.a with the -fPIC flag and copying it manually from /usr/local/lib/ to /usr/lib64/ I get those errors: g++ -Wl,--no-undefined -shared -o seal_diff_cpp.so

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

2018-08-20 Thread TalGloz
My CXXFLAGS has the -fPIC flag in it. As I understood from Tom Lane's previos post, I have to recompile the libseal.a if the -fPIC flag or turn the libseal.a into a libseal.so. Best regars, Tal -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html

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

2018-08-20 Thread Daniel Verite
TalGloz wrote: > Do I have to replace my -shared in the link command with -fPIC? No, but -fPIC should go into your CXXFLAGS. The pgxs makefile handles CFLAGS, but as it doesn't do C++, you're on your own for CXXFLAGS. Best regards, -- Daniel Vérité PostgreSQL-powered mailer: http://www.

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

2018-08-19 Thread Tom Lane
TalGloz writes: > Thanks, that did the trick. But now I'm getting this > /usr/bin/ld: /usr/lib64/libseal.a(bigpoly.cpp.o): relocation R_X86_64_32 > against `.rodata.str1.1' can not be used when making a shared object; > recompile with -fPIC Ugh, I was wondering if that was really going to work or

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

2018-08-19 Thread TalGloz
Thanks, that did the trick. But now I'm getting this g++ -Wl,--no-undefined -shared -o seal_diff_cpp.so seal_diff_cpp.o -L/usr/pgsql-10/lib -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-10/lib',--enable-new-dtags -L/usr/local/lib -lseal -pthread /usr/bin/ld: /usr/lib64/libseal.a(bigpoly.cpp

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

2018-08-19 Thread Daniel Verite
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.

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

2018-08-19 Thread Dmitry Igrishin
вс, 19 авг. 2018 г. в 17:54, Tom Lane : > > Dmitry Igrishin writes: > > вс, 19 авг. 2018 г. в 16:20, TalGloz : > >> I'll try it later when I'm home. Is there a reason that you are linking > >> like > >> this > >> $(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so $(LDFLAGS) $(LDLIBS) > >> seal

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

2018-08-19 Thread TalGloz
I'm using Fedora 28 OS and I'll check it with PGXS. The funny thing is that everything works when I comment every code line connected to the SEAL library. The cppcodec library is also an external library installed to /usr/local/include/cppcodec like the SEAL library. Regards, Tal -- Sent from:

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

2018-08-19 Thread Tom Lane
Dmitry Igrishin writes: > вс, 19 авг. 2018 г. в 16:20, TalGloz : >> I'll try it later when I'm home. Is there a reason that you are linking like >> this >> $(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so $(LDFLAGS) $(LDLIBS) >> seal_diff_cpp.o >> And not like this? >> $(CXX) -Wl,--no-undefin

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

2018-08-19 Thread Dmitry Igrishin
вс, 19 авг. 2018 г. в 16:20, TalGloz : > > I'll try it later when I'm home. Is there a reason that you are linking like > this > > $(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so $(LDFLAGS) $(LDLIBS) > seal_diff_cpp.o > > And not like this? > > $(CXX) -Wl,--no-undefined -shared -o seal_diff_c

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

2018-08-19 Thread TalGloz
I'll try it later when I'm home. Is there a reason that you are linking like this $(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so $(LDFLAGS) $(LDLIBS) seal_diff_cpp.o And not like this? $(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so seal_diff_cpp.o $(LDFLAGS) $(LDLIBS) -- Sent f

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

2018-08-19 Thread Dmitry Igrishin
вс, 19 авг. 2018 г. в 15:59, TalGloz : > > No, they still don't appear there and same errors are shown. Try to refactor your Makefile like this: LDFLAGS=-L$(INCLUDE_SEAL_LIB) LDLIBS=-lseal -lpthread seal_diff_cpp.so: seal_diff_cpp.o $(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so $(L

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

2018-08-19 Thread TalGloz
No, they still don't appear there and same errors are shown. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html

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

2018-08-19 Thread Dmitry Igrishin
вс, 19 авг. 2018 г. в 15:46, TalGloz : > > OK, I've changed my line to > LDFLAGS = -L$(INCLUDE_SEAL_LIB) -lseal -lpthread And? Is these flags appeared in the g++ invoking command line? I mean the following: g++ -Wl,--no-undefined -shared -o seal_diff_cpp.so seal_diff_cpp.o -L/usr/pgsql-10/lib -L

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

2018-08-19 Thread TalGloz
OK, I've changed my line to LDFLAGS = -L$(INCLUDE_SEAL_LIB) -lseal -lpthread In my Makefile this command is written like this (line numbers are just for orientation) 1: seal_diff_cpp.so: seal_diff_cpp.o 2:$(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so seal_diff_cpp.o $(LDFLAGS) 3:

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

2018-08-19 Thread Dmitry Igrishin
вс, 19 авг. 2018 г. в 15:07, TalGloz : > > Do you mean this command: > > seal_diff_cpp.so: seal_diff_cpp.o > $(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so > seal_diff_cpp.o $(LDFLAGS) > > If yes then the -lseal is added with the $(LDFLAGS) at the end of the > command. You've defined

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

2018-08-19 Thread TalGloz
Do you mean this command: seal_diff_cpp.so: seal_diff_cpp.o $(CXX) -Wl,--no-undefined -shared -o seal_diff_cpp.so seal_diff_cpp.o $(LDFLAGS) If yes then the -lseal is added with the $(LDFLAGS) at the end of the command. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general

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

2018-08-19 Thread Dmitry Igrishin
вс, 19 авг. 2018 г. в 13:56, TalGloz : > > Hello, > > *I have this code for my C extension function. > * > > xtern "C" { // C Headers must be inside exter "C" { } block. > #include > #include > #include > #include > #include > #include > #include > #include > > PG_MODULE_MAGIC; > } > > // C

Linker errors while creating a PostgreSQL C extension function.

2018-08-19 Thread TalGloz
Hello, *I have this code for my C extension function. * xtern "C" { // C Headers must be inside exter "C" { } block. #include #include #include #include #include #include #include #include PG_MODULE_MAGIC; } // CPP Header must be outside extern "C" { } block. #include #include #includ