2020年 3月 20

とある事情でMAMPのバージョンを上げざるを得なく、その影響でDBD::mysqlがインストール出来なくなった。

mampな環境のmacにdbdmysqlをインストールの手順だとエラーが出る。(正確に言うと、/tmpが残っている間は成功する)

上記手順でbuildしたものを削除してからcarton installした時のログ

実行環境
macOS Catalina 10.15.3
MAMP 3.5.2
MySQL 5.5.42

Searching DBD::mysql on mirror index /Users/clicktx/***/***/***/local/cache/modules/02packages.details.txt ...
--> Working on DBD::mysql
Fetching http://cpan.metacpan.org/authors/id/D/DV/DVEEDEN/DBD-mysql-4.050.tar.gz
-> OK
Unpacking DBD-mysql-4.050.tar.gz
Copying DBD-mysql-4.050.tar.gz to /Users/clicktx/***/***/***/local/cache/authors/id/D/DV/DVEEDEN/DBD-mysql-4.050.tar.gz
Entering DBD-mysql-4.050
Checking configure dependencies from META.json
Checking if you have DBI 1.636 ... Yes (1.639)
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (6.98)
Checking if you have Data::Dumper 2.172 ... Yes (2.172)
Checking if you have Devel::CheckLib 1.09 ... Yes (1.14)
Configuring DBD-mysql-4.050
Running Makefile.PL
I will use the following settings for compiling and testing:

  cflags        (mysql_config) = -I/Applications/MAMP/Library/include/mysql -fno-omit-frame-pointer   -g -DNDEBUG
  embedded      (mysql_config) = 
  ldflags       (guessed     ) = 
  libs          (mysql_config) = -L/Applications/MAMP/Library/lib -lmysqlclient -lz
  mysql_config  (environment ) = /Applications/MAMP/Library/bin/mysql_config
  nocatchstderr (default     ) = 0
  nofoundrows   (default     ) = 0
  nossl         (default     ) = 0
  testdb        (environment ) = test
  testhost      (environment ) = localhost
  testpassword  (environment ) = root
  testport      (environment ) = 3306
  testsocket    (default     ) = 
  testuser      (environment ) = root

To change these settings, see 'perl Makefile.PL --help' and
'perldoc DBD::mysql::INSTALL'.

Checking if libs are available for compiling...
dyld: Library not loaded: /tmp/mysql-5.5.42/libmysql/libmysqlclient.18.dylib
  Referenced from: /Users/clicktx/.cpanm/work/1584659015.38984/DBD-mysql-4.050/assertlibBS_L2R_L
  Reason: image not found
wrong result: 'mysqlclient'
-> N/A

手順変更

/Applications/MAMP以下にbuildしたMySQLを残しておく手順に変更。

実行したcommand

$ mkdir -p /Applications/MAMP/Library/src
$ cd /Applications/MAMP/Library/src
$ wget http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.42.tar.gz
$ tar zxvf mysql-5.5.42.tar.gz
$ rm -f mysql-5.5.42.tar.gz
$ cd mysql-5.5.42
$ cmake . \
    -DMYSQL_UNIX_ADDR=/Applications/MAMP/tmp/mysql/mysql.sock \
    -DCMAKE_INSTALL_PREFIX=/Applications/MAMP/Library
$ make -j 3
$ cp -v libmysql/*.dylib /Applications/MAMP/Library/lib
$ mkdir -p /Applications/MAMP/Library/include/mysql
$ cp -v include/*.h /Applications/MAMP/Library/include/mysql

.bash_profileに追加するもの

# export path for MAMP
export PATH="$PATH:/Applications/MAMP/Library/bin/"
export DBD_MYSQL_CFLAGS=-I/Applications/MAMP/Library/include/mysql
export DBD_MYSQL_LIBS="-L/Applications/MAMP/Library/bin/mysql -lmysqlclient"
export DBD_MYSQL_EMBEDDED=
export DBD_MYSQL_CONFIG=/Applications/MAMP/Library/bin/mysql_config
export DBD_MYSQL_NOCATCHSTDERR=0
export DBD_MYSQL_NOFOUNDROWS=0
export DBD_MYSQL_SSL=
export DBD_MYSQL_TESTDB=test
export DBD_MYSQL_TESTHOST=localhost
export DBD_MYSQL_TESTPORT=3306
export DBD_MYSQL_TESTUSER=root
export DBD_MYSQL_TESTPASSWORD=root

Filed under: Mac,MySQL,perlモジュール,開発環境

Trackback Uri