Oracle Solaris 11 - python3 インストール - gcc をインストールしてみる

クラウディア 
1. gcc をインストールしてみる
2. 当初のコマンドを再試行してみる
3. complier を探してみる
4. gcc で make してみる

1. gcc をインストールしてみる

 今までの試行で、何をやってもだめだったので gcc を pkg コマンドでインストールしてみます。

$ pkg install gcc
   インストールするパッケージ:        18
            変更するメディエータ:         1
                  変更するサービス:         1
                  ブート環境の作成: いいえ
バックアップブート環境の作成: いいえ

ダウンロード                 パッケージ  ファイル  転送 (MB)  速度
完了                                 18/18     2944/2944    66.2/66.2  537k/s

フェーズ                                  項目
新しいアクションをインストールしています   3515/3515
パッケージ状態データベースを更新しています      完了
パッケージキャッシュを更新しています         0/0
イメージ状態を更新しています      完了
スピード検索データベースを作成しています      完了
パッケージキャッシュを更新しています         1/1
 はじめて思い通りに動作したような気がします。  gcc のバージョンのみ確認。

$ gcc --version
gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2. 当初のコマンドを再試行してみる

 違うんだろうなぁと思いつつ当初のコマンドを再試行してみます。

$ mkdir  /tmp/python
$ cd /tmp/python/
$ curl -O https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 21.8M  100 21.8M    0     0  1092k      0  0:00:20  0:00:20 --:--:-- 1219k
$ gunzip Python-3.6.6.tgz
$ tar xvf Python-3.6.6.tar
$ ./configure --without-gcc --prefix=$HOME/bin
checking build system type... i386-pc-solaris2.11
checking host system type... i386-pc-solaris2.11
checking for python3.6... no
checking for python3... no
checking for python... python
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... sunos5
checking for --without-gcc... yes
checking for --with-icc... no
checking for gcc... cc
checking whether the C compiler works... no
configure: error: in `/tmp/python/Python-3.6.6':
configure: error: C compiler cannot create executables
See `config.log' for more details
 結局、gcc じゃだめなんだろうなぁ。  compiler を pkg で検索してみます。

3. compiler を探してみる

 pkg コマンドで complier を探してみます。

$ pkg search compiler
INDEX                       ACTION VALUE                                                       PACKAGE
basename                    dir    usr/lib/python2.6/vendor-packages/Pyrex/Compiler            pkg:/library/python-2/python-extra-26@2.6.4-0.175.3.0.0.26.0
basename                    dir    usr/lib/python2.7/vendor-packages/Pyrex/Compiler            pkg:/library/python/python-extra-27@2.7-0.175.3.0.0.26.0
com.oracle.info.description set    the GNU Compiler Collection                                 pkg:/system/library/gcc-3-runtime@3.4.3-0.175.3.0.0.30.0

・・・略・・・

basename                    file   usr/lib/sparcv9/R/library/compiler/R/compiler                                                                                                                                                                                                                                                                                                                                                  pkg:/library/r/r-cran-compiler@3.2.0-5.12.0.0.0.90.0
basename                    file   usr/lib/sparcv9/R/library/compiler/R/compiler                                                                                                                                                                                                                                                                                                                                                  pkg:/library/r/r-cran-compiler@3.2.3-5.12.0.0.0.95.0
basename                    file   usr/lib/amd64/R/library/compiler/R/compiler                                                                                                                                                                                                                                                                                                                                                    pkg:/library/r/r-cran-compiler@3.2.3-5.12.0.0.0.95.0

4. gcc で make してみる

 結局、それ風のものがないので、--without-gcc のオプションをはずしてみます。

$ cd /tmp/python/Python-3.6.6
$ ./configure --prefix=$HOME/bin
checking build system type... i386-pc-solaris2.11
checking host system type... i386-pc-solaris2.11
checking for python3.6... no
checking for python3... no
checking for python... python
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... sunos5
checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... gcc
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 gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/ggrep
checking for a sed that does not truncate output... /usr/bin/gsed
checking for --with-cxx-main=<compiler>... no
checking for g++... no
configure:

  By default, distutils will build C++ extension modules with "g++".
  If this is not intended, then set CXX on the configure command line.

checking for the platform triplet based on compiler characteristics... none

・・・略・・・

config.status: creating Makefile.pre
config.status: creating Modules/Setup.config
config.status: creating Misc/python.pc
config.status: creating Misc/python-config.sh
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
creating Modules/Setup
creating Modules/Setup.local
creating Makefile


If you want a release build with all stable optimizations active (PGO, etc),
please run ./configure --enable-optimizations
 最後のは optimiz しろってことかな・・・。

$ make install
gcc -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers   -I. -I./Include    -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c
gcc -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers   -I. -I./Include    -DPy_BUILD_CORE -o Parser/acceler.o Parser/acceler.c

・・・略・・・

f test "x" != "x" ; then \
        rm -f /export/home/hogehoge/bin/bin/python3-32; \
        (cd /export/home/hogehoge/bin/bin; ln -s python3.6-32 python3-32) \
fi
rm -f /export/home/hogehoge/bin/share/man/man1/python3.1
(cd /export/home/hogehoge/bin/share/man/man1; ln -s python3.6.1 python3.1)
if test "xupgrade" != "xno"  ; then \
        case upgrade in \
                upgrade) ensurepip="--upgrade" ;; \
                install|*) ensurepip="" ;; \
        esac; \
         ./python -E -m ensurepip \
                $ensurepip --root=/ ; \
fi
The directory '/export/home/hogehoge/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/export/home/hogehoge/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Looking in links: /tmp/tmpf4bq4dbj
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-10.0.1 setuptools-39.0.1
 Successfully って出てるから「pip-10.0.1 setuptools-39.0.1」がインストールされたってこと?  一応この結果

$ cd $HOME/bin
$ ls
bin      include  lib      share
$ ls bin
2to3               idle3              pip3.6             python3            python3.6-config   pyvenv
2to3-3.6           idle3.6            pydoc3             python3-config     python3.6m         pyvenv-3.6
easy_install-3.6   pip3               pydoc3.6           python3.6          python3.6m-config
$ $HOME/bin/bin/python3.6 --version
Python 3.6.6
 てなことで、うまく make できたんでしょう。  しかしまぁ、参考サイトの通りにやるのは実用的ではありませんな。
earthcar(アースカー)