#前提・実現したいこと
KH Coderをmacにインストールしようとしており、Perlの追加モジュールを入れていたところこけまくった挙句解決できませんでした。
インストール方法については以下のサイトを参考にしております。
KH CoderをMacにインストール
Perlに触るのも初めてですが、なんせ知識の乏しいmake周りでこけているようでご教授いただきたいです。
#発生している問題
KH Corderを起動しようとすると以下のように表示されるため該当モジュールの追加を試みました
bash
1$ perl kh_coder.pl 2Perl/Tk: 804.034 3Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: /Users/hoge/Documents/kh_coder/kh_lib /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /Users/hoge/Documents/kh_coder/kh_lib/kh_projects.pm line 6. 4BEGIN failed--compilation aborted at /Users/hoge/Documents/kh_coder/kh_lib/kh_projects.pm line 6. 5Compilation failed in require at kh_coder.pl line 129. 6BEGIN failed--compilation aborted at kh_coder.pl line 129.
※ユーザー名は一応伏せました。
DBD/mysqlが足りないのでcpanによるインストールを試みた結果が以下の通りです。
Perl
1cpan[1]> install DBD::mysql 2Reading '/var/root/.cpan/Metadata' 3 Database was generated on Mon, 16 Apr 2018 00:54:25 GMT 4Running install for module 'DBD::mysql' 5Running make for C/CA/CAPTTOFU/DBD-mysql-4.046.tar.gz 6Checksum for /var/root/.cpan/sources/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.046.tar.gz ok 7Scanning cache /var/root/.cpan/build for sizes 8............................................................................DONE 9 10 CPAN.pm: Building C/CA/CAPTTOFU/DBD-mysql-4.046.tar.gz 11 12 13 14PLEASE NOTE: 15 16For 'make test' to run properly, you must ensure that the 17database user 'root' can connect to your MySQL server 18and has the proper privileges that these tests require such 19as 'drop table', 'create table', 'drop procedure', 'create procedure' 20as well as others. 21 22mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t'; 23 24You can also optionally set the user to run 'make test' with: 25 26perl Makefile.PL --testuser=username 27 28I will use the following settings for compiling and testing: 29 30 cflags (mysql_config) = -I/usr/local/Cellar/mysql/5.7.21/include/mysql 31 embedded (mysql_config) = 32 ldflags (guessed ) = 33 libs (mysql_config) = -L/usr/local/Cellar/mysql/5.7.21/lib -lmysqlclient -lssl -lcrypto 34 mysql_config (guessed ) = mysql_config 35 nocatchstderr (default ) = 0 36 nofoundrows (default ) = 0 37 nossl (default ) = 0 38 testdb (default ) = test 39 testhost (default ) = 40 testpassword (default ) = 41 testport (default ) = 42 testsocket (default ) = 43 testuser (guessed ) = root 44 45To change these settings, see 'perl Makefile.PL --help' and 46'perldoc DBD::mysql::INSTALL'. 47 48Checking if your kit is complete... 49Looks good 50Using DBI 1.631 (for perl 5.018002 on darwin-thread-multi-2level) installed in /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/ 51Writing Makefile for DBD::mysql 52Wide character in print at /System/Library/Perl/5.18/ExtUtils/MakeMaker.pm line 1034. 53Wide character in print at /System/Library/Perl/5.18/ExtUtils/MakeMaker.pm line 1034. 54Writing MYMETA.yml and MYMETA.json 55cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm 56cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm 57cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm 58cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod 59cc -c -I/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI -I/usr/local/Cellar/mysql/5.7.21/include/mysql -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"4.046\" -DXS_VERSION=\"4.046\" "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" dbdimp.c 60/usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/Driver.xst > mysql.xsi 61/usr/bin/perl /System/Library/Perl/5.18/ExtUtils/xsubpp -typemap /System/Library/Perl/5.18/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c 62Warning: duplicate function definition 'do' detected in mysql.xs, line 249 63Warning: duplicate function definition 'rows' detected in mysql.xs, line 670 64cc -c -I/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI -I/usr/local/Cellar/mysql/5.7.21/include/mysql -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"4.046\" -DXS_VERSION=\"4.046\" "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" mysql.c 65Running Mkbootstrap for DBD::mysql () 66chmod 644 mysql.bs 67rm -f blib/arch/auto/DBD/mysql/mysql.bundle 68LD_RUN_PATH="/usr/local/Cellar/mysql/5.7.21/lib:/usr/lib" cc -arch x86_64 -arch i386 -bundle -undefined dynamic_lookup -fstack-protector dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle \ 69 -L/usr/local/Cellar/mysql/5.7.21/lib -lmysqlclient -lssl -lcrypto \ 70 71ld: library not found for -lssl 72clang: error: linker command failed with exit code 1 (use -v to see invocation) 73make: *** [blib/arch/auto/DBD/mysql/mysql.bundle] Error 1 74 CAPTTOFU/DBD-mysql-4.046.tar.gz 75 /usr/bin/make -- NOT OK 76Running make test 77 Can't test without successful make 78Running make install 79 Make had returned bad status, install seems impossible 80Failed during this command: 81 CAPTTOFU/DBD-mysql-4.046.tar.gz : make NO
何度か試みましたが症状は変わらず。
#試したこと
参考サイトにエラーが出た時の対処法も書かれていたので試した結果が以下のようになりました。
bash
1$ cd ~/.cpan/build 2$ cd DBD-mysql-4.046-nYXZ6d/ 3$ perl Makefile.PL 4I will use the following settings for compiling and testing: 5 6 cflags (mysql_config ) = -I/usr/local/Cellar/mysql/5.7.21/include/mysql 7 embedded (mysql_config ) = 8 ldflags (guessed ) = 9 libs (mysql_config ) = -L/usr/local/Cellar/mysql/5.7.21/lib -lmysqlclient -lssl -lcrypto 10 mysql_config (guessed ) = mysql_config 11 nocatchstderr (default ) = 0 12 nofoundrows (default ) = 0 13 nossl (default ) = 0 14 testdb (User's choice) = test 15 testhost (default ) = 16 testpassword (default ) = 17 testport (default ) = 18 testsocket (default ) = 19 testuser (User's choice) = root 20 21To change these settings, see 'perl Makefile.PL --help' and 22'perldoc DBD::mysql::INSTALL'. 23 24Using DBI 1.631 (for perl 5.018002 on darwin-thread-multi-2level) installed in /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI/ 25Writing Makefile for DBD::mysql 26Wide character in print at /System/Library/Perl/5.18/ExtUtils/MakeMaker.pm line 1034. 27Wide character in print at /System/Library/Perl/5.18/ExtUtils/MakeMaker.pm line 1034. 28Writing MYMETA.yml and MYMETA.json 29$ ./configure 30sh: ./configure: No such file or directory 31$ make 32Skip blib/lib/DBD/mysql/INSTALL.pod (unchanged) 33Skip blib/lib/Bundle/DBD/mysql.pm (unchanged) 34Skip blib/lib/DBD/mysql.pm (unchanged) 35Skip blib/lib/DBD/mysql/GetInfo.pm (unchanged) 36cc -c -I/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI -I/usr/local/Cellar/mysql/5.7.21/include/mysql -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"4.046\" -DXS_VERSION=\"4.046\" "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" dbdimp.c 37cc -c -I/System/Library/Perl/Extras/5.18/darwin-thread-multi-2level/auto/DBI -I/usr/local/Cellar/mysql/5.7.21/include/mysql -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"4.046\" -DXS_VERSION=\"4.046\" "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" mysql.c 38Running Mkbootstrap for DBD::mysql () 39chmod 644 mysql.bs 40rm -f blib/arch/auto/DBD/mysql/mysql.bundle 41LD_RUN_PATH="/usr/local/Cellar/mysql/5.7.21/lib:/usr/lib" cc -arch x86_64 -arch i386 -bundle -undefined dynamic_lookup -fstack-protector dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle \ 42 -L/usr/local/Cellar/mysql/5.7.21/lib -lmysqlclient -lssl -lcrypto \ 43 44ld: library not found for -lssl 45clang: error: linker command failed with exit code 1 (use -v to see invocation) 46make: *** [blib/arch/auto/DBD/mysql/mysql.bundle] Error 1
まず./configureが実行できず、makeも失敗しました。
続いて、以下を参考にcpanmを用いてインストールを試みました。
【Mac】KH Coder導入手順
bash
1$ cpanm DBD::mysql 2--> Working on DBD::mysql 3Fetching http://www.cpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.046.tar.gz ... OK 4Configuring DBD-mysql-4.046 ... OK 5Building and testing DBD-mysql-4.046 ... FAIL 6! Installing DBD::mysql failed. See /var/root/.cpanm/work/1523867532.5166/build.log for details. Retry with --force to force install it.
なにか見落とした点やmysqlの設定不足などあるのかもしれませんが、なにかあればよろしくお願いします。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/04/17 02:26
2018/04/17 23:52