尝试使用 Oracle Solaris Studio 12.3 在 Solaris 10 上编译 libpqxx-4.0



问题描述

我无法使用 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"并查看CSWlibpqxx5-0 on the OpenCSW网站似乎表明这是一个旧的、不稳定的快照。我想要稳定版本。

我从libpqxx网站下载了libpqxx-4.0.1.tar.gz并对其进行了编译。它是用g++编译的,因为我$PATH里有它和其他工具。成功了。一切都进展顺利。我能够SELECT从我的数据库等。

然后我进入了对我的代码最重要的阶段;沟通具有专有的C++ API。在我之后,我的代码将不再使用 g++ 编译尝试链接到此 API 的库。该 API 包括示例我以前使用 CC 编译的.这些示例不使用 g++ .我想我也必须使用 CC 编译我的代码,而不是使用g++ .我的代码无法使用CC进行编译。有东西g++编译了CC不喜欢的libpqxx-4.0.1。

因此,我决定我也需要使用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

Python 2.4.6,Solaris 10 中的/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 %sn
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

我是如何让libpqxx构建的

清理上次尝试的混乱

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

的开发版本编写的,但它们使用gpatch(从OpenCSW安装(干净地应用于libpqxx-4.0.1。这些补丁是在 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"(。我使用的两个补丁都来自OpenCSW的修订版17955。

/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

(由于某种原因,文档已构建但未安装。不过,这只是一个小问题。

相关内容

  • 没有找到相关文章

最新更新