Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUzvk-000569-TA for pgsql-general@arkaria.postgresql.org; Sat, 02 May 2020 21:44:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jUzvi-0001FC-Ln for pgsql-general@arkaria.postgresql.org; Sat, 02 May 2020 21:44:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUzvi-0001F5-9i for pgsql-general@lists.postgresql.org; Sat, 02 May 2020 21:44:14 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jUzvb-00085D-FC for pgsql-general@postgresql.org; Sat, 02 May 2020 21:44:13 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id B90A01D14A8AB for ; Sat, 2 May 2020 14:44:06 -0700 (MST) Date: Sat, 2 May 2020 14:44:06 -0700 (MST) From: TalGloz To: pgsql-general@postgresql.org Message-ID: <1588455846755-0.post@n3.nabble.com> In-Reply-To: <173180ca-67f8-b925-fe5c-7c08de5bb9c1@aklaver.com> References: <4edd59f3-4d95-c41c-6839-7d022946f8d4@aklaver.com> <1588448354769-0.post@n3.nabble.com> <1b0a4606-2964-48ef-0736-ff51db2d2e1d@aklaver.com> <1588449802471-0.post@n3.nabble.com> <1588450167090-0.post@n3.nabble.com> <9443e9f9-1eec-d4f5-eb19-fb6d1da9c587@aklaver.com> <1588452776591-0.post@n3.nabble.com> <1610.1588454290@sss.pgh.pa.us> <173180ca-67f8-b925-fe5c-7c08de5bb9c1@aklaver.com> Subject: Re: Compiling C Extension Functions against PostgreSQL 12 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Adrian Klaver-4 wrote > On 5/2/20 2:18 PM, Tom Lane wrote: >> TalGloz < > glozmantal@ > > writes: >>> I dont understand why the output for Postgres 12 >>> g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute >>> -Wformat-security -fno-strict-aliasing -fwrapv -O2 -o seal_diff_cpp.o -c >>> seal_diff_cpp.cpp >>> seal_diff_cpp.cpp:2:10: fatal error: postgres.h: No such file or >>> directory >>> 2 | #include "postgres.h" >>> | ^~~~~~~~~~~~ >> >>> looks different form the ones of Postgres 10 >> >> Looking at your Makefile, it seems to be expecting that CXXFLAGS will >> be honored in the build, and it isn't being. >> >> As far as I can see from pgxs.mk, you're supposed to spell that >> PG_CXXFLAGS. Probably, it accidentally worked to do it the other >> way in v10, but no longer does, likely as a result of the fact that >> there's now some minimal amount of C++ code in core PG. > > I was looking at that and was trying to figure out this from pgxs.mk: > > # PG_CXXFLAGS -- will be appended to CXXFLAGS > > ... > > ifdef PG_CXXFLAGS > override CXXFLAGS := $(CXXFLAGS) $(PG_CXXFLAGS) > > Was wondering if this might be culprit(from example in pgxs.mk): > > # include $(PGXS) > > The OP does not have that in their make file. > >> >> I'm a little dubious about whether overriding CXX is a good idea now, >> too. >> (Likely the core setting is the same, but if it were pointing at a >> different compiler that could cause trouble.) >> >> regards, tom lane >> >> > > > -- > Adrian Klaver > adrian.klaver@ The "include $(PGXS)" is defined in the Makefile. After changig the CXXFLAGS to PG_CXXFLAGS I get: *g++ -std=c++17 -fPIC -Wall -Werror -g -O0 -pthread -I/usr/pgsql-12/include/server -I/usr/local/include -I/usr/local/include/cppcodec -o seal_diff_cpp.o -c seal_diff_cpp.cpp g++ -shared -o seal_diff_cpp.so seal_diff_cpp.o -L/usr/pgsql-12/lib -L/usr/lib64 -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-12/lib',--enable-new-dtags -L/usr/local/lib -lseal -pthread /usr/lib64/ccache/clang -xc++ -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/pgsql-12/include/server -I/usr/pgsql-12/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o seal_diff_cpp.bc seal_diff_cpp.cpp* In file included from seal_diff_cpp.cpp:23: In file included from /usr/local/include/seal/seal.h:3: In file included from /usr/local/include/seal/bigpoly.h:9: In file included from /usr/local/include/seal/biguint.h:6: In file included from /usr/local/include/seal/memorypoolhandle.h:6: In file included from /usr/local/include/seal/util/mempool.h:12: /usr/local/include/seal/util/locks.h:12:50: error: no template named 'shared_mutex' in namespace 'std'; did you mean 'shared_ptr'? using ReaderLock = std::shared_lock; ~~~~~^ /usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/shared_ptr.h:103:11: note: 'shared_ptr' declared here class shared_ptr : public __shared_ptr<_Tp> ^ In file included from seal_diff_cpp.cpp:23: In file included from /usr/local/include/seal/seal.h:3: In file included from /usr/local/include/seal/bigpoly.h:9: In file included from /usr/local/include/seal/biguint.h:6: In file included from /usr/local/include/seal/memorypoolhandle.h:6: In file included from /usr/local/include/seal/util/mempool.h:12: /usr/local/include/seal/util/locks.h:12:50: error: use of class template 'std::shared_ptr' requires template arguments using ReaderLock = std::shared_lock; ^ /usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/shared_ptr.h:103:11: note: template is declared here class shared_ptr : public __shared_ptr<_Tp> ^ In file included from seal_diff_cpp.cpp:23: In file included from /usr/local/include/seal/seal.h:3: In file included from /usr/local/include/seal/bigpoly.h:9: In file included from /usr/local/include/seal/biguint.h:6: In file included from /usr/local/include/seal/memorypoolhandle.h:6: In file included from /usr/local/include/seal/util/mempool.h:12: /usr/local/include/seal/util/locks.h:14:50: error: no template named 'shared_mutex' in namespace 'std'; did you mean 'shared_ptr'? using WriterLock = std::unique_lock; ~~~~~^ /usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/shared_ptr.h:103:11: note: 'shared_ptr' declared here class shared_ptr : public __shared_ptr<_Tp> ^ In file included from seal_diff_cpp.cpp:23: In file included from /usr/local/include/seal/seal.h:3: In file included from /usr/local/include/seal/bigpoly.h:9: In file included from /usr/local/include/seal/biguint.h:6: In file included from /usr/local/include/seal/memorypoolhandle.h:6: In file included from /usr/local/include/seal/util/mempool.h:12: /usr/local/include/seal/util/locks.h:14:50: error: use of class template 'std::shared_ptr' requires template arguments using WriterLock = std::unique_lock; ^ /usr/bin/../lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/shared_ptr.h:103:11: note: template is declared here class shared_ptr : public __shared_ptr<_Tp> ^ In file included from seal_diff_cpp.cpp:23: In file included from /usr/local/include/seal/seal.h:3: In file included from /usr/local/include/seal/bigpoly.h:9: In file included from /usr/local/include/seal/biguint.h:6: In file included from /usr/local/include/seal/memorypoolhandle.h:6: In file included from /usr/local/include/seal/util/mempool.h:12: /usr/local/include/seal/util/locks.h:21:20: error: unknown type name 'ReaderLock' inline ReaderLock acquire_read() ^ /usr/local/include/seal/util/locks.h:26:20: error: unknown type name 'WriterLock' inline WriterLock acquire_write() ^ /usr/local/include/seal/util/locks.h:31:20: error: unknown type name 'ReaderLock' inline ReaderLock try_acquire_read() ^ /usr/local/include/seal/util/locks.h:36:20: error: unknown type name 'WriterLock' inline WriterLock try_acquire_write() ^ /usr/local/include/seal/util/locks.h:46:18: error: no type named 'shared_mutex' in namespace 'std' std::shared_mutex rw_lock_mutex_; ~~~~~^ In file included from seal_diff_cpp.cpp:23: In file included from /usr/local/include/seal/seal.h:3: In file included from /usr/local/include/seal/bigpoly.h:9: In file included from /usr/local/include/seal/biguint.h:6: In file included from /usr/local/include/seal/memorypoolhandle.h:6: /usr/local/include/seal/util/mempool.h:561:17: error: unknown type name 'ReaderLock' ReaderLock lock(pools_locker_.acquire_read()); ^ In file included from seal_diff_cpp.cpp:23: In file included from /usr/local/include/seal/seal.h:3: In file included from /usr/local/include/seal/bigpoly.h:9: In file included from /usr/local/include/seal/biguint.h:6: /usr/local/include/seal/memorypoolhandle.h:144:20: error: no matching conversion for functional-style cast from 'shared_ptr' to 'seal::MemoryPoolHandle' return MemoryPoolHandle(std::make_shared()); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/seal/memorypoolhandle.h:70:9: note: candidate constructor not viable: no known conversion from 'shared_ptr' to 'const seal::MemoryPoolHandle' for 1st argument MemoryPoolHandle(const MemoryPoolHandle ©) ^ /usr/local/include/seal/memorypoolhandle.h:81:9: note: candidate constructor not viable: no known conversion from 'shared_ptr' to 'seal::MemoryPoolHandle' for 1st argument MemoryPoolHandle(MemoryPoolHandle &&source) noexcept ^ /usr/local/include/seal/memorypoolhandle.h:243:9: note: candidate constructor not viable: no known conversion from 'shared_ptr' to 'shared_ptr' for 1st argument MemoryPoolHandle(std::shared_ptr pool) noexcept : ^ /usr/local/include/seal/memorypoolhandle.h:61:9: note: candidate constructor not viable: requires 0 arguments, but 1 was provided MemoryPoolHandle() = default; ^ 11 errors generated. make: *** [/usr/pgsql-12/lib/pgxs/src/makefiles/../../src/Makefile.global:1047: seal_diff_cpp.bc] Error 1 Does it try to comply the seal related code using the llvm compiler? If yes, can I force it to se the GNU compiler instead? In my knolage the seal library doesn't work with llvm. Best regards, TalGloz -- Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html