Skip to content

macOS build - missing wxwidgets.so #151

Description

@rtrzebinski

Steps to reproduce:

  • use macOS 10.11.6 (15G31)
  • clone repository and checkout master branch (1e33074) into folder wxphp
  • got to wxphp/tools/macosx_bundle
  • run php bundle_generator.php
  • bundle myapp.app will be generated (it takes a while)
  • double click myapp.app to open the app
  • a terminal window will appear
  • type wxphp index.php where index.php contains a valid wxPHP code
  • the following error will appear:
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.

Activity

  1. rtrzebinski commented on Sep 12, 2016

    @rtrzebinski
    Author

    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!
    
  2. jgmdev commented on Sep 13, 2016

    @jgmdev
    Member

    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

  3. rtrzebinski commented on Sep 13, 2016

    @rtrzebinski
    Author

    @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! :)

  4. jgmdev commented on Sep 13, 2016

    @jgmdev
    Member
    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

  5. rtrzebinski commented on Sep 14, 2016

    @rtrzebinski
    Author

    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```
    
  6. rtrzebinski commented on Sep 14, 2016

    @rtrzebinski
    Author

    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
    
  7. jgmdev commented on Sep 15, 2016

    @jgmdev
    Member

    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.

  8. rtrzebinski commented on Sep 19, 2016

    @rtrzebinski
    Author

    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

  9. jgmdev commented on Sep 20, 2016

    @jgmdev
    Member

    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.

  10. rtrzebinski commented on Sep 20, 2016

    @rtrzebinski
    Author

    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
    
  11. jgmdev commented on Sep 20, 2016

    @jgmdev
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions