問題の説明
Solaris Studio 12.3 を使用して、Solaris 10 で libpqxx-4.0.1 をコンパイルできません。
バックグラウンド
libpqxx が必要になったときに私が最初にしたことは、 を使用して OpenCSW で検索することでした/opt/csw/bin/pkgutil -a libpqxx
。ただし、OpenCSW のパッケージはバージョン「5.0,REV=2012.05.06」としてリストされて
おり、OpenCSW Web サイトのCSWlibpqxx5-0を見ると、これが古くて不安定なスナップショットであることが示されているようです。安定版が欲しいです。
libpqxx Web サイトから libpqxx-4.0.1.tar.gz をダウンロードしてコンパイルしました。g++
私はそれと他のツールを持っていたので、それはでコンパイルされました$PATH
。出来た。すべてが順調に進んでいました。SELECT
データベースなどからできました。
次に、コードにとって最も重要な段階に到達しました。独自の C++ API と通信します。g++
この API のライブラリへのリンクを試みた後、私のコードは でコンパイルできなくなりました。API には、私が以前に を使用してコンパイルした例が含まれていCC
ます。例は、 を使用してコンパイルされません
g++
。CC
を使用する代わりに、 を使用してコードをコンパイルする必要があると考えましたg++
。私のコードは、を使用してコンパイルされませんでしCC
た。g++
コンパイルされた libpqxx-4.0.1 にCC
は気に入らないものがありました。
CC
したがって、を使用する代わりに、も使用して libpqxx-4.0.1 をコンパイルする必要があると判断し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
Solaris 10の Python 2.4.6/usr/bin/python
はスクリプトに問題があったため、迅速で汚いパッチを適用しました。
-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
from/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