Ошибка при попытке скомпилировать libpqxx-4.0.1 в Solaris 10 с использованием Oracle Solaris Studio 12.3

Я не могу скомпилировать libpqxx-4.0.1 на Solaris 10 с помощью Solaris Studio 12.3.

Первое, что я сделал, когда мне понадобился libpqxx, — это поиск в OpenCSW.
с помощью /opt/csw/bin/pkgutil -a libpqxx, Тем не менее, пакет в OpenCSW
указан как версия «5.0, REV = 2012.05.06» и смотрит на
CSWlibpqxx5-0 на OpenCSW
веб-сайт указывает на то, что это старый нестабильный снимок. мне бы хотелось
стабильная версия.

Я скачал libpqxx-4.0.1.tar.gz с веб-сайта libpqxx и скомпилировал его.
Было скомпилировано с g++ так как у меня было это и другие инструменты в моем $PATH,
Это сработало. Все шло хорошо. я мог SELECT от моего
база данных и тд.

Затем я добрался до стадии, которая была наиболее важной для моего кода; общаться
с проприетарным C ++ API. Мой код больше не будет компилироваться с g++ после того как я
попытался связаться с библиотеками для этого API. API включает в себя примеры
который я ранее скомпилировал с помощью CC, Примеры не компилируются с использованием
g++, Я решил, что мне придется скомпилировать мой код, используя CC а вместо
использования g++, Мой код не будет компилироваться с использованием CC, Было что-то с
g++ скомпилировал libpqxx-4.0.1, что CC не нравится.

Таким образом, я решил, что мне нужно скомпилировать libpqxx-4.0.1, используя CC также вместо
использования g++,

Устранить проблемы, вызванные потенциально неправильно настроенной средой
(Я использую свою учетную запись в системе с 2012 года и с течением времени,
различные переменные среды и тому подобное),
Я создал нового пользователя в системе с чистым домашним каталогом.

Ниже приведена расшифровка того, что я сделал дальше, что привело к ошибке сборки.

-bash-3.2$ pwd

/var/tmp/build

-bash-3.2$ ls -al

total 3506
drwxr-xr-x   3 build    build          6 Oct 22 13:23 .
drwxrwxrwt  45 root     sys          601 Oct 22 13:22 ..
-rw-------   1 build    build          0 Oct 22 13:23 .bash_history
drwxr-xr-x   2 build    build          2 Oct 22 12:57 install_test
-rw-r--r--   1 build    build    1582532 Oct 22 12:54 libpqxx-4.0.1.tar.gz
-rwxr-xr-x   1 build    build       4924 Oct 22 13:02 splitconfig

-bash-3.2$ /usr/sfw/bin/gtar xf libpqxx-4.0.1.tar.gz

Python 2.4.6, /usr/bin/python в солярисе 10 были проблемы со скриптом так
Я сделал быстрый и грязный патч.

-bash-3.2$ diff libpqxx-4.0.1/tools/splitconfig splitconfig

1c1
< #! /usr/bin/python
---
> #! /opt/csw/bin/python2.7

-bash-3.2$ cp splitconfig libpqxx-4.0.1/tools/

мой $PATH на данный момент только /usr/bin,

-bash-3.2$ echo $PATH

/usr/bin:

я нуждаюсь ld, Найдено в /usr/ccs/bin,

-bash-3.2$ export PATH=$PATH:/usr/ccs/bin

CC из Oracle Solaris Studio 12.3.
(См. Подробности под заголовком Дополнительная информация.)

-bash-3.2$ which CC

/usr/bin/CC

-bash-3.2$ cd libpqxx-4.0.1

-bash-3.2$ ./configure --prefix=/var/tmp/build/install_test --enable-shared --enable-documentation

checking for a BSD-compatible install... config/install-sh -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... yes
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... CC
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... no
checking whether CC accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of CC... none
checking for gcc... no
checking for cc... cc
checking whether we are using the GNU C compiler... no
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking dependency style of cc... none
checking build system type... i386-pc-solaris2.10
checking host system type... i386-pc-solaris2.10
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/xpg4/bin/grep
checking for egrep... /usr/xpg4/bin/grep -E
checking for fgrep... /usr/xpg4/bin/grep -F
checking for non-GNU ld... /usr/ccs/bin/ld
checking if the linker (/usr/ccs/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/ccs/bin/nm -p
checking the name lister (/usr/ccs/bin/nm -p) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786240
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i386-pc-solaris2.10 file names to i386-pc-solaris2.10 format... func_convert_file_noop
checking how to convert i386-pc-solaris2.10 file names to toolchain format... func_convert_file_noop
checking for /usr/ccs/bin/ld option to reload object files... -r
checking for objdump... no
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... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/ccs/bin/nm -p output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... cc -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 for cc option to produce PIC... -KPIC -DPIC
checking if cc PIC flag -KPIC -DPIC works... yes
checking if cc static flag -Bstatic works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/ccs/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... solaris2.10 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... no
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking how to run the C++ preprocessor... CC -E
checking whether the CC linker (/usr/ccs/bin/ld) supports shared libraries... yes
checking for CC option to produce PIC... -KPIC -DPIC
checking if CC PIC flag -KPIC -DPIC works... yes
checking if CC static flag -Bstatic works... yes
checking if CC supports -c -o file.o... yes
checking if CC supports -c -o file.o... (cached) yes
checking whether the CC linker (/usr/ccs/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... solaris2.10 ld.so
checking how to hardcode library paths into programs... immediate
checking whether make sets $(MAKE)... (cached) yes
checking for mkdir... /usr/bin/mkdir
checking for pkg-config... /usr/bin/pkg-config
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 name of standard library namespace (normally "std")... ::std
checking boost/smart_ptr.hpp usability... no
checking boost/smart_ptr.hpp presence... no
checking for boost/smart_ptr.hpp... no
checking whether TR1 headers live in tr1 directory... no
checking namespace of TR1 extension to the C++ standard... std
checking ios usability... yes
checking ios presence... yes
checking for ios... yes
checking streambuf usability... yes
checking streambuf presence... yes
checking for streambuf... yes
checking locale usability... yes
checking locale presence... yes
checking for locale... yes
checking locale function and stringstream::imbue... yes
checking char_traits template... yes
checking "warning" preprocessor directive... yes
checking "message" preprocessor pragma... yes
checking for pg_config... /usr/bin/pg_config
configure: using PostgreSQL headers at /usr/include/pgsql
configure: using PostgreSQL libraries at /usr/lib
checking for ANSI C header files... (cached) yes
checking ability to compile programs using the standard C library... yes
checking for library containing select... none required
checking /usr/include/pgsql/libpq-fe.h usability... yes
checking /usr/include/pgsql/libpq-fe.h presence... yes
checking for /usr/include/pgsql/libpq-fe.h... yes
checking for ability to compile source files using libpq... yes
checking for main in -lpq... yes
checking for PQexec in -lpq... yes
checking for correct C++ linkage of basic libpq functions... yes
checking that type of libpq's Oid is as expected... yes
checking lo_tell()... yes
checking for strerror_r... no
configure: WARNING:
No definition of strerror_r, the thread-safe version of strerror(), was found in
your <cstring> header.

This may be because your implementation strerror() is threadsafe, in which case
there is nothing to worry about.

checking for strnlen... no
checking for strlcpy... no
checking for long long... yes
checking for long double... yes
checking for working <sys/select.h>... yes
checking for poll()... yes
checking for working fd_set... yes
checking if select() accepts NULL fdsets... yes
checking sleep()... yes
checking PQisthreadsafe()... no
checking PQescapeLiteral()... no
checking support for hex binary escaping format... no
checking PQescapeIdentifier()... pqescapeidentifier
checking PQencryptPassword()... no
checking PQmblen()... yes
checking PQdescribePortal()... no
checking PQclientEncoding()... yes
checking PQcancel()... yes
checking limits usability... yes
checking limits presence... yes
checking for limits... yes
checking for C99 isnan()... no
checking for std::numeric_limits<>::quiet_NaN()... yes
checking for C NAN macro... no
checking for C99 nan() family... no
checking for C99 isinf()... no
checking whether std::string has a clear() function... yes
checking for standard distance()... no
checking if count_if() works as expected... no
checking whether <iterator> defines a usable iterator template... yes
checking for reverse_iterator template... no
checking for auto_ptr... yes
checking for tr1::shared_ptr... no
checking for unique_ptr... no
checking for move()... no
checking whether overloaded using-declarations work... yes
checking whether make sets $(MAKE)... (cached) yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config/Makefile
config.status: creating debian/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 pqxx-config
config.status: creating libpqxx.spec
config.status: creating include/pqxx/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing configitems commands
Generating include/pqxx/config-internal-autotools.h: 7 item(s).
Generating include/pqxx/config-internal-compiler.h: 10 item(s).
Generating include/pqxx/config-internal-libpq.h: 4 item(s).
Generating include/pqxx/config-public-autotools.h: no items--skipping.
Generating include/pqxx/config-public-compiler.h: 11 item(s).
Generating include/pqxx/config-public-libpq.h: no items--skipping.

make от /usr/ccs/bin не смог построить его раньше, так что теперь я пытаюсь использовать
dmake от Oracle Solaris Studio 12.3.

-bash-3.2$ which make

/usr/ccs/bin/make

-bash-3.2$ which dmake

/usr/bin/dmake

-bash-3.2$ dmake

dmake: defaulting to parallel mode.
See the man page dmake(1) for more information on setting up the .dmakerc file.
Making all in include
Making all in pqxx
dmake  all-am
Making all in src
develop --> 1 job
source='binarystring.cxx' object='binarystring.lo' libtool=yes \
DEPDIR=.deps depmode=none /bin/bash ../config/depcomp \
/bin/bash ../libtool --tag=CXX    --mode=compile CC -DHAVE_CONFIG_H  -I../include -I../include -I/usr/include/pgsql     -g -c -o binarystring.lo binarystring.cxx
develop --> 2 jobs
source='connection_base.cxx' object='connection_base.lo' libtool=yes \
DEPDIR=.deps depmode=none /bin/bash ../config/depcomp \
/bin/bash ../libtool --tag=CXX    --mode=compile CC -DHAVE_CONFIG_H  -I../include -I../include -I/usr/include/pgsql     -g -c -o connection_base.lo connection_base.cxx
develop --> Job output
source='connection_base.cxx' object='connection_base.lo' libtool=yes \
DEPDIR=.deps depmode=none /bin/bash ../config/depcomp \
/bin/bash ../libtool --tag=CXX    --mode=compile CC -DHAVE_CONFIG_H  -I../include -I../include -I/usr/include/pgsql     -g -c -o connection_base.lo connection_base.cxx
libtool: compile:  CC -DHAVE_CONFIG_H -I../include -I../include -I/usr/include/pgsql -g -c connection_base.cxx  -KPIC -DPIC -o .libs/connection_base.o
"connection_base.cxx", line 480: Error: Cannot use std::__reverse_bi_iterator<std::list<pqxx::errorhandler*>::iterator, std::bidirectional_iterator_tag, pqxx::errorhandler*, pqxx::errorhandler*&, pqxx::errorhandler**, int> to initialize const std::__reverse_bi_iterator<std::list<pqxx::errorhandler*>::const_iterator, std::bidirectional_iterator_tag, pqxx::errorhandler*, pqxx::errorhandler*const&, pqxx::errorhandler*const*, int>.
"connection_base.cxx", line 481: Error: Cannot use std::__reverse_bi_iterator<std::list<pqxx::errorhandler*>::iterator, std::bidirectional_iterator_tag, pqxx::errorhandler*, pqxx::errorhandler*&, pqxx::errorhandler**, int> to initialize const std::__reverse_bi_iterator<std::list<pqxx::errorhandler*>::const_iterator, std::bidirectional_iterator_tag, pqxx::errorhandler*, pqxx::errorhandler*const&, pqxx::errorhandler*const*, int>.
"connection_base.cxx", line 1001: Error: Cannot use std::__reverse_bi_iterator<std::list<pqxx::errorhandler*>::iterator, std::bidirectional_iterator_tag, pqxx::errorhandler*, pqxx::errorhandler*&, pqxx::errorhandler**, int> to initialize const std::__reverse_bi_iterator<std::list<pqxx::errorhandler*>::const_iterator, std::bidirectional_iterator_tag, pqxx::errorhandler*, pqxx::errorhandler*const&, pqxx::errorhandler*const*, int>.
"connection_base.cxx", line 1002: Error: Cannot use std::__reverse_bi_iterator<std::list<pqxx::errorhandler*>::iterator, std::bidirectional_iterator_tag, pqxx::errorhandler*, pqxx::errorhandler*&, pqxx::errorhandler**, int> to initialize const std::__reverse_bi_iterator<std::list<pqxx::errorhandler*>::const_iterator, std::bidirectional_iterator_tag, pqxx::errorhandler*, pqxx::errorhandler*const&, pqxx::errorhandler*const*, int>.
4 Error(s) detected.
*** Error code 1
dmake: Fatal error: Command failed for target `connection_base.lo'
Current working directory /var/tmp/build/libpqxx-4.0.1/src
Waiting for 1 job to finish
develop --> Job output
source='binarystring.cxx' object='binarystring.lo' libtool=yes \
DEPDIR=.deps depmode=none /bin/bash ../config/depcomp \
/bin/bash ../libtool --tag=CXX    --mode=compile CC -DHAVE_CONFIG_H  -I../include -I../include -I/usr/include/pgsql     -g -c -o binarystring.lo binarystring.cxx
libtool: compile:  CC -DHAVE_CONFIG_H -I../include -I../include -I/usr/include/pgsql -g -c binarystring.cxx  -KPIC -DPIC -o .libs/binarystring.o
libtool: compile:  CC -DHAVE_CONFIG_H -I../include -I../include -I/usr/include/pgsql -g -c binarystring.cxx -o binarystring.o >/dev/null 2>&1
*** Error code 1
The following command caused the error:
fail= failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
case $f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='include src test tools win32 config debian doc'; for subdir in $list; do \
echo "Making $target in $subdir"; \
if test "$subdir" = "."; then \
dot_seen=yes; \
local_target="$target-am"; \
else \
local_target="$target"; \
fi; \
(CDPATH="${ZSH_VERSION+.}:" && cd $subdir && dmake  $local_target) \
|| eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
dmake  "$target-am" || exit 1; \
fi; test -z "$fail"dmake: Fatal error: Command failed for target `all-recursive'

Дополнительная информация

-bash-3.2$ cat /etc/release

                      Solaris 10 10/09 s10x_u8wos_08a X86
Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
Use is subject to license terms.
Assembled 16 September 2009

-bash-3.2$ /usr/bin/version

Solaris Studio version tool
Usage: version <file> ...        # show version string in one or more binaries
version -p <command> ...  # look command(s) on PATH and show version
To see a list of the Studio components installed on your system, use
the package command that is appropriate for your system.
To see which package contains the cc binary use commands like this:
On Solaris 10 : pkgchk -l -p /path/to/.../bin/cc
On Solaris 11 : pkg search -lp /path/to/.../bin/cc
On Linux      : rpm -qf /path/to/.../bin/cc
To see which Studio packages are installed on the system:
On Solaris 10 : pkginfo | grep SPRO
On Solaris 11 : pkg list | grep -i studio
On Linux      : rpm -qa | grep solstudio | head

-bash-3.2$ pkgchk -l -p /usr/bin/CC

-bash: pkgchk: command not found

-bash-3.2$ pkginfo | grep SPRO

application SPRO-12-3-analyzer               Performance Analyzer (including collect, analyzer, er_print, ...)
application SPRO-12-3-backend                Compiler Common Files
application SPRO-12-3-c++                    C++ Compilers
application SPRO-12-3-c++-libs               C++ dynamic libraries
application SPRO-12-3-cc                     C Compiler
application SPRO-12-3-code-analyzer          Oracle Solaris Studio Code Analyzer Tool
application SPRO-12-3-dbx                    Dbx Debugging Tools
application SPRO-12-3-dbxtool                Dbxtool standalone debugger GUI
application SPRO-12-3-dlight                 DLight Observability Tool
application SPRO-12-3-dmake                  Building Software including Distributed Make (dmake)
application SPRO-12-3-f90-libs               Fortran dynamic libraries
application SPRO-12-3-fortran                Fortran Compiler
application SPRO-12-3-math-libs              math libraries
application SPRO-12-3-oic                    Oracle Instant Client 11.2.0.2.0
application SPRO-12-3-oic-libs               Oracle Instant Client 11.2.0.2.0 Runtime
application SPRO-12-3-perflib                Performance Library
application SPRO-12-3-studio-bin-links       Oracle Solaris Studio /usr symlinks and icon
application SPRO-12-3-studio-common          Common internal components needed by components of the Oracle Solaris Studio product
application SPRO-12-3-studio-ide             Integrated Development Environment for C, C++, and Fortran
application SPRO-12-3-studio-ja              Solaris Studio Japanese localization
application SPRO-12-3-studio-legal           Legal files for the Solaris Studio product
application SPRO-12-3-studio-zhCN            Solaris Studio Simplified Chinese localization

3

Решение

Убрать беспорядок с предыдущей попытки

rm -rf install_test/

rm -rf libpqxx-4.0.1/

Выйти из системы, войти в систему, установить $PATH,

export PATH=/usr/bin:/usr/ccs/bin

Создать установочный тестовый каталог, распаковать архив libpqxx, перейти в извлеченный каталог

mkdir install_test/

/usr/sfw/bin/gtar xf libpqxx-4.0.1.tar.gz

cd libpqxx-4.0.1/

Применить патчи

Мой

cat ../splitconfig.diff

1c1
< #! /usr/bin/python
---
> #! /opt/csw/bin/python2.7

patch -i ../splitconfig.diff tools/splitconfig

  Looks like a normal diff.
done

Патчи от OpenCSW

Эти два патча были написаны для разрабатываемой версии libpqxx, но они применяются чисто к libpqxx-4.0.1 с использованием gpatch (устанавливается из OpenCSW). Патчи были найдены на https://buildfarm.opencsw.org/source/xref/opencsw/csw/mgar/pkg/libpqxx/trunk/files/0001-Can-t-instantiate-a-const-iterator-from-non-const.patch а также https://buildfarm.opencsw.org/source/xref/opencsw/csw/mgar/pkg/libpqxx/trunk/files/0002-Don-t-test-for-reverse-iters-if-they-re-not- there.patch с помощью https://buildfarm.opencsw.org/source/xref/opencsw/csw/mgar/pkg/libpqxx/trunk/Makefile с помощью http://www.opencsw.org/package/libpqxx5_0/ (ссылка называется «OpenGrok»). Оба патча, которые я использовал, были из ревизии 17955 OpenCSW.

/opt/csw/bin/gpatch src/connection_base.cxx ../0001-Can-t-instantiate-a-const-iterator-from-non-const.patch

patching file src/connection_base.cxx
Hunk #1 succeeded at 476 with fuzz 1.
Hunk #2 succeeded at 997 (offset -2 lines).

/opt/csw/bin/gpatch test/unit/test_binarystring.cxx ../0002-Don-t-test-for-reverse-iters-if-they-re-not-there.patch

patching file test/unit/test_binarystring.cxx

Настройте и сделайте, сделайте установку

CXXFLAGS="-library=stlport4" ./configure --prefix=/var/tmp/build/install_test --enable-shared=yes --enable-static=no --enable-documentation=yes

make

make install

(Документация, по какой-то причине, собрана, но не установлена. Однако это небольшая проблема.)

0

Другие решения


По вопросам рекламы [email protected]