読者です 読者をやめる 読者になる 読者になる

CentOS 6.4で32bit環境の整備(SQLite3も含む)

sqlite3のライブラリを含んだプログラムを32bitでコンパイルする環境を整備。もともとテストマシンは64bitなので32bit関連はインストールされていない。そのためコンパイルがまともに通らない。
sqlite3の32bit版も必要だが、gcc関連も32bitの環境を整備してあげる必要がある。

$ cc -m32 -g -Wall -o sample32 sample32.c -lsqlite3
/usr/include/features.h:385 から include されたファイル中,
                 /usr/include/stdio.h:28 から,
                 sample32.c:7 から:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: そのようなファイルやディレクトリはありません
$

ヘッダがないんだって。で

http://masahir0y.blogspot.jp/2012/01/androidpc2.html

を参考にyum whatprovidesで調べてみた。

$ yum whatprovides */stubs-32.h
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
nginx/filelists_db                                       |  10 kB     00:00     
updates/filelists_db                                     | 1.5 MB     00:00     
glibc-devel-2.12-1.132.el6.i686 : Object files for development using standard C
                                : libraries.
Repo        : base
Matched from:
Filename    : /usr/include/gnu/stubs-32.h



$ rpm -qa | grep glibc-devel
glibc-devel-2.12-1.132.el6.x86_64
$

このglibc-devel.i686に含まれているということようだ。やはり32bitのglibcというのが必要のようだ。なので関連ファイルも含めインストール。

$ su
パスワード:
# yum install glibc-devel.i686
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirror.nus.edu.sg
 * extras: mirror.nus.edu.sg
 * updates: mirror.nus.edu.sg
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package glibc-devel.i686 0:2.12-1.132.el6 will be installed
--> Processing Dependency: libutil.so.1 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libthread_db.so.1 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: librt.so.1 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libresolv.so.2 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libnss_nisplus.so.2 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libnss_nis.so.2 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libnss_hesiod.so.2 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libnss_files.so.2 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libnss_dns.so.2 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libnss_compat.so.2 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libnsl.so.1 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libm.so.6 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libdl.so.2 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libcrypt.so.1 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libcidn.so.1 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libanl.so.1 for package: glibc-devel-2.12-1.132.el6.i686
--> Processing Dependency: libBrokenLocale.so.1 for package: glibc-devel-2.12-1.132.el6.i686
--> Running transaction check
---> Package glibc.i686 0:2.12-1.132.el6 will be installed
--> Processing Dependency: libfreebl3.so(NSSRAWHASH_3.12.3) for package: glibc-2.12-1.132.el6.i686
--> Processing Dependency: libfreebl3.so for package: glibc-2.12-1.132.el6.i686
--> Running transaction check
---> Package nss-softokn-freebl.x86_64 0:3.12.9-11.el6 will be updated
--> Processing Dependency: nss-softokn-freebl(x86-64) = 3.12.9-11.el6 for package: nss-softokn-freebl-devel-3.12.9-11.el6.x86_64
---> Package nss-softokn-freebl.i686 0:3.14.3-9.el6 will be installed
---> Package nss-softokn-freebl.x86_64 0:3.14.3-9.el6 will be an update
--> Running transaction check
---> Package nss-softokn-freebl-devel.x86_64 0:3.12.9-11.el6 will be updated
--> Processing Dependency: nss-softokn-freebl-devel(x86-64) = 3.12.9-11.el6 for package: nss-softokn-devel-3.12.9-11.el6.x86_64
---> Package nss-softokn-freebl-devel.x86_64 0:3.14.3-9.el6 will be an update
--> Running transaction check
---> Package nss-softokn-devel.x86_64 0:3.12.9-11.el6 will be updated
---> Package nss-softokn-devel.x86_64 0:3.14.3-9.el6 will be an update
--> Processing Dependency: nss-softokn(x86-64) = 3.14.3-9.el6 for package: nss-softokn-devel-3.14.3-9.el6.x86_64
--> Processing Dependency: pkgconfig(nss-util) >= 3.15.1 for package: nss-softokn-devel-3.14.3-9.el6.x86_64
--> Processing Dependency: pkgconfig(nspr) >= 4.10.0 for package: nss-softokn-devel-3.14.3-9.el6.x86_64
--> Processing Dependency: nss-util-devel >= 3.15.1 for package: nss-softokn-devel-3.14.3-9.el6.x86_64
--> Processing Dependency: nspr-devel >= 4.10.0 for package: nss-softokn-devel-3.14.3-9.el6.x86_64
--> Running transaction check
---> Package nspr-devel.x86_64 0:4.9.2-1.el6 will be updated
---> Package nspr-devel.x86_64 0:4.10.2-1.el6_5 will be an update
--> Processing Dependency: nspr = 4.10.2-1.el6_5 for package: nspr-devel-4.10.2-1.el6_5.x86_64
---> Package nss-softokn.x86_64 0:3.12.9-11.el6 will be updated
---> Package nss-softokn.x86_64 0:3.14.3-9.el6 will be an update
--> Processing Dependency: nss-util >= 3.15.1 for package: nss-softokn-3.14.3-9.el6.x86_64
---> Package nss-util-devel.x86_64 0:3.14.0.0-2.el6 will be updated
---> Package nss-util-devel.x86_64 0:3.15.3-1.el6_5 will be an update
--> Running transaction check
---> Package nspr.x86_64 0:4.9.2-1.el6 will be updated
---> Package nspr.x86_64 0:4.10.2-1.el6_5 will be an update
---> Package nss-util.x86_64 0:3.14.0.0-2.el6 will be updated
---> Package nss-util.x86_64 0:3.15.3-1.el6_5 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                      Arch       Version              Repository   Size
================================================================================
Installing:
 glibc-devel                  i686       2.12-1.132.el6       base        978 k
Installing for dependencies:
 glibc                        i686       2.12-1.132.el6       base        4.3 M
 nss-softokn-freebl           i686       3.14.3-9.el6         base        147 k
Updating for dependencies:
 nspr                         x86_64     4.10.2-1.el6_5       updates     113 k
 nspr-devel                   x86_64     4.10.2-1.el6_5       updates     111 k
 nss-softokn                  x86_64     3.14.3-9.el6         base        265 k
 nss-softokn-devel            x86_64     3.14.3-9.el6         base         12 k
 nss-softokn-freebl           x86_64     3.14.3-9.el6         base        157 k
 nss-softokn-freebl-devel     x86_64     3.14.3-9.el6         base         29 k
 nss-util                     x86_64     3.15.3-1.el6_5       updates      64 k
 nss-util-devel               x86_64     3.15.3-1.el6_5       updates      66 k

Transaction Summary
================================================================================
Install       3 Package(s)
Upgrade       8 Package(s)

Total download size: 6.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/11): glibc-2.12-1.132.el6.i686.rpm                    | 4.3 MB     00:03     
(2/11): glibc-devel-2.12-1.132.el6.i686.rpm              | 978 kB     00:00     
(3/11): nspr-4.10.2-1.el6_5.x86_64.rpm                   | 113 kB     00:00     
(4/11): nspr-devel-4.10.2-1.el6_5.x86_64.rpm             | 111 kB     00:00     
(5/11): nss-softokn-3.14.3-9.el6.x86_64.rpm              | 265 kB     00:00     
(6/11): nss-softokn-devel-3.14.3-9.el6.x86_64.rpm        |  12 kB     00:00     
(7/11): nss-softokn-freebl-3.14.3-9.el6.i686.rpm         | 147 kB     00:00     
(8/11): nss-softokn-freebl-3.14.3-9.el6.x86_64.rpm       | 157 kB     00:00     
(9/11): nss-softokn-freebl-devel-3.14.3-9.el6.x86_64.rpm |  29 kB     00:00     
(10/11): nss-util-3.15.3-1.el6_5.x86_64.rpm              |  64 kB     00:00     
(11/11): nss-util-devel-3.15.3-1.el6_5.x86_64.rpm        |  66 kB     00:00     
--------------------------------------------------------------------------------
Total                                           479 kB/s | 6.2 MB     00:13     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : nss-softokn-freebl-3.14.3-9.el6.i686                        1/19 
  Installing : glibc-2.12-1.132.el6.i686                                   2/19 
  Updating   : nspr-4.10.2-1.el6_5.x86_64                                  3/19 
  Updating   : nss-util-3.15.3-1.el6_5.x86_64                              4/19 
  Updating   : nspr-devel-4.10.2-1.el6_5.x86_64                            5/19 
  Updating   : nss-softokn-freebl-3.14.3-9.el6.x86_64                      6/19 
  Updating   : nss-softokn-3.14.3-9.el6.x86_64                             7/19 
  Updating   : nss-softokn-freebl-devel-3.14.3-9.el6.x86_64                8/19 
  Updating   : nss-util-devel-3.15.3-1.el6_5.x86_64                        9/19 
  Updating   : nss-softokn-devel-3.14.3-9.el6.x86_64                      10/19 
  Installing : glibc-devel-2.12-1.132.el6.i686                            11/19 
  Cleanup    : nss-softokn-devel-3.12.9-11.el6.x86_64                     12/19 
  Cleanup    : nss-util-devel-3.14.0.0-2.el6.x86_64                       13/19 
  Cleanup    : nspr-devel-4.9.2-1.el6.x86_64                              14/19 
  Cleanup    : nss-softokn-freebl-devel-3.12.9-11.el6.x86_64              15/19 
  Cleanup    : nss-softokn-3.12.9-11.el6.x86_64                           16/19 
  Cleanup    : nss-util-3.14.0.0-2.el6.x86_64                             17/19 
  Cleanup    : nspr-4.9.2-1.el6.x86_64                                    18/19 
  Cleanup    : nss-softokn-freebl-3.12.9-11.el6.x86_64                    19/19 
  Verifying  : nss-util-3.15.3-1.el6_5.x86_64                              1/19 
  Verifying  : glibc-devel-2.12-1.132.el6.i686                             2/19 
  Verifying  : nss-softokn-freebl-3.14.3-9.el6.x86_64                      3/19 
  Verifying  : nss-softokn-3.14.3-9.el6.x86_64                             4/19 
  Verifying  : nss-softokn-devel-3.14.3-9.el6.x86_64                       5/19 
  Verifying  : nspr-4.10.2-1.el6_5.x86_64                                  6/19 
  Verifying  : glibc-2.12-1.132.el6.i686                                   7/19 
  Verifying  : nss-softokn-freebl-3.14.3-9.el6.i686                        8/19 
  Verifying  : nss-util-devel-3.15.3-1.el6_5.x86_64                        9/19 
  Verifying  : nspr-devel-4.10.2-1.el6_5.x86_64                           10/19 
  Verifying  : nss-softokn-freebl-devel-3.14.3-9.el6.x86_64               11/19 
  Verifying  : nss-util-devel-3.14.0.0-2.el6.x86_64                       12/19 
  Verifying  : nss-softokn-freebl-devel-3.12.9-11.el6.x86_64              13/19 
  Verifying  : nss-util-3.14.0.0-2.el6.x86_64                             14/19 
  Verifying  : nspr-devel-4.9.2-1.el6.x86_64                              15/19 
  Verifying  : nspr-4.9.2-1.el6.x86_64                                    16/19 
  Verifying  : nss-softokn-devel-3.12.9-11.el6.x86_64                     17/19 
  Verifying  : nss-softokn-freebl-3.12.9-11.el6.x86_64                    18/19 
  Verifying  : nss-softokn-3.12.9-11.el6.x86_64                           19/19 

Installed:
  glibc-devel.i686 0:2.12-1.132.el6                                             

Dependency Installed:
  glibc.i686 0:2.12-1.132.el6       nss-softokn-freebl.i686 0:3.14.3-9.el6      

Dependency Updated:
  nspr.x86_64 0:4.10.2-1.el6_5                                                  
  nspr-devel.x86_64 0:4.10.2-1.el6_5                                            
  nss-softokn.x86_64 0:3.14.3-9.el6                                             
  nss-softokn-devel.x86_64 0:3.14.3-9.el6                                       
  nss-softokn-freebl.x86_64 0:3.14.3-9.el6                                      
  nss-softokn-freebl-devel.x86_64 0:3.14.3-9.el6                                
  nss-util.x86_64 0:3.15.3-1.el6_5                                              
  nss-util-devel.x86_64 0:3.15.3-1.el6_5                                        

Complete!
#

SQLite3の32bit版

32bit版の開発環境がないみたいなので関連パッケージも含めてインストール。

# yum list | grep sqlite
qt-sqlite.x86_64                         1:4.6.2-26.el6_4               @updates
sqlite.x86_64                            3.6.20-1.el6                   @anaconda-CentOS-201207061011.x86_64/6.3
sqlite-devel.x86_64                      3.6.20-1.el6                   @anaconda-CentOS-201207061011.x86_64/6.3
apr-util-sqlite.x86_64                   1.3.9-3.el6_0.1                base    
bacula-director-sqlite.x86_64            5.0.0-12.el6                   base    
bacula-storage-sqlite.x86_64             5.0.0-12.el6                   base    
libdbi-dbd-sqlite.x86_64                 0.8.3-5.1.el6                  base    
qt-sqlite.i686                           1:4.6.2-28.el6_5               updates 
qt-sqlite.x86_64                         1:4.6.2-28.el6_5               updates 
qt3-sqlite.i686                          3.3.8b-30.el6                  base    
qt3-sqlite.x86_64                        3.3.8b-30.el6                  base    
sqlite.i686                              3.6.20-1.el6                   base    
sqlite-devel.i686                        3.6.20-1.el6                   base    
sqlite-doc.x86_64                        3.6.20-1.el6                   base    
sqlite-tcl.x86_64                        3.6.20-1.el6                   base    
# rpm -qa | grep sqlite
qt-sqlite-4.6.2-26.el6_4.x86_64
sqlite-3.6.20-1.el6.x86_64
sqlite-devel-3.6.20-1.el6.x86_64
# yum install sqlite-devel.i686
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirror.nus.edu.sg
 * extras: mirror.nus.edu.sg
 * updates: mirror.nus.edu.sg
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sqlite-devel.i686 0:3.6.20-1.el6 will be installed
--> Processing Dependency: libsqlite3.so.0 for package: sqlite-devel-3.6.20-1.el6.i686
--> Running transaction check
---> Package sqlite.i686 0:3.6.20-1.el6 will be installed
--> Processing Dependency: libreadline.so.6 for package: sqlite-3.6.20-1.el6.i686
--> Running transaction check
---> Package readline.i686 0:6.0-4.el6 will be installed
--> Processing Dependency: libtinfo.so.5 for package: readline-6.0-4.el6.i686
--> Running transaction check
---> Package ncurses-libs.i686 0:5.7-3.20090208.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch        Version                      Repository   Size
================================================================================
Installing:
 sqlite-devel        i686        3.6.20-1.el6                 base         81 k
Installing for dependencies:
 ncurses-libs        i686        5.7-3.20090208.el6           base        251 k
 readline            i686        6.0-4.el6                    base        176 k
 sqlite              i686        3.6.20-1.el6                 base        307 k

Transaction Summary
================================================================================
Install       4 Package(s)

Total download size: 814 k
Installed size: 1.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): ncurses-libs-5.7-3.20090208.el6.i686.rpm          | 251 kB     00:00     
(2/4): readline-6.0-4.el6.i686.rpm                       | 176 kB     00:00     
(3/4): sqlite-3.6.20-1.el6.i686.rpm                      | 307 kB     00:00     
(4/4): sqlite-devel-3.6.20-1.el6.i686.rpm                |  81 kB     00:00     
--------------------------------------------------------------------------------
Total                                           106 kB/s | 814 kB     00:07     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : ncurses-libs-5.7-3.20090208.el6.i686                         1/4 
  Installing : readline-6.0-4.el6.i686                                      2/4 
  Installing : sqlite-3.6.20-1.el6.i686                                     3/4 
  Installing : sqlite-devel-3.6.20-1.el6.i686                               4/4 
  Verifying  : ncurses-libs-5.7-3.20090208.el6.i686                         1/4 
  Verifying  : sqlite-3.6.20-1.el6.i686                                     2/4 
  Verifying  : sqlite-devel-3.6.20-1.el6.i686                               3/4 
  Verifying  : readline-6.0-4.el6.i686                                      4/4 

Installed:
  sqlite-devel.i686 0:3.6.20-1.el6                                              

Dependency Installed:
  ncurses-libs.i686 0:5.7-3.20090208.el6        readline.i686 0:6.0-4.el6       
  sqlite.i686 0:3.6.20-1.el6                   

Complete!
#