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 1jV1Ub-0000bj-QM for pgsql-general@arkaria.postgresql.org; Sat, 02 May 2020 23:24:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jV1Ua-000395-MA for pgsql-general@arkaria.postgresql.org; Sat, 02 May 2020 23:24:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jV1UY-0002z9-Oo for pgsql-general@lists.postgresql.org; Sat, 02 May 2020 23:24:20 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jV1UP-0005mD-Ic for pgsql-general@postgresql.org; Sat, 02 May 2020 23:24:18 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 10A1AA13; Sat, 2 May 2020 19:24:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 02 May 2020 19:24:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=Q etdH0IuksP7v6x/5tYSkQIXc5xXFzPbXMBtMFQ+pew=; b=plj1spjLltQ1GJggW nP+34JZyz/wZXpHKeHAfYcNuwqHThw5OMTB8TwlSCEmEBKYtFmj/GzIyPp5qIYIv F3c+ZSERhCGFaz7roKbIjXGVP+RlZgGR9bE1qH0Q55CTvV6m7q1hNOKdeq2KBHZ/ 08t6IkGcGsj/ECmMOnVPKRatrGOIiuoCE0w18jvkE5jEKr75Z9FhvoIYXk8/CfqA P/cBQ1gk5NjfJFCCiPdaviSK7PhgmdofVZWLCitxrFWXeXNY4Wp0bU4JT5MfOsi8 7KcLTJPugYavcCNhMmqTJYUogypxWEJdpjLWbSKZaYebqHpIklN26bgfAilcqpiw E3/oA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=QetdH0IuksP7v6x/5tYSkQIXc5xXFzPbXMBtMFQ+p ew=; b=e1rMtxkd//aWhqW5RZCERqIiAPZWplyc4J5rmus+GbnA4PseyYaHw4yCm KE+RL2Vxn6vZoUtXKhglq1ozNLmItAByLe/gtQq8tn7Q2ZF9VSMNENioebIBsUxs 6FBFbdXV7V/s3jFW+egKGDCI6Fv40VDDxrN9HD2xc8JWaiYUiBlan2EOO37tzVCv 2QXLwqvkU3yw+jwOCETzwVHqZgiGXpGY80evEJaelmNdpOZXz47ifB+HOlABRBEn nOWp7mBksAFBiG5rlUmgbOkMpyj/mfWw9yN2XFkNxDD0fY8S8M3aA+JIuY0RZMkA c+5P/kPup2XDOS+hh/GxkAF6XjWwQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrjedtgddukecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthejre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeelvddvleduff egheegveeltddtffejhffgleegueeivddtueehhffhueekkeegieenucffohhmrghinhep vhdvrdhsohdpphhoshhtghhrvghsqhhlqdgrrhgthhhivhgvrdhorhhgnecukfhppeejhe drudejvddrhedrvdefudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id 0B9143065F95; Sat, 2 May 2020 19:24:04 -0400 (EDT) Subject: Re: Compiling C Extension Functions against PostgreSQL 12 To: TalGloz , pgsql-general@postgresql.org References: <1588447687198-0.post@n3.nabble.com> <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> <1588460637089-0.post@n3.nabble.com> From: Adrian Klaver Message-ID: <59882a95-e528-0845-e6e3-ad00356c1065@aklaver.com> Date: Sat, 2 May 2020 16:24:04 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <1588460637089-0.post@n3.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/2/20 4:03 PM, TalGloz wrote: > Tom Lane-2 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'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 > > I've added some output to a different module Makefile that uses the same > libraries and Changed "CXXFLAGS" to "PG_CXXFLAGS" and "LDFLAGS" to > "PG_LDFLAGS": Did you? In Makefile below I see: #PG_LDFLAGS= -L$(INCLUDE_SEAL_LIB) -lseal -pthread # Seal linker flags SEAL_LDFLAGS = -L$(INCLUDE_SEAL_LIB) -lseal -pthread > > # This file crates the seal_mean_cxx_v2.so library for the PostgreSQL > # Usage: > # make # compiles all > # make clean # clean all binaries and objects > > MODULES = seal_mean_cxx_v2 > > # Location of PostgreSQL pg_config file > PG_CONFIG = /usr/pgsql-10/bin/pg_config > # PostgreSQL path to PGXS > PGXS = $(shell $(PG_CONFIG) --pgxs) > # PostgreSQL path to server header files > INCLUDEDIR = $(shell $(PG_CONFIG) --includedir-server) > # PostgreSQL path to executable shared libraries > POSGRESLIBINSTALL = $(shell $(PG_CONFIG) --pkglibdir) > > # Location of the installed seal library > INCLUDE_SEAL = /usr/local/include > # Location of the compiled seal lib library > INCLUDE_SEAL_LIB = /usr/local/lib > # Location of the installed cppcodec library > INCLUDE_CPPCODEC = /usr/local/include/cppcodec > > # Compiler to use > CXX = g++ > # Compiler flags > PG_CXXFLAGS = -std=c++17 -fPIC -Wall -Werror -g -O0 -pthread \ > -I$(INCLUDEDIR) -I$(INCLUDE_SEAL) -I$(INCLUDE_CPPCODEC) > #PG_LDFLAGS= -L$(INCLUDE_SEAL_LIB) -lseal -pthread > # Seal linker flags > SEAL_LDFLAGS = -L$(INCLUDE_SEAL_LIB) -lseal -pthread > include $(PGXS) > > seal_mean_cxx_v2.so: seal_mean_cxx_v2.o # Create the .so file > @echo "" > @echo "Cereating .so file." > # Needed when checking the linker errors against the external SEAL library > and must be commented when creating .so file > # $(CXX) -Wl,--no-undefined -shared -o seal_mean_cxx.so seal_mean_cxx.o > $(PG_LDFLAGS) $(SEAL_LDFLAGS) > # Creates the .so file > $(CXX) -shared -o seal_mean_cxx_v2.so seal_mean_cxx_v2.o $(PG_LDFLAGS) > $(SEAL_LDFLAGS) > @echo "Done." > @echo "" > @echo "Copying the created .so library to \"${POSGRESLIBINSTALL}\"." > # Copies the .so file to PostgreSQL shared libraries > cp seal_mean_cxx_v2.so $(POSGRESLIBINSTALL) > @echo "Done." > @echo "" > > seal_mean_cxx_v2.o: seal_mean_cxx_v2.cpp # Create the .o file > @echo "" > @echo "Creating .o file." > $(CXX) $(PG_CXXFLAGS) -o seal_mean_cxx_v2.o -c seal_mean_cxx_v2.cpp > @echo "Done." > > .PHONY = clean > clean: # Clean .so and .o files > @echo "" > @echo "Cleaning the .so and .o files" > rm -f seal_mean_cxx_v2.so rm seal_mean_cxx_v2.o > @echo "Done." > @echo "" > > I get this part for my code in the Makefile: > > Makefile:57: warning: overriding recipe for target 'clean' > /usr/pgsql-12/lib/pgxs/src/makefiles/pgxs.mk:342: warning: ignoring old > recipe for target 'clean' > > Cleaning the .so and .o files > rm -f seal_mean_cxx_v2.so rm seal_mean_cxx_v2.o > Done. > > [root@www seal_mean]# make > Makefile:57: warning: overriding recipe for target 'clean' > /usr/pgsql-12/lib/pgxs/src/makefiles/pgxs.mk:342: warning: ignoring old > recipe for target 'clean' > > Creating .o file. > g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute > -Wformat-security -fno-strict-aliasing -fwrapv -O2 -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_mean_cxx_v2.o -c seal_mean_cxx_v2.cpp > Done. > > Cereating .so file. > g++ -shared -o seal_mean_cxx_v2.so seal_mean_cxx_v2.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 > Done. > > Copying the created .so library to "/usr/pgsql-12/lib". > cp seal_mean_cxx_v2.so /usr/pgsql-12/lib > Done. > > > Which is good, my seal_mean_cxx_v2.so being created and copied to > /usr/pgsql-12/lib/. But right after that I get this and it doesn't seem to > effect my seal_mean_cxx_v2.so library: > /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_mean_cxx_v2.bc > seal_mean_cxx_v2.cpp > In file included from seal_mean_cxx_v2.cpp:25: > 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_mean_cxx_v2.cpp:25: > 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_mean_cxx_v2.cpp:25: > 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_mean_cxx_v2.cpp:25: > 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_mean_cxx_v2.cpp:25: > 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_mean_cxx_v2.cpp:25: > 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_mean_cxx_v2.cpp:25: > 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_mean_cxx_v2.bc] Error 1 > > Why does it start executing the following after it did what it was supposed > to do? > /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_mean_cxx_v2.bc > seal_mean_cxx_v2.cpp > > > Best regards, > TalGloz > > > > -- > Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html > > -- Adrian Klaver adrian.klaver@aklaver.com