怎么上传自己的做网站/关键词查询
ubuntu下编译libpq和libpqxx库,用于链接人大金仓
上篇文章验证了libpqxx可以链接人大金仓数据库,这篇文章尝试自己编译libpq和libpqxx库。
文章目录
- ubuntu下编译libpq和libpqxx库,用于链接人大金仓
- libpq
- 下载libpq库
- 看看有没有libpq库
- 编译libpq
- readline问题
- 编译postgresql
- 尝试单独编译libpq库
- libpqxx
- 下载libpqxx
- 选版本
- configure --help
- 编译配置
- 编译
- 再编译
- 再再编译
- 看看依赖
- 好像没有问题,收工
libpq
下载libpq库
找了以打晌儿,就是找不到,咋办?放弃吧,等等,好像在postgresql源码中。
下载源码看看有没有。
官网走起:https://www.postgresql.org/
两会期间,网速贼慢,物理吐槽,等版半天打开了一次,就不知道怎么遭到下载地址了。
先按照ubuntu18源中的版本进行下载。
$ dpkg -L libpq-dev | grep -F ".pc" | xargs cat
Name: libpq
Description: PostgreSQL libpq library
Url: http://www.postgresql.org/
Version: 10.23
Requires:
Requires.private:
Cflags: -I/usr/include/postgresql
Libs: -L/usr/lib/x86_64-linux-gnu -lpq
Libs.private: -L/usr/lib/x86_64-linux-gnu/mit-krb5 -lssl -lcrypto -lgssapi_krb5 -lcrypt -lldap_r
最终的下载位置为:https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.gz
需要其他版本呢自己找,自己在官网找好了。
看看有没有libpq库
解压后,搜一下libpq关键字
# root @ ubuntu in ~/workspace/postgresql-10.23 [8:10:53]
$ find . -name "*libpq*"
./src/backend/libpq
./src/backend/replication/libpqwalreceiver
./src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
./src/interfaces/libpq
./src/interfaces/libpq/libpq-fe.h
./src/interfaces/libpq/libpq-int.h
./src/interfaces/libpq/libpq.rc.in
./src/interfaces/libpq/libpq-events.h
./src/interfaces/libpq/libpq-events.c
./src/interfaces/libpq/libpqddll.def
./src/interfaces/libpq/libpqdll.def
./src/interfaces/libpq/libpq-dist.rc
./src/include/libpq
./src/include/libpq/libpq-be.h
./src/include/libpq/libpq.h
./src/include/libpq/libpq-fs.h
./src/bin/pg_rewind/libpq_fetch.c
./src/test/examples/testlibpq3.sql
./src/test/examples/testlibpq2.c
./src/test/examples/testlibpq2.sql
./src/test/examples/testlibpq.c
./src/test/examples/testlibpq4.c
./src/test/examples/testlibpq3.c
./doc/src/sgml/html/libpq-copy.html
./doc/src/sgml/html/libpq-connect.html
./doc/src/sgml/html/libpq.html
./doc/src/sgml/html/libpq-example.html
./doc/src/sgml/html/libpq-fastpath.html
./doc/src/sgml/html/libpq-misc.html
./doc/src/sgml/html/libpq-events.html
./doc/src/sgml/html/libpq-threading.html
./doc/src/sgml/html/libpq-pgpass.html
./doc/src/sgml/html/libpq-status.html
./doc/src/sgml/html/libpq-cancel.html
./doc/src/sgml/html/libpq-ldap.html
./doc/src/sgml/html/libpq-control.html
./doc/src/sgml/html/libpq-build.html
./doc/src/sgml/html/libpq-ssl.html
./doc/src/sgml/html/libpq-envars.html
./doc/src/sgml/html/libpq-async.html
./doc/src/sgml/html/libpq-notify.html
./doc/src/sgml/html/libpq-notice-processing.html
./doc/src/sgml/html/libpq-exec.html
./doc/src/sgml/html/libpq-pgservice.html
./doc/src/sgml/html/libpq-single-row-mode.html
./doc/src/sgml/libpq.sgml
浪费了好大一会儿时间,原来在数据库的源码库中。
编译libpq
怎么单独编译libpq呢。
./configure --help 走起
# root @ ubuntu in ~/workspace/postgresql-10.23 [8:14:49]
$ ./configure --help
`configure' configures PostgreSQL 10.23 to adapt to many kinds of systems.Usage: ./configure [OPTION]... [VAR=VALUE]...To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.Defaults for the options are specified in brackets.Configuration:-h, --help display this help and exit--help=short display options specific to this package--help=recursive display the short help of all the included packages-V, --version display version information and exit-q, --quiet, --silent do not print `checking ...' messages--cache-file=FILE cache test results in FILE [disabled]-C, --config-cache alias for `--cache-file=config.cache'-n, --no-create do not create output files--srcdir=DIR find the sources in DIR [configure dir or `..']Installation directories:--prefix=PREFIX install architecture-independent files in PREFIX[/usr/local/pgsql]--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX[PREFIX]By default, `make install' will install all the files in
`/usr/local/pgsql/bin', `/usr/local/pgsql/lib' etc. You can specify
an installation prefix other than `/usr/local/pgsql' using `--prefix',
for instance `--prefix=$HOME'.For better control, use the options below.Fine tuning of the installation directories:--bindir=DIR user executables [EPREFIX/bin]--sbindir=DIR system admin executables [EPREFIX/sbin]--libexecdir=DIR program executables [EPREFIX/libexec]--sysconfdir=DIR read-only single-machine data [PREFIX/etc]--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]--localstatedir=DIR modifiable single-machine data [PREFIX/var]--libdir=DIR object code libraries [EPREFIX/lib]--includedir=DIR C header files [PREFIX/include]--oldincludedir=DIR C header files for non-gcc [/usr/include]--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]--datadir=DIR read-only architecture-independent data [DATAROOTDIR]--infodir=DIR info documentation [DATAROOTDIR/info]--localedir=DIR locale-dependent data [DATAROOTDIR/locale]--mandir=DIR man documentation [DATAROOTDIR/man]--docdir=DIR documentation root [DATAROOTDIR/doc/postgresql]--htmldir=DIR html documentation [DOCDIR]--dvidir=DIR dvi documentation [DOCDIR]--pdfdir=DIR pdf documentation [DOCDIR]--psdir=DIR ps documentation [DOCDIR]System types:--build=BUILD configure for building on BUILD [guessed]--host=HOST cross-compile to build programs to run on HOST [BUILD]Optional Features:--disable-option-checking ignore unrecognized --enable/--with options--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)--enable-FEATURE[=ARG] include FEATURE [ARG=yes]--disable-integer-datetimesobsolete option, no longer supported--enable-nls[=LANGUAGES]enable Native Language Support--disable-rpath do not embed shared library search path inexecutables--disable-spinlocks do not use spinlocks--disable-atomics do not use atomic operations--disable-strong-random do not use a strong random number source--enable-debug build with debugging symbols (-g)--enable-profiling build with profiling enabled--enable-coverage build with coverage testing instrumentation--enable-dtrace build with DTrace support--enable-tap-tests enable TAP tests (requires Perl and IPC::Run)--enable-depend turn on automatic dependency tracking--enable-cassert enable assertion checks (for debugging)--disable-thread-safety disable thread-safety in client libraries--disable-largefile omit support for large files--disable-float4-byval disable float4 passed by value--disable-float8-byval disable float8 passed by valueOptional Packages:--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)--with-extra-version=STRINGappend STRING to version--with-template=NAME override operating system template--with-includes=DIRS look for additional header files in DIRS--with-libraries=DIRS look for additional libraries in DIRS--with-libs=DIRS alternative spelling of --with-libraries--with-pgport=PORTNUM set default port number [5432]--with-blocksize=BLOCKSIZEset table block size in kB [8]--with-segsize=SEGSIZE set table segment size in GB [1]--with-wal-blocksize=BLOCKSIZEset WAL block size in kB [8]--with-wal-segsize=SEGSIZEset WAL segment size in MB [16]--with-CC=CMD set compiler (deprecated)--with-icu build with ICU support--with-tcl build Tcl modules (PL/Tcl)--with-tclconfig=DIR tclConfig.sh is in DIR--with-perl build Perl modules (PL/Perl)--with-python build Python modules (PL/Python)--with-gssapi build with GSSAPI support--with-krb-srvnam=NAME default service principal name in Kerberos (GSSAPI)[postgres]--with-pam build with PAM support--with-bsd-auth build with BSD Authentication support--with-ldap build with LDAP support--with-bonjour build with Bonjour support--with-openssl build with OpenSSL support--with-selinux build with SELinux support--with-systemd build with systemd support--without-readline do not use GNU Readline nor BSD Libedit for editing--with-libedit-preferredprefer BSD Libedit over GNU Readline--with-uuid=LIB build contrib/uuid-ossp using LIB (bsd,e2fs,ossp)--with-ossp-uuid obsolete spelling of --with-uuid=ossp--with-libxml build with XML support--with-libxslt use XSLT support when building contrib/xml2--with-system-tzdata=DIRuse system time zone data in DIR--without-zlib do not use Zlib--with-gnu-ld assume the C compiler uses GNU ld [default=no]Some influential environment variables:CC C compiler commandCFLAGS C compiler flagsLDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in anonstandard directory <lib dir>LIBS libraries to pass to the linker, e.g. -l<library>CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> ifyou have headers in a nonstandard directory <include dir>CPP C preprocessorPKG_CONFIG path to pkg-config utilityPKG_CONFIG_PATHdirectories to add to pkg-config's search pathPKG_CONFIG_LIBDIRpath overriding pkg-config's built-in search pathICU_CFLAGS C compiler flags for ICU, overriding pkg-configICU_LIBS linker flags for ICU, overriding pkg-configXML2_CONFIG path to xml2-config utilityXML2_CFLAGS C compiler flags for XML2, overriding pkg-configXML2_LIBS linker flags for XML2, overriding pkg-configLDFLAGS_EX extra linker flags for linking executables onlyLDFLAGS_SL extra linker flags for linking shared libraries onlyUse these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.Report bugs to <pgsql-bugs@postgresql.org>.
嗨~,看的头痛,完整编译以便。
./configure --prefix=/opt/postgresql
checking for library containing readline... no
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.
报错,没有readline
readline问题
请教一下apt老师
$ apt install postgresql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:libsecret-1-0 libsecret-common python-asn1crypto python-backports.ssl-match-hostname python-cached-property python-certifi python-cffi-backend python-chardetpython-cryptography python-dockerpty python-docopt python-enum34 python-funcsigs python-functools32 python-idna python-ipaddress python-jsonschema python-mock python-opensslpython-pbr python-pkg-resources python-requests python-six python-texttable python-urllib3 python-websocket python-yaml
Use 'apt autoremove' to remove them.
The following additional packages will be installed:postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common ssl-cert sysstat
Suggested packages:postgresql-doc locales-all postgresql-doc-10 libjson-perl openssl-blacklist isag
The following NEW packages will be installed:postgresql postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common ssl-cert sysstat
0 upgraded, 7 newly installed, 0 to remove and 86 not upgraded.
Need to get 5,227 kB of archives.
After this operation, 20.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
没有看到有readline相关依赖,跳过把,不管了。
./configure --prefix=/opt/postgresql --without-readline
configure: using compiler=gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
configure: using CFLAGS=-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -O2
configure: using CPPFLAGS= -D_GNU_SOURCE
configure: using LDFLAGS= -Wl,--as-needed
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/include/pg_config_ext.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/dynloader/linux.c to src/backend/port/dynloader.c
config.status: linking src/backend/port/posix_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/backend/port/dynloader/linux.h to src/include/dynloader.h
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port
好像没有报错,开始编译
编译postgresql
make && make install
漫长的等待,终于编译好了,但是东西有点多,怎么分离出来有用的文件呢?
继续请教apt老师。
相关的头文件
$ dpkg -L libpq-dev | grep -F "/usr/include/postgresql"
/usr/include/postgresql
/usr/include/postgresql/internal
/usr/include/postgresql/internal/c.h
/usr/include/postgresql/internal/libpq
/usr/include/postgresql/internal/libpq/pqcomm.h
/usr/include/postgresql/internal/libpq-int.h
/usr/include/postgresql/internal/port.h
/usr/include/postgresql/internal/postgres_fe.h
/usr/include/postgresql/internal/pqexpbuffer.h
/usr/include/postgresql/libpq
/usr/include/postgresql/libpq/libpq-fs.h
/usr/include/postgresql/libpq-events.h
/usr/include/postgresql/libpq-fe.h
/usr/include/postgresql/pg_config.h
/usr/include/postgresql/pg_config_ext.h
/usr/include/postgresql/pg_config_manual.h
/usr/include/postgresql/pg_config_os.h
/usr/include/postgresql/postgres_ext.h
相关的库文件
$ dpkg -L libpq-dev | grep -F "/usr/lib/x86_64-linux-gnu"
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libpgcommon.a
/usr/lib/x86_64-linux-gnu/libpgfeutils.a
/usr/lib/x86_64-linux-gnu/libpgport.a
/usr/lib/x86_64-linux-gnu/libpq.a
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libpq.pc
/usr/lib/x86_64-linux-gnu/libpq.so
库还好,可以分离出来,但是头文件有些麻烦,如果编译其他版本,头文件目录不一致,也是问题。
尝试单独编译libpq库
人家就是不支持,非得单独编译,嗨
头文件直接不分离,实在不行,开发时把真个头文件目录整个拷贝过去,多了也没有关系。
libpqxx
下载libpqxx
找到libpqxx与libpq的版本对应关系,
还是按照apt的版本对应关系。
$ dpkg -L libpqxx-dev | grep -F ".pc" | xargs cat
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/includeName: libpqxx
Description: a C++ API to the PostgreSQL database management system.
Version: 4.0.1
Libs: -L${libdir} -L/usr/lib/x86_64-linux-gnu -lpqxx
Cflags: -I${includedir} -I/usr/include/postgresql
github源码地址:https://github.com/jtv/libpqxx
然并卵,libpqxx都没有这个4.01版本了,咋办。
选版本
libpqxx 从7.0.0版本,开始要求基于C++17,我这个的开发环境还是C++11
所以就用libpqxx的6.x.x的最后一个版本6.4.8好了。
https://github.com/jtv/libpqxx/archive/refs/tags/6.4.8.tar.gz
configure --help
# root @ ubuntu in ~/workspace/libpqxx-6.4.8 [9:19:51]
$ ./configure --help
`configure' configures libpqxx 6.4.8 to adapt to many kinds of systems.Usage: ./configure [OPTION]... [VAR=VALUE]...To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.Defaults for the options are specified in brackets.Configuration:-h, --help display this help and exit--help=short display options specific to this package--help=recursive display the short help of all the included packages-V, --version display version information and exit-q, --quiet, --silent do not print `checking ...' messages--cache-file=FILE cache test results in FILE [disabled]-C, --config-cache alias for `--cache-file=config.cache'-n, --no-create do not create output files--srcdir=DIR find the sources in DIR [configure dir or `..']Installation directories:--prefix=PREFIX install architecture-independent files in PREFIX[/usr/local]--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX[PREFIX]By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.For better control, use the options below.Fine tuning of the installation directories:--bindir=DIR user executables [EPREFIX/bin]--sbindir=DIR system admin executables [EPREFIX/sbin]--libexecdir=DIR program executables [EPREFIX/libexec]--sysconfdir=DIR read-only single-machine data [PREFIX/etc]--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]--localstatedir=DIR modifiable single-machine data [PREFIX/var]--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]--libdir=DIR object code libraries [EPREFIX/lib]--includedir=DIR C header files [PREFIX/include]--oldincludedir=DIR C header files for non-gcc [/usr/include]--datarootdir=DIR read-only arch.-independent data root [PREFIX/share]--datadir=DIR read-only architecture-independent data [DATAROOTDIR]--infodir=DIR info documentation [DATAROOTDIR/info]--localedir=DIR locale-dependent data [DATAROOTDIR/locale]--mandir=DIR man documentation [DATAROOTDIR/man]--docdir=DIR documentation root [DATAROOTDIR/doc/libpqxx]--htmldir=DIR html documentation [DOCDIR]--dvidir=DIR dvi documentation [DOCDIR]--pdfdir=DIR pdf documentation [DOCDIR]--psdir=DIR ps documentation [DOCDIR]Program names:--program-prefix=PREFIX prepend PREFIX to installed program names--program-suffix=SUFFIX append SUFFIX to installed program names--program-transform-name=PROGRAM run sed PROGRAM on installed program namesSystem types:--build=BUILD configure for building on BUILD [guessed]--host=HOST cross-compile to build programs to run on HOST [BUILD]Optional Features:--disable-option-checking ignore unrecognized --enable/--with options--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)--enable-FEATURE[=ARG] include FEATURE [ARG=yes]--enable-dependency-trackingdo not reject slow dependency extractors--disable-dependency-trackingspeeds up one-time build--enable-silent-rules less verbose build output (undo: "make V=1")--disable-silent-rules verbose build output (undo: "make V=0")--enable-shared[=PKGS] build shared libraries [default=no]--enable-static[=PKGS] build static libraries [default=yes]--enable-fast-install[=PKGS]optimize for fast installation [default=yes]--disable-libtool-lock avoid locking (might break parallel builds)--enable-documentation Generate documentation--enable-maintainer-modeenable make rules and dependencies not useful (andsometimes confusing) to the casual installer--enable-poll System supports poll().Optional Packages:--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)--with-pic[=PKGS] try to use only PIC/non-PIC objects [default=useboth]--with-aix-soname=aix|svr4|bothshared library versioning (aka "SONAME") variant toprovide on AIX, [default=aix].--with-gnu-ld assume the C compiler uses GNU ld [default=no]--with-sysroot[=DIR] Search for dependent libraries within DIR (or thecompiler's sysroot if not specified).--with-postgres-include=DIRUse PostgreSQL includes from DIR. Defaults toquerying pg_config or pkg-config, whichever isavailable.--with-postgres-lib=DIR Use PostgreSQL libraries from DIR. Defaults toquerying pg_config.Some influential environment variables:CXX C++ compiler commandCXXFLAGS C++ compiler flagsLDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in anonstandard directory <lib dir>LIBS libraries to pass to the linker, e.g. -l<library>CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> ifyou have headers in a nonstandard directory <include dir>CC C compiler commandCFLAGS C compiler flagsLT_SYS_LIBRARY_PATHUser-defined run-time library search path.CPP C preprocessorCXXCPP C++ preprocessorDOXYGEN Path to doxygen needed to build reference documentationHAVE_DOT Variable used by doxygen to declare availibility of dotXMLTO Path to xmlto needed to build tutorial documentationUse these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.Report bugs to <Jeroen T. Vermeulen>.
编译配置
./configure --prefix=/opt/libpqxx --with-postgres-include=/opt/postgresql/include --with-postgres-lib=/opt/postgresql/lib
$ ./configure --prefix=/opt/libpqxx --with-postgres-include=/opt/postgresql/include --with-postgres-lib=/opt/postgresql/lib
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ supports C++11 features with -std=c++11... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports the include directive... yes (GNU style)
checking whether make supports nested variables... yes
checking dependency style of g++ -std=c++11... gcc3
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ -std=c++11 accepts -g... (cached) yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... g++ -std=c++11 -E
checking for ld used by g++ -std=c++11... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ -std=c++11 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ -std=c++11 option to produce PIC... -fPIC -DPIC
checking if g++ -std=c++11 PIC flag -fPIC -DPIC works... yes
checking if g++ -std=c++11 static flag -static works... yes
checking if g++ -std=c++11 supports -c -o file.o... yes
checking if g++ -std=c++11 supports -c -o file.o... (cached) yes
checking whether the g++ -std=c++11 linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether make sets $(MAKE)... (cached) yes
checking for mkdir... /bin/mkdir
checking for doxygen... no
checking for dot... no
checking for xmlto... no
checking whether to enable maintainer-specific portions of Makefiles... no
checking maintainer mode...
checking audit...
checking g++ visibility attribute... yes
checking whether the compiler supports function __attribute__((__const__))... yes
checking g++ deprecation attribute... yes
checking g++ pure attribute... yes
checking C++14 deprecation attribute... yes
checking for C++17 std::optional support... no
checking for experimental C++17 std::optional support... no
checking for C++17 charconv integer conversion... no
checking for C++17 charconv floating-point conversion... no
checking for poll(2)... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for pg_config... /usr/bin/pg_config
checking for pkg-config... /usr/bin/pkg-config
configure: using PostgreSQL headers at /opt/postgresql/include
configure: using PostgreSQL libraries at /opt/postgresql/lib
checking /opt/postgresql/include/libpq-fe.h usability... yes
checking /opt/postgresql/include/libpq-fe.h presence... yes
checking for /opt/postgresql/include/libpq-fe.h... yes
checking for ability to compile source files using libpq... yes
checking for PQexec in -lpq... yes
checking that type of libpq's Oid is as expected... yes
checking whether make sets $(MAKE)... (cached) yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/Makefile
config.status: creating doc/Makefile
config.status: creating doc/Doxyfile
config.status: creating src/Makefile
config.status: creating test/Makefile
config.status: creating test/unit/Makefile
config.status: creating tools/Makefile
config.status: creating win32/Makefile
config.status: creating include/Makefile
config.status: creating include/pqxx/Makefile
config.status: creating libpqxx.pc
config.status: creating include/pqxx/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing configitems commands
Generating b'/root/workspace/libpqxx-6.4.8/include/pqxx/config-internal-autotools.h': 7 item(s).
Generating b'/root/workspace/libpqxx-6.4.8/include/pqxx/config-internal-compiler.h': 5 item(s).
Generating b'/root/workspace/libpqxx-6.4.8/include/pqxx/config-public-autotools.h': no items--skipping.
Generating b'/root/workspace/libpqxx-6.4.8/include/pqxx/config-public-compiler.h': 4 item(s).
好像没有问题,
编译
make && make install
报错
*****************************************************xmlto not found.
Install it, or configure with --disable-documentation*****************************************************
Makefile:508: recipe for target 'tutorial-stamp' failed
make[1]: *** [tutorial-stamp] Error 1
make[1]: Leaving directory '/root/workspace/libpqxx-6.4.8/doc'
Makefile:641: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
CNM,configure时不报错,非得在编译时报错。
再编译
./configure --prefix=/opt/libpqxx --with-postgres-include=/opt/postgresql/include --with-postgres-lib=/opt/postgresql/lib --disable-documentation
make && make install
# root @ ubuntu in /opt/libpqxx [9:32:58]
$ tree -L 2
.
├── include
│ └── pqxx
└── lib├── libpqxx.a├── libpqxx.la└── pkgconfig
操了,没有动态库。make clean再来。
再再编译
make clean
./configure --prefix=/opt/libpqxx --with-postgres-include=/opt/postgresql/include --with-postgres-lib=/opt/postgresql/lib --disable-documentation --enable-shared=yes
make && make install
# root @ ubuntu in /opt/libpqxx [10:15:59]
$ tree -L 2
.
├── include
│ └── pqxx
└── lib├── libpqxx-6.4.so├── libpqxx.a├── libpqxx.la├── libpqxx.so -> libpqxx-6.4.so└── pkgconfig
看看依赖
先配置一下环境变量
export LD_LIBRARY_PATH=/opt/postgresql/lib;$LD_LIBRARY_PATH
# root @ ubuntu in /opt/libpqxx/lib [10:22:26]
$ ldd libpqxx.so linux-vdso.so.1 (0x00007ffea9739000)libpq.so.5 => /opt/postgresql/lib/libpq.so.5 (0x00007f2579620000)libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f2579297000)libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2578ea6000)/lib64/ld-linux-x86-64.so.2 (0x00007f2579acf000)libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f2578c8e000)libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2578a6f000)libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f25786d1000)
好像没有问题,收工
相关文章:

ubuntu下编译libpq和libpqxx库
ubuntu下编译libpq和libpqxx库,用于链接人大金仓 上篇文章验证了libpqxx可以链接人大金仓数据库,这篇文章尝试自己编译libpq和libpqxx库。 文章目录ubuntu下编译libpq和libpqxx库,用于链接人大金仓libpq下载libpq库看看有没有libpq库编译lib…...

ESP-C2系列模组开发板简介
C2是一个芯片采用4毫米x 4毫米封装,与272 kB内存。它运行框架,例如ESP-Jumpstart和ESP造雨者,同时它也运行ESP-IDF。ESP-IDF是Espressif面向嵌入式物联网设备的开源实时操作系统,受到了全球用户的信赖。它由支持Espressif以及所有…...

linux权限管理
权限管理 文件的权限针对三类对象进行定义: owner属主,缩写ugroup属组,缩写gother其他,缩写o 1、文件的一般权限 (1)r,w,x的作用及含义: 权限对文件影响对目录影响r(read…...

提高生活质量,增加学生对校园服务的需求,你知道有哪些?
随着电子商务平台利用移动互联网的趋势提高服务质量,越来越多的传统企业开始关注年轻大学生消费者的校园市场。 提高生活质量,增加学生对校园服务的需求 大学生越来越沉迷于用手机解决生活中的“吃、喝、玩、乐”等服务,如“吃、喝”——可…...

Antlr4:使用grun命令,触发NoClassDefFoundError
1. 意外的发现 在学习使用grun命令时,从未遇到过错误 最近使用grun命令,却遇到了NoClassDefFoundError的错误,使得grun测试工具无法成功启动 错误复现: 使用antlr4命令编译Hello.g4文件,并为指定package(…...

基于rootfs构建Docker镜像
1. 背景 在实际工作中,由于系统本身版本过低,在接受新项目时出现系统版本过低而无法开始工作的问题。 为了解决该问题,使用Docker构建基于ubuntu-18.04的Docker镜像,以解决版本兼容问题。 2. 构建rootfs 2.1. 下载ubuntu-18.0…...

电脑文件软件搬家迁移十大工具
10 大适用于 Windows 的数据迁移软件。 数据迁移至关重要,几乎所有组织都依赖于此。如果您认为数据传输不是一件容易的事,那么数据迁移软件可以帮上忙。 1、奇客电脑迁移 将现有操作系统、软件、文件迁移到 新电脑的最佳方法之一是使用名为奇客电脑迁移…...

【数据库】排名问题
返回第N高的一个解决思路返回N组中的第N高解决思路分数排名解决思路窗口函数数据库经常被用来解决排名问题。 返回第N高的一个 单表查询: 表: Employee------------------- | Column Name | Type | ------------------- | id | int | | salary | int | ----…...

【redis学习篇】主从哨兵集群架构详解
一、Redis主从架构 1.1 redis主从架构搭建 1、复制一份redis.conf文件 2、将相关配置修改为如下值: port 6380 pidfile /var/run/redis_6380.pid # 把pid进程号写入pidfile配置的文件 logfile "6380.log" dir /usr/local/redis-5.0.3/data/6380 # 指…...

基于jdk8的HashMap源码解析
hashMap常见面试题总览 为什么重写Equals还要重写HashCode方法?HashMap如何避免内存泄漏问题?HashMap1.7底层是如何实现的?HashMapKey为null存放在什么位置?HashMap如何解决Hash冲突问题?HashMap底层采用单链表还是双…...

深度学习J1周-ResNet50算法实战与解析_鸟类识别(CNN)
🍨 本文为[🔗365天深度学习训练营]内部限免文章(版权归 *K同学啊* 所有) 🍖 作者:[K同学啊] 本周任务: ●1.请根据本文 TensorFlow 代码(训练营内部阅读),编写…...

SpringBoot中一行代码解决字符串向枚举类型转换的问题
1. 场景 在WEB开发,客户端和服务端传输的数据中经常包含一些这样的字段:字段的值只包括几个固定的字符串。 这样的字段意味着我们需要在数据传输对象(Data Transfer Object, DTO)中对该字段进行校验以避免客户端传输的非法数据持…...

Praat之基频分析
Praat之基频分析 测量基频F0的方法 自相关 Autocorrelation(易出现pitch-halving\pitch-double)窄带谱图 Narrowband spectrogram(第一谐波就是基频)倒谱分析 Cepstral analysis测量声门波 glottal pluse(通过波形&a…...

乡村企业门户网站
技术:Java、JSP等摘要:随着时代的发展,电脑与Internet已经进入我们的生活。信息时代的来临,知识经济的扩张,网站已越来越靠近我们的生活。据CNNIC报告显示,中国上网用户有6800万。通过Internet来经营运作一…...

Deploy Workshop|DIY部署环境,让OceanBase跑起来
2023 年 3 月 25 日,我们将在北京开启首次 OceanBase 开发者大会,与开发者共同探讨单机分布式、云原生、HTAP 等数据库前沿趋势,分享全新的产品 Roadmap,交流场景探索和最佳实践,此外,OceanBase 开源技术全…...

【CPP】定义一个类
一:当实现一个类的时候,编译器都做了什么 前言:当我们实现一个类的时候,编译器为我们做了什么;在对类进行操作的时候,有哪些特殊的成员函数可以帮助我们更好的操纵类; class A {A();//默认构造…...

谷歌广告投放步骤流程是什么?一文带你全方位了解实操细节
谷歌,大家都不陌生吧,一个人们很常用的搜索引擎。而谷歌还可以打广告,即谷歌广告,那这跟跨境电商有什么关心呢?东哥告诉大家,关系大了去了,毕竟如果用户搜索与我们相关的关键词,就有…...

TypeScript 怎么去查找类型定义的?
TypeScript 怎么去查找类型定义的?类型文件分类第三方库的类型自定义类型结论类型文件分类 我们项目中的类型文件分为两种:一类是第三方库的类型,一类是在项目中的自定义类型。 第三方库的类型 (1)Jquery࿱…...

NPM包管理器
文章目录一、NPM包管理器1、简介2、安装NPM3、使用npm管理项目3.1项目初始化3.2修改npm镜像3.3 npm install命令的使用3.4其它命令一、NPM包管理器 1、简介 什么是NPM NPM全称Node Package Manager,是Node.js包管理工具,是全球最大的模块生态系统&…...

IT英语记录
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录前言1、Classification2、Logistic Regression3、网络相关3.1 WAN(Wide Area Network)、LAN(Local Area Network)网络…...

SRS4.0 源码分析- RTC模块相关类
前言 本文介绍SRS4.0涉及RTC模块的C类,主要包括RTC Server和Session相关的。 SrsGoApiRtcPlay 处理webrtc client的播放请求,解析client的offer,并且生成server的answer,并且为这次请求创建一个session。SrsRtcServer 监听udp端…...

数位DP
数位dp的题目一般会问,某个区间内,满足某种性质的数的个数。 利用前缀和,比如求区间[l,r]中的个数,转化成求[0,r]的个数 [0,l-1]的个数。利用树的结构来考虑(按位分类讨论) 1081. 度的数量 #include<…...

剑指offer(一)-链表
(一)找出链表的环的入口结点 JZ23 链表中环的入口结点 中等 通过率:36.78% 时间限制:1秒 空间限制:64M 知识点链表哈希双指针 描述 给一个长度为n链表,若其中包含环,请找出该链表的环的入口结点…...

CDH大数据平台入门篇之搭建与部署
一、CDH介绍 1.CDH 是一个强大的商业版数据中心管理工具 提供了各种能够快速稳定运行的数据计算框架,如Spark; 使用Apache Impala做为对HDFS、HBase的高性能SQL查询引擎; 使用Hive数据仓库工具帮助用户分析数据; 提供CM安装HBas…...

Spark Join
Spark Join关联形式内关联外关联左外关联右外关联全外关联左半/逆关联关联机制NLJSMJHJ分发模式Join 选择等值 Join不等值 JoinJoin 按照关联形式(Join Types)划分 : 内关联、外关联、左关联、右关联 Join 按实现机制划分 : NLJ (Nested Loop Join) 、S…...

数字的转化规则?
数字的转化规则?js将字符串转换为数字的方式有哪些?1. 使用 parseInt()2. 使用 Number()3. 使用一元运算符 ()4.使用parseFloat()5. 使用 Math.floor()和Math.ceil()6.乘以数字7. 双波浪号 (~~) 运算符其它值到数字的转化规则1.Undefined 类型2.Null 类型…...

MySQL面试题-锁相关
目录 1.MySQL 锁的类型有哪些呢? 2.如何使用全局锁 3.如果要全库只读,为什么不使用set global readonlytrue的方式? 4.表级锁和行级锁有什么区别? 5.行级锁的使用有什么注意事项? 6.InnoDB 有哪几类行锁ÿ…...

Windows 终端编译 C代码
E:\My_SoftWare\Window gcc\windowbianji\mingw64\bin 此电脑--》属性--》系统--》高级系统设置--》环境变量--》Path--》新建--》粘贴路径 E:\My_SoftWare\Window gcc\windowbianji\mingw64\bin 打开命令终端 E: 回车 dir 显示所有文件 cd E:\My_SoftWare\Window gcc\C_co…...

SpringCloud:Feign的使用及配置
目录 Feign的使用及配置 1、Feign替代RestTemplate 2、使用Fegin步骤 3、自定义配置 4、Feign使用优化 5、Feign的最佳实践方式 Feign的使用及配置 1、Feign替代RestTemplate RestTemplate方式远程调用的问题 问题: 1、代码可读性差,编程体验不同…...

Parquet学习与使用之BloomFilter的应用
写在前面 最近在自己做自定义的OLAP系统,文件格式上用的是Parquet,但是发现Parquet各个API的示例代码很少。所以就打算把这个系列的文章写一下。 1. Parquet的Filter Parquet的过滤支持两大类,一类是基于Footer中的元数据进行RowGroup级别…...