wxphp / wxphp

Build cross-platform software with rich native GUIs using the combined power of the PHP language and the wxWidgets library.
Other
360 stars 46 forks source link

macOS build - missing wxwidgets.so #151

Open rtrzebinski opened 8 years ago

rtrzebinski commented 8 years ago

Steps to reproduce:

PHP Warning:  PHP Startup: Unable to load dynamic library '/Users/robert/projects/wxphp-test2/myapp.app/Contents/MacOS/php/lib/php/extensions/no-debug-zts-20121212/wxwidgets.so' - dlopen(/Users/robert/projects/wxphp-test2/myapp.app/Contents/MacOS/php/lib/php/extensions/no-debug-zts-20121212/wxwidgets.so, 9): image not found in Unknown on line 0

Fatal error: Class 'wxFrame' not found in /Users/robert/projects/wxphp-test2/index.php on line 9

Any help will be appreciated.

rtrzebinski commented 8 years ago

I tried today again on another Mac machine - same result. This is the very end of command output:

Starting wxphp configuration process...

sh: ./configure: No such file or directory
Compiling wxphp...

make: *** No targets specified and no makefile found.  Stop.
Copying php into the application bundle...

Done!
jgmdev commented 8 years ago

I don't have access to a MacOSX machine so I haven't tested the mac bundle script in a long time, but you can try the normal build procedure:

phpize
./configure
make

After that you can try troubleshooting the bundle generation script or manually build a bundle. You can also read https://github.com/wxphp/wxphp/wiki/building-on-macosx and adjust it to meet your needs, like using brew instead of port, etc... Also notice that the config.m4 used to generate the configure script file, automatically downloads and builds wxWidgets in static mode and links to it for our wxwidgets.so extension, if this fails on mac then you can try to build wxWidgets separately and link to it using ./configure --with-wxwidgets=/path

Also the install.md file has more up to date build instructions for mac adjusted by @chrisnharvey

rtrzebinski commented 8 years ago

@jgmdev thanks for your reply!

So when I run phpize from repo root I got:

Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

if I run from src folder I got:

Cannot find config.m4. 
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module

I use the following php version:

$ php -v
PHP 5.5.36 (cli) (built: May 29 2016 01:07:06) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

Seems like some files are missing, do you have any idea what this might be? I promise to update documentation once I finally get there! :)

jgmdev commented 8 years ago
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

That means you need to install autoconf package on mac before running phpize like:

brew install autoconf

To be more sure we are getting everything we need also install automake if available:

brew install autoconf automake

Also make sure you installed xcode, I dont remember properly if installing xcode also setups autoconf for you.

If you are sure you have autoconf tools installed then you can setup the PHP_AUTOCONF environment variable like phpize is instructing, for example:

PHP_AUTOCONF=/path/to/autoconf phpize

rtrzebinski commented 8 years ago

Thanks, I installed autoconfig and I can run ./configure now. I got the following errors:

../src/osx/webview_webkit.mm:936:25: error: cannot initialize a variable of type 'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'
    WebBackForwardList* history = [m_webView backForwardList];
                        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/osx/webview_webkit.mm:954:25: error: cannot initialize a variable of type 'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'
    WebBackForwardList* history = [m_webView backForwardList];
                        ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                              ^
31 warnings and 2 errors generated.
make: *** [monolib_osx_webview_webkit.o] Error 1
not found
configure: error: A matching wxWidgets installation was not found```
rtrzebinski commented 8 years ago

I also tried on another machine, got the following errors:

make: *** [monolib_carbon_font.o] Error 128
make: *** Waiting for unfinished jobs....
clang: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable
clang: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable
/Users/robert/projects/wxphp/wxWidgets-3.0.2/mybuild/bk-deps: fork: Resource temporarily unavailable
/Users/robert/projects/wxphp/wxWidgets-3.0.2/mybuild/bk-deps: fork: Resource temporarily unavailable
/Users/robert/projects/wxphp/wxWidgets-3.0.2/mybuild/bk-deps: fork: Resource temporarily unavailable
/Users/robert/projects/wxphp/wxWidgets-3.0.2/mybuild/bk-deps: fork: Resource temporarily unavailable
clang: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable
clang: error: unable to execute command: posix_spawn failed: Resource temporarily unavailable
/Users/robert/projects/wxphp/wxWidgets-3.0.2/mybuild/bk-deps: fork: Resource temporarily unavailable
/Users/robert/projects/wxphp/wxWidgets-3.0.2/mybuild/bk-deps: fork: Resource temporarily unavailable
make: *** [monolib_carbon_combobox.o] Error 1
make: *** [monolib_glgrab.o] Error 1
make: *** [monolib_carbon_graphics.o] Error 1
make: *** [monolib_carbon_dcprint.o] Error 1
jgmdev commented 8 years ago

It seems the a monolithic wxwidgets build isn't properly working on macosx, did you tried this building instructions https://github.com/wxphp/wxphp/blob/master/INSTALL.md#building-on-mac-os-x

That building instructions basically build wxWidgets as a dynamic library which you can use to then link with wxphp.

rtrzebinski commented 8 years ago

Yes I tried, also got error:

checking for SDK directory /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk... configure: error: in `/Users/robert/projects/wxWidgets.git/mybuild':
configure: error: not found
See `config.log' for more details

Log file: config.log.zip

jgmdev commented 8 years ago

It seems you are running a more recent version of macosx, you can open a terminal or file manager and browse the /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs to see what is the proper sdk file name, or as the install instructions say also check the /Developer/SDKs/ directory to see if an applicable sdk is there and then change the configure line to point into the proper path of the SDK.

rtrzebinski commented 8 years ago

It helped and I can configure now without errors. Unfortunately got this error on make stage:

../src/osx/core/bitmap.cpp:39:10: fatal error: 'QuickTime/QuickTime.h' file not found
#include <QuickTime/QuickTime.h>
         ^
10 warnings and 1 error generated.
make: *** [coredll_core_bitmap.o] Error 1
jgmdev commented 8 years ago

Here is some discussion going that might help https://forum.openframeworks.cc/t/quicktime-quicktime-h-file-not-found/24494/4