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 1jUxrD-0008TU-PS for pgsql-general@arkaria.postgresql.org; Sat, 02 May 2020 19:31:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jUxrC-0007BV-Mc for pgsql-general@arkaria.postgresql.org; Sat, 02 May 2020 19:31:26 +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 1jUxrC-0007BO-F6 for pgsql-general@lists.postgresql.org; Sat, 02 May 2020 19:31:26 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUxr9-0006m7-J0 for pgsql-general@postgresql.org; Sat, 02 May 2020 19:31:25 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 3B6818D3; Sat, 2 May 2020 15:31:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 02 May 2020 15:31:22 -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=0 fS8GLPaQitpiAP8cBD7kMeFOnjZJocCi9JfV2MM0g0=; b=thEj45dOie5js5kev r7rHqIwuPNys0Z0KXLnomXvRhc/yip+z+Lb+o7rSbO43pUcxPqY8gFwjoSbT4zie oFf54kJKn4duqo+ZhT1ZrwfcFfNn66Ho1SkPl1jdQXixgYLczQH5XLoEdpZXr/As xTH016OT6VojNqoHW5GQ8YZAsIsYBsI6YYIn65N+LvQzGMCWSjsYMizGNaU4qOwx AQHrrLgw9IyhxDOXeGOGqqhkuRDm2KqEfN6uC731EmMPDqLm+AucivxRj+c2mkqW 8AD0d6qiruI+ri7m8EFlbHmMSsphQFIozn/eTcxHJgbB1m4Kz0LguVBDLN/cPq/D o6OHg== 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=0fS8GLPaQitpiAP8cBD7kMeFOnjZJocCi9JfV2MM0 g0=; b=rCGOoqWNrUCuxSY13rNOVdoO7brBgqKf3I1UWuY37F8UQmTj0C+H5NNmD tl3IJop/PdxQd/q1k/gcfm5Mhn27KCv3extrb1kofAlCK5S/ZvlxpaR1dzrmmBZ4 htzHKuzq/aooHdznP3UNjGqFXMnCHzHVYQhfD5+DixL4dBc7nX8Gce9FINa54c0F UhRurzxMkTRO6xsjPJ830bIzft58ftfyxFLiMHe3x8RZZEV3r1Ga4Ke+DsDiwFCM UjChUqW3K5EZRBqhanvLRzyKM43zVJhWf/FOLnJGO1uQ2bPIiUcnuqVMmKiJNQWQ FBNWg2T4hcq8PXH9qkiaWr9o2Xd0Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrieelgddufeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhephfeffeejke fhudfhueekfedvhedvvedvffeivedtudekffdtgfffueehffehveeknecuffhomhgrihhn pehpghigshdrmhhkpdhpohhsthhgrhgvshhqlhdqrghrtghhihhvvgdrohhrghenucfkph epjeehrddujedvrdehrddvfedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh 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 145EC3065FAD; Sat, 2 May 2020 15:31:20 -0400 (EDT) Subject: Re: Compiling C Extension Functions against PostgreSQL 12 To: TalGloz , pgsql-general@postgresql.org References: <1588447687198-0.post@n3.nabble.com> From: Adrian Klaver Message-ID: <4edd59f3-4d95-c41c-6839-7d022946f8d4@aklaver.com> Date: Sat, 2 May 2020 12:31:20 -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: <1588447687198-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 12:28 PM, TalGloz wrote: > I'm trying to upgrade from PostgreSQL 10 to 12 and I need to compile all my > manually created C extension functions against PostrgreSQL 12 before > starting the upgrade process. I have this Makefile that compiles perfectly > the seal_diff_cpp.cpp C extension function against PostgreSQL 10: > > MODULES = seal_diff_cpp > PG_CONFIG = /usr/pgsql-10/bin/pg_config > PGXS = $(shell $(PG_CONFIG) --pgxs) > INCLUDEDIR = $(shell $(PG_CONFIG) --includedir-server) > INCLUDE_SEAL = /usr/local/include > INCLUDE_SEAL_LIB = /usr/local/lib > INCLUDE_CPPCODEC = /usr/local/include/cppcodec > CXX = g++ > CXXFLAGS = -std=c++17 -fPIC -Wall -Werror -g -O0 -pthread \ > -I$(INCLUDEDIR) -I$(INCLUDE_SEAL) -I$(INCLUDE_CPPCODEC) > SEAL_LDFLAGS = -L$(INCLUDE_SEAL_LIB) -lseal -pthread > 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) > $(CXX) -shared -o seal_diff_cpp.so seal_diff_cpp.o $(LDFLAGS) > $(SEAL_LDFLAGS) > seal_diff_cpp.o: seal_diff_cpp.cpp > $(CXX) $(CXXFLAGS) -o seal_diff_cpp.o -c seal_diff_cpp.cpp > > When I execute it the output looks like this: > > g++ -std=c++17 -fPIC -Wall -Werror -g -O0 -pthread > -I/usr/pgsql-10/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-10/lib > -L/usr/lib64 -Wl,--as-needed > -Wl,-rpath,'/usr/pgsql-10/lib',--enable-new-dtags -L/usr/local/lib -lseal > -pthread > > And the seal_diff_cpp.so gets created without any problems. But when I use > PG_CONFIG = /usr/pgsql-12/bin/pg_config I get: > > 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 > | ^~~~~~~~~~~~ > compilation terminated. > make: *** [Makefile:19: seal_diff_cpp.o] Error 1 > > The Makefile has all the needed information to compile the seal_diff_cpp.so > against PostgreSQL 12: > /usr/pgsql-10/bin/pg_config --pgxs ---> > /usr/pgsql-10/lib/pgxs/src/makefiles/pgxs.mk > /usr/pgsql-12/bin/pg_config --pgxs ---> > /usr/pgsql-12/lib/pgxs/src/makefiles/pgxs.mk > > /usr/pgsql-10/bin/pg_config --includedir-server ---> > /usr/pgsql-10/include/server > /usr/pgsql-12/bin/pg_config --includedir-server ---> > /usr/pgsql-12/include/server (postgres.h is there) > > I can't understand why it doesn't work. Do you have Postgres 12 -dev package installed? > > TalGloz > > > > -- > Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html > > -- Adrian Klaver adrian.klaver@aklaver.com