Bug #22741 cflags and libs reported to cpan fail to allow DBD::mysql to compile on MacPro
Submitted: 27 Sep 2006 14:54 Modified: 5 Nov 2006 9:15
Reporter: Dennis Wurster Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connectors: DBD::mysql ( Perl ) Severity:S1 (Critical)
Version:4.1.13a-log OS:MacOS (Mac OS X 10.4 Server)
Assigned to: CPU Architecture:Any
Tags: OSXServer DBD::mysql cpan 10.4.7

[27 Sep 2006 14:54] Dennis Wurster
Description:
The Setup: 

Mac Pro (intel Core 2 Duo)
Mac OS X Server 10.4.7
MySQL 4.1.13a-log
perl v5.8.6 built for darwin-thread-multi-2level
cpan shell v1.8801
DBD::mysql 3.0007
DBI 1.52
i686-apple-darwin8-gcc-4.0.1

------------

~/Desktop/DBD-mysql-3.0007 admin$ perl Makefile.PL
I will use the following settings for compiling and testing:

  cflags        (mysql_config) = -I/usr/include/mysql -fno-omit-frame-pointer  -arch ppc64  -arch x86_64 -pipe
  embedded      (mysql_config) = 
  libs          (mysql_config) = -arch ppc64  -arch x86_64 -pipe -L/usr/lib/mysql -lmysqlclient -lz -lm
  mysql_config  (guessed     ) = mysql_config
  nocatchstderr (default     ) = 0
  nofoundrows   (default     ) = 0
  ssl           (guessed     ) = 0
Use of uninitialized value in printf at Makefile.PL line 172, <PIPE> line 103.
  test_user     (            ) = 
  testdb        (default     ) = test
  testhost      (default     ) = 
  testpassword  (default     ) = 
  testsocket    (default     ) = 
  testuser      (default     ) = 

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

Checking if your kit is complete...
Looks good
Unrecognized argument in LIBS ignored: '-arch'
Unrecognized argument in LIBS ignored: 'ppc64'
Unrecognized argument in LIBS ignored: '-arch'
Unrecognized argument in LIBS ignored: 'x86_64'
Unrecognized argument in LIBS ignored: '-pipe'
Using DBI 1.52 (for perl 5.008006 on darwin-thread-multi-2level) installed in /Library/Perl/5.8.6/darwin-thread-multi-2level/auto/DBI/
Writing Makefile for DBD::mysql
~/Desktop/DBD-mysql-3.0007 admin$ make test
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/Mysql.pm blib/lib/Mysql.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Mysql/Statement.pm blib/lib/Mysql/Statement.pm
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
cc -c  -I/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/DBI -I/usr/include/mysql -fno-omit-frame-pointer  -arch ppc64  -arch x86_64 -pipe -DDBD_MYSQL_INSERT_ID_IS_GOOD -g  -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include -O3   -DVERSION=\"3.0007\" -DXS_VERSION=\"3.0007\"  "-I/System/Library/Perl/5.8.6/darwin-thread-multi-2level/CORE"   dbdimp.c
cc: Unable to guess config name for arch x86_64
make: *** [dbdimp.o] Error 1

How to repeat:
With a Mac Pro, install 10.4 Server. drop to terminal and run cpan, then run 'install DBD::mysql", or attempt to compile from source manually. Both ways report the "cc: Unable to guess config name for arch x86_64"
[27 Sep 2006 15:17] Dennis Wurster
Sorry, Mac Pro is 2 64-bit Dual-Core Intel Xeon "Woodcrest" processor, not Core 2 Duo.
[27 Sep 2006 15:35] Dennis Wurster
admin$ mysql_config --cflags
-I/usr/include/mysql -fno-omit-frame-pointer  -arch ppc64  -arch x86_64 -pipe

admin$ mysql_config --libs
-arch ppc64  -arch x86_64 -pipe -L/usr/lib/mysql -lmysqlclient -lz -lm
[27 Sep 2006 15:38] Dennis Wurster
admin$ which mysql
/usr/bin/mysql

...which is the installation of the stock mysql included with the default install of OS X Server, and possibly OS X (non-server) too.

non-bundled versions of mysql that you just download and install manually tend to install to /usr/local/mysql/ instead.
[5 Oct 2006 9:15] Domas Mituzas
We do not support directly OSX Server MacOSX package, the proper point of contact should be Apple. 

Do you have same troubles if you use our packages? If you specify path to mysql_config to /usr/local/mysql/bin/mysql_config ?
[6 Nov 2006 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[23 Aug 2007 18:10] yanlin peng
Hi, I successfully installed DBD::mysql perl module on my MacPro, using the package provided by mysql.com.

My machine: MacPro with Mac OS X Server  10.4.7
My perl modules: DBI-1.58, DBD-mysql-4.005
My mysql distribution: mysql-5.0.45-osx10.4-i686.dmg
My procedure:
0. Stop the default mysql server coming with Mac OS X server, if it is running.
1. Install DBI-1.58
2. Install mysql-5.0.45-osx10.4-i686.dmg, using the default configuration. 
3. Start mysql server. Login as root to make sure accessibility. Set password and then logout.
4. Edit /etc/bashrc file, add
  PATH=/usr/local/mysql/bin:$PATH
   to make sure the new version of mysql is invoked by default. If you are using a shell other than bash, this step may be slightly different.
5. Enter into the folder for the source code of DBD-mysql-4.005, type
  $ sudo perl Makefile.PL --testuser=root --testpassword='my_password'
  $ sudo make
  $ sudo make test (failed, just ignore)
  $ sudo make install
6. Make a 'mysql' folder in /usr/local/mysql/lib/ and copy lib files into it. Otherwise, you get errors when running a perl program like this:
  install_driver(mysql) failed: Can't load  '/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' 
for module DBD::mysql: 
dlopen(/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
  
  $ mkdir /usr/local/mysql/lib/mysql
  $ cp /usr/local/mysql/lib/lib* /usr/local/mysql/lib/mysql/
[23 Aug 2007 18:15] yanlin peng
Output of mysql_config:
$ mysql_config --cflags
-I/usr/local/mysql/include -Os -arch i386 -fno-common
$ mysql_config --include
-I/usr/local/mysql/include
$ mysql_config --libs  (there is a bug. no lib files in folder /usr/local/mysql/lib/mysql)
-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm
$ mysql_config --libs_r
-L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lm
$ mysql_config --socket
/tmp/mysql.sock
$ mysql_config --port  
3306
$ mysql_config --version
5.0.45
$ mysql_config --libmysqld-libs
-L/usr/local/mysql/lib/mysql -lmysqld -lz -lm