Opened 15 years ago

Closed 13 years ago

#19523 closed defect (invalid)

Mac OS X 10.5.6 libiconv, openssl errors when trying to build PHP 5.2.9

Reported by: z3r0_f4ct0r@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: Cc: jyrkiwahlstedt, mww@…
Port: php5 libiconv openssl

Description (last modified by mf2k (Frank Schima))

I'm having this issue trying to build PHP 5.2.9 on Mac OS X 10.5.6:

http://diymacserver.com/forum/topic/leopard-iconv-and-php5

I have had no success with either

 '--with-iconv=/opt/local' \
 '--with-iconv-dir=/opt/local' \
 '--with-iconv=/usr' \
'--with-iconv-dir=/usr' \
'--with-iconv=shared, /usr' \
'--with-iconv=shared,/opt/local' \

Though

'--with-openssl=shared,/opt/local' \

seems to work versus none below:

'--with-openssl=/opt/local' \
'--with-openssl=/usr' \
'--with-openssl-dir=/opt/local' \
'--with-openssl-dir=/usr' \

Here is my current config with the resulting error:

ERROR

Undefined symbols:
  "_libiconv", referenced from:
      _do_convert in gdkanji.o
  "_libiconv_close", referenced from:
      _do_convert in gdkanji.o
  "_libiconv_open", referenced from:
      _do_convert in gdkanji.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1

CONFIG

MACOSX_DEPLOYMENT_TARGET=10.5 \
CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp" \
CCFLAGS="-arch x86_64 -g -Os -pipe" \
CXXFLAGS="-arch x86_64 -g -Os -pipe" \
LDFLAGS="-arch x86_64 -bind_at_load" \
'./configure' \
'--disable-all' \
'--with-apxs2=/usr/sbin/apxs' \
'--with-mysql=/usr/local/mysql' \
'--with-mysqli=/usr/local/mysql/bin/mysql_config' \
'--prefix=/usr/local/php' \
'--with-config-file-path=/usr/local/php' \
'--with-zlib-dir=/opt/local' \
'--with-gettext=/opt/local' \
'--with-gdbm=/opt/local' \
'--with-mcrypt=/opt/local' \
'--with-curl=/opt/local' \
'--with-openssl=shared,/opt/local' \
'--with-sqlite' \
'--enable-sqlite-utf8' \
'--enable-libxml' \
'--enable-simplexml' \
'--enable-xml' \
'--enable-xmlreader' \
'--enable-xmlwriter' \
'--enable-dom' \
'--with-pcre-regex' \
'--enable-session' \
'--enable-spl' \
'--with-gd' \
'--with-jpeg-dir=/opt/local' \
'--with-png-dir=/opt/local' \
'--with-freetype-dir=/opt/local' \
'--enable-ctype' \
'--with-iconv=shared,/opt/local' \
'--with-xsl' \
'--with-pear' \
'--enable-hash' \
'--enable-json' \
'--enable-mbstring' \
'--enable-pdo' \
'--with-pdo-sqlite' \
'--enable-ftp' \
'--with-pdo-dblib=/opt/local' \
'--enable-shmop' \
'--enable-pcntl' \
'--enable-posix'

I have the following ports installed:

curl @7.19.4_0+universal (active)
  expat @2.0.1_0+universal (active)
  freetds @0.82_0+darwin_9+universal (active)
  freetype @2.3.9_0+macosx+universal (active)
  gdbm @1.8.3_1+universal (active)
  gettext @0.17_4+universal (active)
  jpeg @6b_3+universal (active)
  libiconv @1.12_2+universal (active)
  libmcrypt @2.5.8_1+universal (active)
  libpng @1.2.35_0+universal (active)
  memcached @1.2.6_0+universal (active)
  openssl @0.9.8k_0+universal (active)
  zlib @1.2.3_2+universal (active)

Any ideas?

Change History (14)

comment:1 Changed 15 years ago by mf2k (Frank Schima)

Description: modified (diff)
Priority: HighNormal

Please use Wiki formatting in the future.

comment:2 in reply to:  description Changed 15 years ago by z3r0_f4ct0r@…

Replying to z3r0_f4ct0r@…:

I'm building the 64bit x86_64 version of each.

comment:3 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Have you tried just installing the php5 port? Why are you trying to build php by hand?

comment:4 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added

comment:5 in reply to:  3 Changed 15 years ago by z3r0_f4ct0r@…

Replying to ryandesign@…:

Have you tried just installing the php5 port? Why are you trying to build php by hand?

I'm trying to build it by hand because I need specific extensions for my development environment.

I ended up compiling all of this in 32 bit and it works fine, seems like there are issues with 64 bit PHP or the extensions. Really strange. I've found it easier to get things running in FreeBSD vs Mac OS X (compiling PHP/Apache/MySQL) in 64 bit. Not to sure if it's because I need to pass some other arguments to make regarding the install layout. It would be nice if it was easy to replace the default apache, php etc... installs in Mac OS X, as I think the might be conflicting with my custom installs. Perhaps I need to create a Jail?

comment:6 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

Software installed by MacPorts will not replace any files installed by Apple, and that's by design. Replacing Apple software would be bad, as any Apple software update could come in and wipe out your changes, not to mention that Mac OS X was not designed to have its parts replaced like that, so if you do, parts of Mac OS X may not work right anymore. MacPorts tries to install most everything to its own prefix, by default /opt/local, so that it's separate from anything you may already have.

I have not yet tried to build the MacPorts php5 or apache2 ports with the universal variant (e.g. with any 64-bit support) so I don't know if they work right like that.

If there are specific PHP extension you need that are not provided by MacPorts, let me know; I may be able to add ports for them. Since you originally filed this ticket, PHP extensions are now in their own ports instead of part of the php5 port, so adding new ports for new extensions should be easy.

comment:7 Changed 15 years ago by z3r0_f4ct0r@…

Have you tried the 64bit compile yet? I'm still having issues:

I'm using the default apache 2 install and mysql x86_64 package from the mysql website with the following flags:

MACOSX_DEPLOYMENT_TARGET=10.5
CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp"
CCFLAGS="-arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch x86_64 -g -Os -pipe"
LDFLAGS="-arch x86_64 -bind_at_load"
export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET

The following extensions (universal x86_64):

 curl @7.19.5_0+universal (active)
  expat @2.0.1_0+universal (active)
  freetds @0.82_0+darwin_9+universal (active)
  freetype @2.3.9_0+macosx+universal (active)
  gdbm @1.8.3_1+universal (active)
  gettext @0.17_4+universal (active)
  gperf @3.0.4_0+universal (active)
  jpeg @6b_3+universal (active)
  libevent @1.4.12_0+universal (active)
  libiconv @1.13_0+universal (active)
  libmcrypt @2.5.8_1+universal (active)
  libpng @1.2.38_0+universal (active)
  mcrypt @2.6.8_0+universal (active)
  memcached @1.2.8_0+universal (active)
  mhash @0.9.9.9_0+universal (active)
  ncurses @5.7_0+universal (active)
  ncursesw @5.7_0+universal (active)
  openssl @0.9.8k_0+universal (active)
  pkgconfig @0.23_1+universal (active)
  readline @6.0.000_1+universal (active)
  zlib @1.2.3_2+universal (active)

And I'm compiling PHP 5.3 from source like so:

'./configure' \
'--disable-all' \
'--with-apxs2=/usr/sbin/apxs' \
'--with-mysql=/usr/local/mysql' \
'--with-mysqli=/usr/local/mysql/bin/mysql_config' \
'--prefix=/usr/local/php' \
'--with-config-file-path=/usr/local/php' \
'--with-zlib' \
'--with-gettext=/opt/local' \
'--with-gdbm=/opt/local' \
'--with-mcrypt=/opt/local' \
'--with-curl=/opt/local' \
'--with-openssl' \
'--with-sqlite' \
'--enable-sqlite-utf8' \
'--enable-libxml' \
'--enable-simplexml' \
'--enable-xml' \
'--enable-xmlreader' \
'--enable-xmlwriter' \
'--enable-dom' \
'--with-pcre-regex' \
'--enable-session' \
'--enable-spl' \
'--with-gd' \
'--with-jpeg-dir=/opt/local' \
'--with-png-dir=/opt/local' \
'--with-freetype-dir=/opt/local' \
'--enable-ctype' \
'--with-iconv=/opt/local' \
'--with-xsl' \
'--with-pear' \
'--enable-hash' \
'--enable-json' \
'--enable-mbstring' \
'--enable-pdo' \
'--with-pdo-sqlite' \
'--enable-ftp' \
'--with-pdo-dblib=/opt/local' \
'--enable-shmop' \
'--enable-pcntl' \
'--enable-posix'

I'm getting the following error:

checking for mcrypt_module_open in -lmcrypt... yes
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... no
checking for mysql_close in -lmysqlclient... no
checking for mysql_error in -lmysqlclient... no
configure: error: mysql configure failed. Please check config.log for more information.

and in the config.log:

configure:58647: checking for mysql_close in -lmysqlclient
configure:58666: gcc -o conftest -I/opt/local/include  -gstabs -fvisibility=hidden  -no-cpp-precomp -Wl,-rpath,/usr/loca
l/mysql/lib -L/usr/local/mysql/lib -liconv -L/opt/local/lib  -Wl,-rpath,/opt/local/lib -L/opt/local/lib conftest.c -lmys
qlclient  -lmcrypt -lltdl -liconv -liconv -lintl -lfreetype -lpng -lz -ljpeg -lgdbm -lcurl -lz -lm  -lxml2 -lz -licucore
 -lm -lssl -lcrypto -lz -lcurl -lz -lxml2 -lz -licucore -lm -lssl -lcrypto -lz 1>&5
ld warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
Undefined symbols:
  "_mysql_close", referenced from:
      _main in ccSbmdqu.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
configure: failed program was:
#line 58655 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_close();

int main() {
mysql_close()
; return 0; }
configure:58889: checking for mysql_error in -lmysqlclient
configure:58908: gcc -o conftest -I/opt/local/include  -gstabs -fvisibility=hidden  -no-cpp-precomp -Wl,-rpath,/usr/loca
l/mysql/lib -L/usr/local/mysql/lib -liconv -L/opt/local/lib  -Wl,-rpath,/opt/local/lib -L/opt/local/lib -Wl,-rpath,/usr 
-L/usr conftest.c -lmysqlclient  -lz -lmcrypt -lltdl -liconv -liconv -lintl -lfreetype -lpng -lz -ljpeg -lgdbm -lcurl -l
z -lm  -lxml2 -lz -licucore -lm -lssl -lcrypto -lz -lcurl -lz -lxml2 -lz -licucore -lm -lssl -lcrypto -lz 1>&5
ld warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file is not of required architecture
Undefined symbols:
  "_mysql_error", referenced from:
      _main in cc1psKQp.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
configure: failed program was:
#line 58897 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mysql_error();

int main() {
mysql_error()
; return 0; }

I have the correct flags so I'm not sure what's going on.

How would I configure PHP 5.3 in the MacPorts to use the extensions I need and compile 64 bit along with mysql and apache2?

Thanks!

comment:8 Changed 15 years ago by tobypeterson

I don't think this is something we can reasonably resolve until 1.8 is out. Need to get people to stop abusing universal to get 64-bit binaries on Leopard. I'd recommend either installing from trunk and trying build_arch, or just installing 32-bit and waiting for 1.8.

comment:9 in reply to:  8 Changed 15 years ago by z3r0_f4ct0r@…

Turns out that PHP 5.3 uses mysqlnd vs mysqli http://dev.mysql.com/downloads/connector/php-mysqlnd/

So I had to change the config options to include: --with-mysql=mysqlnd, --with-mysqli=mysqlnd and --with-pdo-mysql=mysqlnd to compile PHP with mysqlnd support.

Now I'm having issues with sqlite3 with the following config:

'./configure' \
'--disable-all' \
'--with-apxs2=/usr/sbin/apxs' \
'--with-mysql=mysqlnd' \
'--with-mysqli=mysqlnd' \
'--prefix=/usr/local/php' \
'--with-config-file-path=/usr/local/php' \
'--with-zlib' \
'--with-gettext=/opt/local' \
'--with-gdbm=/opt/local' \
'--with-mcrypt=/opt/local' \
'--with-curl=/opt/local' \
'--with-openssl' \
'--with-sqlite' \
'--enable-sqlite-utf8' \
'--enable-libxml' \
'--enable-simplexml' \
'--enable-xml' \
'--enable-xmlreader' \
'--enable-xmlwriter' \
'--enable-dom' \
'--with-pcre-regex' \
'--enable-session' \
'--enable-spl' \
'--with-gd' \
'--with-jpeg-dir=/opt/local' \
'--with-png-dir=/opt/local' \
'--with-freetype-dir=/opt/local' \
'--enable-ctype' \
'--with-iconv=/opt/local' \
'--with-xsl' \
'--with-pear' \
'--enable-hash' \
'--enable-json' \
'--enable-mbstring' \
'--enable-pdo' \
'--with-pdo-mysql=mysqlnd' \
'--enable-ftp' \
'--with-pdo-dblib=/opt/local' \
'--enable-shmop' \
'--enable-pcntl' \
'--enable-posix'

I've tried with the above config and even:

--enable-pdo=shared \
--with-sqlite=shared \
--with-pdo-sqlite=shared

but I get this error:

checking for dnet_addr in -ldnet_stub... no
checking for Firebird support for PDO... no
checking for MySQL support for PDO... no
checking Oracle OCI support for PDO... no
checking for ODBC v3 support for PDO... no
checking for PostgreSQL support for PDO... no
checking for sqlite 3 support for PDO... yes
checking for PDO includes... (cached) /usr/local/src/php-5.3.0/ext
configure: error: 
You've configured extension pdo_sqlite, which depends on extension sqlite3,
but you've either not enabled sqlite3, or have disabled it.

Ideas?

comment:10 Changed 15 years ago by ryandesign (Ryan Carsten Schmidt)

At this point, compiling php and its dependencies 64-bit is not on my to-do list. I can't really help you compile PHP from source. MacPorts already provides mysqlnd support in the +mysqlnd variant. MacPorts also already builds the sqlite shared modules in the php5-sqlite port. You can read the Portfiles to see how I did this.

comment:11 Changed 14 years ago by jmroot (Joshua Root)

Cc: jwa@… mww@… added; ryandesign@… removed
Keywords: libiconv openssl removed
Owner: changed from macports-tickets@… to ryandesign@…
Port: php5 added

comment:12 Changed 13 years ago by jmroot (Joshua Root)

So is this even relevant any more? People presumably build php5 64-bit all the time these days.

comment:13 in reply to:  12 Changed 13 years ago by z3r0_f4ct0r@…

Well I've moved on to Zend Server CE. Its much easier to get up and running and since its maintained by Zend, things are addressed at a faster pace.

Perhaps I'll reconsider macports when approaches parity with the FreeBSD ports system.

Feel free to close this ticket.

Replying to jmr@…:

So is this even relevant any more? People presumably build php5 64-bit all the time these days.

comment:14 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: invalid
Status: newclosed

Correct, Joshua, php5 and extensions build (and AFAIK work) fine 64-bit and 32-bit in MacPorts since quite some time.

z3r0_f4ct0r, if you have specific suggestions for ways MacPorts should improve, I'm sure we'd love to hear them (probably the macports-users mailing list is the best place to begin such discussions), but the majority of this ticket was about you building php from source -- by definition without the help of MacPorts.

Note: See TracTickets for help on using tickets.