Search Postgresql Archives

Re: Compiling C Extension Functions against PostgreSQL 12

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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<std::shared_mutex>;
                                            ~~~~~^
/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<std::shared_mutex>;
                                                 ^
/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<std::shared_mutex>;
                                            ~~~~~^
/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<std::shared_mutex>;
                                                 ^
/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<seal::util::MemoryPoolMT>' to 'seal::MemoryPoolHandle'
            return MemoryPoolHandle(std::make_shared<util::MemoryPoolMT>());
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/seal/memorypoolhandle.h:70:9: note: candidate constructor
not viable: no known conversion from 'shared_ptr<seal::util::MemoryPoolMT>'
to 'const seal::MemoryPoolHandle' for 1st argument
        MemoryPoolHandle(const MemoryPoolHandle &copy)
        ^
/usr/local/include/seal/memorypoolhandle.h:81:9: note: candidate constructor
not viable: no known conversion from 'shared_ptr<seal::util::MemoryPoolMT>'
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<seal::util::MemoryPoolMT>' to 'shared_ptr<util::MemoryPool>' for
1st argument
        MemoryPoolHandle(std::shared_ptr<util::MemoryPool> 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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux