aldisa

Q: libphp7.so generates error with httpd.2.4.18 - Symbol not found: __cg_jpeg_resync_to_restart

I am trying to create a web development environment that has the same LAMP platform as my production server to minimize the possibility conflicts.  The production server has been setup with Apache 2.4.18 with PHP 7.0.2 compiled, installed and running.

 

I installed everything in /usr/local from sources on the production server (AWS EC2 running Linux).  I am trying to repeat the process on Macbook Pro running OS X 10.11.3.  So far, I have had no problems with compiling, installing and loading both the mysql and httpd servers.

 

I am able to compile PHP7 without errors.  I have installed FreeType 2.6.2, LibJPEG 9b, and libPNG 1.6.21 in /usr/local and compiled PHP with the following configuration:

 

./configure --prefix=/usr/local --with-config-file-path=/usr/local/etc --with-config-file-scan-dir=/usr/local/etc/php --with-apxs2=/usr/local/bin/apxs --enable-calendar --enable-cli --enable-exif --enable-ftp --enable-pcntl --enable-shmop --enable-sockets --enable-wddx --enable-zip --with-bz2 --with-curl --with-gd --with-freetype-dir=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-imap-ssl --with-mysqli=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-openssl --with-openssl-dir=/usr/local --with-pdo-mysql=mysqlnd --with-pear --with-libedit --with-xsl --with-zlib

 

PHP compiles and installs without error.  The CLI binary responds without error:

 

$ php -v

PHP 7.0.2 (cli) (built: Feb  6 2016 22:02:36) ( NTS )

Copyright (c) 1997-2015 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

 

However, when I try to load Apache I get an error:

 

$ sudo /usr/local/sbin/apachectl -t

httpd: Syntax error on line 150 of /usr/local/etc/httpd.conf: Cannot load libexec/libphp7.so into server: dlopen(/usr/local/libexec/libphp7.so, 10): Symbol not found: __cg_jpeg_resync_to_restart\n  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib \n  Expected in: /usr/local/lib/libjpeg.9.dylib\n in /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib

 

Based on input from Googling, I altered the file /usr/local/sbin/envvars and /usr/local/sbin/envvars-std.

 

Originally:

if test "x$DYLD_LIBRARY_PATH" != "x" ; then

  DYLD_LIBRARY_PATH="/usr/local/lib:$DYLD_LIBRARY_PATH"

else

  DYLD_LIBRARY_PATH="/usr/local/lib"

fi

 

Edited to:

if test "x$DYLD_LIBRARY_PATH" != "x" ; then

  DYLD_LIBRARY_PATH="/usr/local/lib"

else

  DYLD_LIBRARY_PATH="/usr/local/lib"

fi

export DYLD_LIBRARY_PATH


Based on more Googling, I ran otools on the binaries to try and find out where libTIFF.dylib is being referenced.


$ otool -L /usr/local/libexec/libphp7.so

/usr/local/libexec/libphp7.so:

    /usr/local/lib/libaprutil-1.0.dylib (compatibility version 6.0.0, current version 6.4.0)

    /usr/lib/libexpat.1.dylib (compatibility version 7.0.0, current version 8.0.0)

    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)

    /usr/local/lib/libapr-1.0.dylib (compatibility version 6.0.0, current version 6.2.0)

    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)

    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)

    /usr/lib/libexslt.0.dylib (compatibility version 9.0.0, current version 9.15.0)

    /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0)

    /usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)

    /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)

    /usr/local/lib/libpng16.16.dylib (compatibility version 38.0.0, current version 38.0.0)

    /usr/local/lib/libjpeg.9.dylib (compatibility version 12.0.0, current version 12.0.0)

    /usr/lib/libcurl.4.dylib (compatibility version 7.0.0, current version 8.0.0)

    /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)

    /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)

    /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 55.1.0)

    /usr/local/lib/libfreetype.6.dylib (compatibility version 19.0.0, current version 19.2.0)

    /usr/lib/libxslt.1.dylib (compatibility version 3.0.0, current version 3.26.0)


$ otool -L /usr/local/lib/libjpeg.9.dylib

/usr/local/lib/libjpeg.9.dylib:

    /usr/local/lib/libjpeg.9.dylib (compatibility version 12.0.0, current version 12.0.0)

    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1


I am at a loss.  I do not see how and where the system's libTIFF.dylib is being referenced, and what I can do to correct this problem so that PHP7 compiles purely against the libjpeg library in /usr/local.


Any help and guidance will be greatly appreciated.

MacBook Pro with Retina display, OS X El Capitan (10.11.3), 2.3GHz i7, 16GB, NVIDIA GeForce GT

Posted on Feb 7, 2016 9:06 AM

Close

Q: libphp7.so generates error with httpd.2.4.18 - Symbol not found: __cg_jpeg_resync_to_restart

  • All replies
  • Helpful answers

  • by Linc Davis,

    Linc Davis Linc Davis Feb 7, 2016 11:11 AM in response to aldisa
    Level 10 (207,926 points)
    Applications
    Feb 7, 2016 11:11 AM in response to aldisa

    You'll have a much better chance of getting that open-source stuff to work if you use a build system such as "MacPorts," "HomeBrew," or "Fink." You'll also have access to mailing lists where you might find others who have solved the same problem you have. There's almost no chance of finding anyone like that here.

  • by etresoft,Helpful

    etresoft etresoft Feb 7, 2016 3:10 PM in response to aldisa
    Level 7 (29,056 points)
    Feb 7, 2016 3:10 PM in response to aldisa

    Hello aldisa,

    Here is the most likely solution:

    http://stackoverflow.com/questions/24598566/mamp-dyld-symbol-not-found-cg-jpeg-r esync-to-restart-referenced-from-sys

     

    This is a common problem so if you google for "Symbol not found: __cg_jpeg_resync_to_restart" I'm sure you'll find others.

     

    The problem here is that dynamic libraries can be loaded, well, dynamically. You are linking with gd and that is probably what is pulling in the TIFF library and conflicting with JPEG. It will take some effort to get all of this running on OS X. My suggestion is to just run it on Linux in a VM. That will be much closer to your production platform.

  • by aldisa,

    aldisa aldisa Feb 7, 2016 3:12 PM in response to etresoft
    Level 1 (0 points)
    Feb 7, 2016 3:12 PM in response to etresoft

    I had tried to alter the contents of the /usr/local/sbin/envvars file.

     

    Instead, as per the guidance on the page you referred me to, simply renaming (i.e. removing) the envvars file was the solution.

     

    Thank you, etresoft, for your help.  I had been googling the error message for some time but somehow missed the recommendation to rename the envvars file.