フラット表示 | 前のトピック | 次のトピック |
投稿者 | スレッド |
---|---|
webadm | 投稿日時: 2021-1-4 8:31 |
Webmaster 登録日: 2004-11-7 居住地: 投稿: 3068 |
オープンソースソフトウェアのセルフビルドとインストール セルフビルド環境ができたので、現行サーバーで使用しているオープンソフトウェアをビルドしてインストールするだけ。
最初に無難な、apache web serverから 現在使用しているapache2だとapr, apr-iconv, apr-utilsというパッケージを予めビルドしてインストールしないとapache2本体がビルドできないので先にそちらをビルド&インストール。 これは問題なくできた。 次はxoops関連で必要な、mysqlの導入。 現行サーバーではubuntuで提供されているmysqlパッケージをそのまま使用しているが、yoctoでもmysqlはサポートされているが、バージョンが異なるのと、パッケージを追加するのにまたビルドし直さないといけない(ビルドしたrpmパッケージだけもってきてインストールするという手もあるかもしれないが実績ないので却下)ので面等なので、ソースからビルドすることに。 mysql は現在ではOracle傘下なので、有償の商用版とオープンソース版があり、後者はcommunity versionとして従来通りソースコードが提供されている。 それをダウンロードすればいいわけだが、wgetでやってみたら怒られた(´Д`;) root@wandboard:/mnt/share/home/webadm# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.5.52-linux2.6-i686.tar.gz Connecting to downloads.mysql.com (137.254.60.14:443) wget: note: TLS certificate validation not implemented wget: TLS error from peer (alert code 40): handshake failure wget: error getting response: Connection reset by peer なんだよこれ? root@wandboard:/mnt/share/home/webadm# wget --help BusyBox v1.32.0 () multi-call binary. Usage: wget [-c|--continue] [--spider] [-q|--quiet] [-O|--output-document FILE] [-o|--output-file FILE] [--header 'header: value'] [-Y|--proxy on/off] [-P DIR] [-S|--server-response] [-U|--user-agent AGENT] [-T SEC] URL... root@wandboard:/mnt/share/home/webadm# どうやらyoctoのデフォルトのwgetはbuxybox版だということが原因しているぽい。 これもyoctoのbusyboxのコンフィグレーションをゴニョゴニョとしてwgetを無効にして、別途本物のwgetパッケージをインクルードするようにlocal.confを変更すればいいけど、またBSPビルドし直すのは面倒なので、ソースからビルドすることに。 wgetはGNU softwareなので、busyboxのwgetでもとってこれるので、ビルドしてインストールしたが、busyboxのshellはwgetを内部コマンドとして処理するので、wgetで起動するとbusyboxのwgetになってしまうので、インストールされた/usr/local/bin/wgetとして起動しないとだめだった。 これでmysqlのソースを無事ゲット。 しかしmysqlのビルドにはcmakeが必要だということが判明。 普通はlinux用のオープンソースの大半はconfigureというシェルスクリプトでビルドに依存するライブラリやツールチェインを自動的に調べて最適なビルドスクリプトを生成するのだけど、mysqlはそれをcmakeで行う点が異なる。 cmakeをとってきてビルド&インストールして、ようやくmysqlのビルドを再開。 [ 67%] Building C object libmysql/CMakeFiles/clientlib.dir/__/sql-common/client_plugin.c.o /mnt/share/home/webadm/mysql-5.5.52/sql-common/client_plugin.c: In function 'mysql_client_plugin_init': /mnt/share/home/webadm/mysql-5.5.52/sql-common/client_plugin.c:252:40: error: incompatible type for argument 5 of 'add_plugin' 252 | add_plugin(&mysql, *builtin, 0, 0, 0); | ^ | | | int /mnt/share/home/webadm/mysql-5.5.52/sql-common/client_plugin.c:121:30: note: expected 'va_list' but argument is of type 'int' 121 | int argc, va_list args) | ~~~~~~~~^~~~ /mnt/share/home/webadm/mysql-5.5.52/sql-common/client_plugin.c: In function 'mysql_client_register_plugin': /mnt/share/home/webadm/mysql-5.5.52/sql-common/client_plugin.c:310:45: error: incompatible type for argument 5 of 'add_plugin' 310 | plugin= add_plugin(mysql, plugin, 0, 0, 0); | ^ | | | int /mnt/share/home/webadm/mysql-5.5.52/sql-common/client_plugin.c:121:30: note: expected 'va_list' but argument is of type 'int' 121 | int argc, va_list args) | ~~~~~~~~^~~~ make[2]: *** [libmysql/CMakeFiles/clientlib.dir/build.make:147: libmysql/CMakeFiles/clientlib.dir/__/sql-common/client_plugin.c.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:2401: libmysql/CMakeFiles/clientlib.dir/all] Error 2 make: *** [Makefile:182: all] Error 2 しかしなにやらコンパイルエラーが出た。 どうやら va_listというデータタイプの引数を即値0を指定している行で怒られているらしい。 webで検索すると既知の問題らしく、修正方法が出ていたのでそれを参考に修正。 問題の行のある関数で、va_list args = {0}; を追加して、即値0の引数の代わりに args を渡すように変更するだけ。 再度ビルドを再開すると、まだ伏兵が居た。 [ 97%] Building CXX object client/CMakeFiles/mysql.dir/mysql.cc.o /mnt/share/home/webadm/mysql-5.5.52/client/mysql.cc: In function 'void build_completion_hash(bool, bool)': /mnt/share/home/webadm/mysql-5.5.52/client/mysql.cc:2669:37: error: invalid conversion from 'char' to 'char*' [-fpermissive] 2669 | field_names[i][num_fields*2]= '\0'; | ^~~~ | | | char make[2]: *** [client/CMakeFiles/mysql.dir/build.make:95: client/CMakeFiles/mysql.dir/mysql.cc.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:3200: client/CMakeFiles/mysql.dir/all] Error 2 make: *** [Makefile:182: all] Error 2 これは field_namesという変数は char *** というデータタイプで、char データタイプへのポインタのポインタのポインタという意味だけど、ポインタは配列の先頭アドレスという解釈と同義なので、charデータタイプへのポインタ配列の配列ということで配列メンバーはポインタであるのに対して、問題の行ではcharデータタイプの即値を代入しているので怒られている感じ。 本来はポインタデータタイプだからcharデータタイプへのアドレスかNULLが適切だけど、このケースではNULLポインタを代入しようとしているので、null文字コード即値の変わりにNULLに変えれば問題なし。 これでビルドが通って、インストールもできた。 次はxoopsを動かすためのphpのビルドとインストール。 /bin/sh /mnt/share/home/webadm/php-4.4.9/libtool --silent --preserve-dup-deps --mode=compile /mnt/share/home/webadm/php-4.4.9/meta_ccld -Imain/ -I/mnt/share/home/webadm/php-4.4.9/main/ -DPHP_ATOM_INC -I/mnt/share/home/webadm/php-4.4.9/include -I/mnt/share/home/webadm/php-4.4.9/main -I/mnt/share/home/webadm/php-4.4.9 -I/mnt/share/home/webadm/php-4.4.9/ext/xml/expat -I/mnt/share/home/webadm/php-4.4.9/TSRM -I/mnt/share/home/webadm/php-4.4.9/Zend -D_REENTRANT -DTHREAD=1 -g -O2 -pthread -DZTS -c main/internal_functions.c -o main/internal_functions.lo main/internal_functions.c:35:2: error: 'phpext_xml_ptr' undeclared here (not in a function) 35 | phpext_xml_ptr, | ^~~~~~~~~~~~~~ main/internal_functions.c:36:2: error: 'phpext_tokenizer_ptr' undeclared here (not in a function) 36 | phpext_tokenizer_ptr, | ^~~~~~~~~~~~~~~~~~~~ main/internal_functions.c:37:2: error: 'phpext_standard_ptr' undeclared here (not in a function) 37 | phpext_standard_ptr, | ^~~~~~~~~~~~~~~~~~~ main/internal_functions.c:38:2: error: 'phpext_session_ptr' undeclared here (not in a function) 38 | phpext_session_ptr, | ^~~~~~~~~~~~~~~~~~ main/internal_functions.c:39:2: error: 'phpext_posix_ptr' undeclared here (not in a function) 39 | phpext_posix_ptr, | ^~~~~~~~~~~~~~~~ main/internal_functions.c:40:2: error: 'phpext_overload_ptr' undeclared here (not in a function) 40 | phpext_overload_ptr, | ^~~~~~~~~~~~~~~~~~~ main/internal_functions.c:41:2: error: 'phpext_mysql_ptr' undeclared here (not in a function) 41 | phpext_mysql_ptr, | ^~~~~~~~~~~~~~~~ main/internal_functions.c:42:2: error: 'phpext_ctype_ptr' undeclared here (not in a function) 42 | phpext_ctype_ptr, | ^~~~~~~~~~~~~~~~ main/internal_functions.c:43:2: error: 'phpext_pcre_ptr' undeclared here (not in a function) 43 | phpext_pcre_ptr, | ^~~~~~~~~~~~~~~ make: *** [Makefile:710: main/internal_functions.lo] Error 1 ありえないエラーが出る。 どうやらこのソースはwindows用でしかビルド実績が無いぽくて、必要なヘッダファイルがwindows用ソースでしかインクルードされていないのが原因ぽい。 windows用ソースを参考に、当該ヘッダファイルをインクルードする行を追加して解消。 しかし最終的なリンク段階で二重定義が発覚。 /usr/lib/gcc/arm-fslc-linux-gnueabi/10.2.0/../../../../arm-fslc-linux-gnueabi/bin/ld: Zend/zend_ini_scanner.lo:/mnt/share/home/webadm/php-4.4.9/Zend/zend_ini_scanner.c:466: multiple definition of `yytext'; Zend/zend_language_scanner.lo:/mnt/share/home/webadm/php-4.4.9/Zend/zend_language_scanner.c:2638: first defined here /usr/lib/gcc/arm-fslc-linux-gnueabi/10.2.0/../../../../arm-fslc-linux-gnueabi/bin/ld: ext/mysql/libmysql/my_tempnam.lo: in function `my_tempnam': /mnt/share/home/webadm/php-4.4.9/ext/mysql/libmysql/my_tempnam.c:115: warning: the use of `tempnam' is dangerous, better use `mkstemp' collect2: error: ld returned 1 exit status make: *** [Makefile:108: libphp4.la] Error 1 原因は、2つのソースモジュールで、いずれも yytextという大域変数を定義しているため。 片方のソースはextern char *yytext;と char *yytext; 行があるので、後者をextern char *yytext;に変更しもう片方はchar *yytext;を温存する形で解消。 また別のモジュールでヘッダファイルのインクルード漏れが発覚。 /bin/sh /mnt/share/home/webadm/php-4.4.9/libtool --silent --preserve-dup-deps --mode=compile /mnt/share/home/webadm/php-4.4.9/meta_ccld -Imain/ -I/mnt/share/home/webadm/php-4.4.9/main/ -DPHP_ATOM_INC -I/mnt/share/home/webadm/php-4.4.9/include -I/mnt/share/home/webadm/php-4.4.9/main -I/mnt/share/home/webadm/php-4.4.9 -I/mnt/share/home/webadm/php-4.4.9/ext/xml/expat -I/mnt/share/home/webadm/php-4.4.9/TSRM -I/mnt/share/home/webadm/php-4.4.9/Zend -D_REENTRANT -DTHREAD=1 -g -O2 -pthread -DZTS -c main/internal_functions_cli.c -o main/internal_functions_cli.lo main/internal_functions_cli.c:35:2: error: 'phpext_xml_ptr' undeclared here (not in a function) 35 | phpext_xml_ptr, | ^~~~~~~~~~~~~~ main/internal_functions_cli.c:36:2: error: 'phpext_tokenizer_ptr' undeclared here (not in a function) 36 | phpext_tokenizer_ptr, | ^~~~~~~~~~~~~~~~~~~~ main/internal_functions_cli.c:37:2: error: 'phpext_standard_ptr' undeclared here (not in a function) 37 | phpext_standard_ptr, | ^~~~~~~~~~~~~~~~~~~ main/internal_functions_cli.c:38:2: error: 'phpext_session_ptr' undeclared here (not in a function) 38 | phpext_session_ptr, | ^~~~~~~~~~~~~~~~~~ main/internal_functions_cli.c:39:2: error: 'phpext_posix_ptr' undeclared here (not in a function) 39 | phpext_posix_ptr, | ^~~~~~~~~~~~~~~~ main/internal_functions_cli.c:40:2: error: 'phpext_overload_ptr' undeclared here (not in a function) 40 | phpext_overload_ptr, | ^~~~~~~~~~~~~~~~~~~ main/internal_functions_cli.c:41:2: error: 'phpext_mysql_ptr' undeclared here (not in a function) 41 | phpext_mysql_ptr, | ^~~~~~~~~~~~~~~~ main/internal_functions_cli.c:42:2: error: 'phpext_ctype_ptr' undeclared here (not in a function) 42 | phpext_ctype_ptr, | ^~~~~~~~~~~~~~~~ main/internal_functions_cli.c:43:2: error: 'phpext_pcre_ptr' undeclared here (not in a function) 43 | phpext_pcre_ptr, | ^~~~~~~~~~~~~~~ make: *** [Makefile:712: main/internal_functions_cli.lo] Error 1 あり得ないな。これも同様に宣言行があるヘッダファイルを探して、それをインクルードするようにソースを修正して解決。 ようやくビルド&インストールができた。 root@wandboard:/mnt/share/home/webadm# php --version PHP 4.4.9 (cli) (built: Jan 2 2021 14:41:13) Copyright (c) 1997-2008 The PHP Group Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies あと、細々としたCGIもビルドしないと。 数式をpngに変換するmathtexを使っているけど、これが一番難儀だな。mathtexはtexとdvipngとかを使用してそれを実現しているので、texとdvipngをソースからビルドしないといけない。 現行のサーバーではubuntuでそれらのパッケージが提供されているので何も考えずにそれをインストールするだけだったけど、今回はソースからビルドする必要がある(texはビルド済みバイナリも配布されているが、流石にARM用バイナリは提供されていない)。 Texのソースアーカイブをとってきて、configureすると怒られる。 引用: $ mkdir work config.status: creating samples/layout/Makefile Not rebuilding data/rules.mk, assuming prebuilt data in data/in Spawning Python to generate test/testdata/rules.mk... Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/mnt/share/home/webadm/texlive-20200406-source/libs/icu/icu-src/source/python/icutools/databuilder/__main__.py", line 10, in <module> import json ModuleNotFoundError: No module named 'json' configure: error: Python failed to run; see above error. make[4]: *** [Makefile:1314: icu-build/Makefile] Error 1 make[4]: Leaving directory '/mnt/share/home/webadm/texlive-20200406-source/work/libs/icu' make[3]: *** [Makefile:719: all-recursive] Error 1 make[3]: Leaving directory '/mnt/share/home/webadm/texlive-20200406-source/work/libs/icu' make[2]: *** [Makefile:906: recurse] Error 1 make[2]: Leaving directory '/mnt/share/home/webadm/texlive-20200406-source/work/libs' make[1]: *** [Makefile:483: all-recursive] Error 1 make[1]: Leaving directory '/mnt/share/home/webadm/texlive-20200406-source/work/libs' make: *** [Makefile:577: all-recursive] Error 1 どうやらyoctoでデフォルトで入っているpython3のmoduleが一切ないぽい。python3本体しか入っていないぽい、あり得ない。 pythonはソースからビルド&インストールすれば最低限のmoduleは一緒にインストールされるはずなので、ソースからビルドすることに。 root@wandboard:/mnt/share/home/webadm# python3 --version Python 3.9.1 python3のビルドとインストールができた。 これでtextのconfigureが通り、makeもできた。 しかしインストールで問題発生。 libtool: install: /usr/bin/install -c luajithbtex /usr/local/bin/armv7l-unknown-linux-gnueabihf/luajithbtex /usr/bin/install: error writing '/usr/local/bin/armv7l-unknown-linux-gnueabihf/luajithbtex': No space left on device make[4]: *** [Makefile:5162: install-binPROGRAMS] Error 1 make[4]: Leaving directory '/mnt/share/home/webadm/texlive-20200406-source/work/texk/web2c' make[3]: *** [Makefile:17447: install-am] Error 2 make[3]: Leaving directory '/mnt/share/home/webadm/texlive-20200406-source/work/texk/web2c' make[2]: *** [Makefile:16966: install-recursive] Error 1 make[2]: Leaving directory '/mnt/share/home/webadm/texlive-20200406-source/work/texk/web2c' make[1]: *** [Makefile:486: install-recursive] Error 1 make[1]: Leaving directory '/mnt/share/home/webadm/texlive-20200406-source/work/texk' make: *** [Makefile:577: install-recursive] Error 1 root@wandboard:/mnt/share/home/webadm/texlive-20200406-source/work# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 2005316 1988932 0 100% / yoctoでビルドしたファイルシステムは空き容量が少ないので、ファイルシステムがフルになってしまったのだ。 SDカードなので、ファイルシステムの内容をバックアップして、パーティションを切り直してファイルシステムを作り直すしかない。 もしかしたら16GのSDカードでは足らなくなるかもしれないけど、それは後で考えよう。SDXCカードもたぶんつかえると思うので(試したことないけど)、購入しておこう。 また続きは後日。 んじゃまた。 |
フラット表示 | 前のトピック | 次のトピック |
題名 | 投稿者 | 日時 |
---|---|---|
WANDBOARD用のlinux BSP | webadm | 2020-12-31 23:14 |
fsl-image-network-full-cmdlineとセルフビルド環境化 | webadm | 2021-1-4 0:50 |
» オープンソースソフトウェアのセルフビルドとインストール | webadm | 2021-1-4 8:31 |
CGI対応 | webadm | 2021-1-7 10:08 |
PHP4+MySQL5接続問題解決 | webadm | 2021-1-9 3:25 |
Webコンテンツの同期完了 | webadm | 2021-1-9 4:55 |
rsync 3.2.3で嵌まる | webadm | 2021-1-15 20:21 |
Debian 10を試す | webadm | 2021-1-19 9:44 |
Debianはメモリ食いだった | webadm | 2021-2-4 6:51 |