Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

PhantomJS 2 does not build on OS X 10.0 (Yosemite) #12630

Closed
sikachu opened this issue Oct 5, 2014 · 36 comments
Closed

PhantomJS 2 does not build on OS X 10.0 (Yosemite) #12630

sikachu opened this issue Oct 5, 2014 · 36 comments
Assignees
Labels

Comments

@sikachu
Copy link

sikachu commented Oct 5, 2014

There're several warning along the way, but the error that fails the build was:

/Applications/Xcode-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -c -pipe -O2 -isysroot /Applications/Xcode-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -mmacosx-version-min=10.6 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_GRAPHICSVIEW -DQT_NO_GRAPHICSEFFECT -DQT_NO_STYLESHEET -DQT_NO_STYLE_CDE -DQT_NO_STYLE_CLEANLOOKS -DQT_NO_STYLE_MOTIF -DQT_NO_STYLE_PLASTIQUE -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_STATICPLUGIN -DQT_PLUGIN -DQT_PRINTSUPPORT_LIB -DQT_PLATFORMSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/macx-clang -I. -I../../../../include/QtPrintSupport/5.3.0 -I../../../../include/QtPrintSupport/5.3.0/QtPrintSupport -I../../../../include -I../../../../include/QtPrintSupport -I../../../../include/QtWidgets/5.3.0 -I../../../../include/QtWidgets/5.3.0/QtWidgets -I../../../../include/QtPlatformSupport -I../../../../include/QtPlatformSupport/5.3.0 -I../../../../include/QtPlatformSupport/5.3.0/QtPlatformSupport -I../../../../include/QtWidgets -I../../../../include/QtGui/5.3.0 -I../../../../include/QtGui/5.3.0/QtGui -I../../../../include/QtCore/5.3.0 -I../../../../include/QtCore/5.3.0/QtCore -I../../../../include/QtGui -I../../../../include/QtCore -I.moc qcocoaapplicationdelegate.mm -o .obj/qcocoaapplicationdelegate.o
qcocoaapplicationdelegate.mm:127:28: error: cannot initialize a parameter of type 'id<NSFileManagerDelegate>' with an lvalue of type 'NSObject<NSApplicationDelegate> *'
        [NSApp setDelegate:reflectionDelegate];
                           ^~~~~~~~~~~~~~~~~~
/Applications/Xcode-Beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSFileManager.h:109:47: note: passing argument to parameter 'delegate' here
@property (assign) id <NSFileManagerDelegate> delegate NS_AVAILABLE(10_5, 2_0);
                                              ^
1 error generated.

Please see the full build log here: https://gist.github.com/sikachu/131b66a23010aad6b785

@ariya
Copy link
Owner

ariya commented Oct 8, 2014

Duplicate of #12622.

@ariya ariya closed this as completed Oct 8, 2014
@mgol
Copy link

mgol commented Oct 8, 2014

#12622 is about PhantomJS 1 not building ob Yosemite, this one is about PhantomJS 2. Why a duplicate?

@sikachu
Copy link
Author

sikachu commented Oct 8, 2014

@ariya I'm installing using --HEAD flag, which I assume is pulling from master. Is master branch PhantomJS 2? If so, this issue would be unrelated to #12622.

@ariya
Copy link
Owner

ariya commented Oct 8, 2014

@mzgol @sikachu Good catch! Thanks for the notice.
Reopening since this is for PhantomJS 2.

@ariya ariya reopened this Oct 8, 2014
@ariya ariya added this to the Release 2.0 milestone Oct 8, 2014
@bprodoehl
Copy link

I got past the problem by replacing the affected file (src/qt/qtbase/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm) with this one:

https://qt.gitorious.org/qt/qtbase/source/d0a6fcd925dc2a1553e2086e85f59ba76db85bef:src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm

It looks like that's part of Qt 5.3.2.

@gmile
Copy link

gmile commented Oct 17, 2014

Haven't tried this yet, but might work – http://blog.antas.cz/phantomjs-os-x-yosemite. The idea is to just download & use a pre-compiled phantomjs binary. homebrew recipe, to contrast, is building phantomjs from source.

@bprodoehl
Copy link

Yeah, if you just want to try a snapshot of PhantomJS 2 on Yosemite, that works. I have binaries here: https://github.com/bprodoehl/phantomjs/releases

That macosx binary was built on Mavericks, but ran for me on Yosemite.

I think moving from Qt 5.3.0 to Qt 5.3.2 will fix the build on Yosemite, though. At least, it did for me.

@Audio
Copy link

Audio commented Nov 3, 2014

Updating qcocoaapplicationdelegate.mm solved my problem. Thanks @bprodoehl

@antonioreyna
Copy link

hello, I tried the replacement of that file but didn't work for me, I have more errors now

@bprodoehl
Copy link

@antonioreyna What errors are you seeing?

@antonioreyna
Copy link

let me check.

While i show you the osx output i am having also problems with centos, im getting this:

standard input}: Assembler messages:
{standard input}:12160: Warning: end of file not at end of a line; newline inserted
{standard input}:12886: Error: bad register name `%'
{standard input}:12886: Error: open CFI at the end of file; missing .cfi_endproc directive
g++: Internal error: Killed (program cc1plus)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make[2]: *** [.obj/bytecompiler/NodesCodegen.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/var/www/vhosts/kaandev.com/api.transpais/vendor/danielboendergaard/phantom-pdf/bin/phantomjs/src/qt/qtwebkit/Source/JavaScriptCore'
make[1]: *** [sub-Target-pri-make_first-ordered] Error 2
make[1]: Leaving directory `/var/www/vhosts/kaandev.com/api.transpais/vendor/danielboendergaard/phantom-pdf/bin/phantomjs/src/qt/qtwebkit/Source/JavaScriptCore'
make: *** [sub-Source-JavaScriptCore-JavaScriptCore-pro-make_first-ordered] Error 2

@antonioreyna
Copy link

OSX output

icu.cpp:42:10: fatal error: 'unicode/utypes.h' file not found
#include <unicode/utypes.h>
         ^
1 error generated.
make: *** [icu.o] Error 1

another

xlib.cpp:42:10: fatal error: 'X11/Xlib.h' file not found
#include <X11/Xlib.h>
         ^
1 error generated.
make: *** [xlib.o] Error 1
clock-gettime.cpp:51:4: error: "Feature _POSIX_TIMERS not available"
#  error "Feature _POSIX_TIMERS not available"
   ^
clock-gettime.cpp:53:5: error: use of undeclared identifier 'force_compiler_error'
    force_compiler_error = true;
    ^
2 errors generated.

....

posix_fallocate.cpp:46:14: error: no member named 'posix_fallocate' in the global namespace
    return ::posix_fallocate(0, 0, 0);
           ~~^
1 error generated.
make: *** [posix_fallocate.o] Error 1
posix_fallocate disabled.
mremap auto-detection... ()
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -DQT_NO_GRAPHICSVIEW -DQT_NO_GRAPHICSEFFECT -DQT_NO_STYLESHEET -DQT_NO_STYLE_CDE -DQT_NO_STYLE_CLEANLOOKS -DQT_NO_STYLE_MOTIF -DQT_NO_STYLE_PLASTIQUE -O2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -mmacosx-version-min=10.6 -Wall -W -fPIE  -I../../../mkspecs/macx-clang -I. -I/usr/local/include -o mremap.o mremap.cpp
mremap.cpp:47:14: error: no member named 'mremap' in the global namespace
    (void) ::mremap(static_cast<void *>(0), size_t(0), size_t(42), MREMAP_MAYMOVE);
           ~~^
mremap.cpp:47:68: error: use of undeclared identifier 'MREMAP_MAYMOVE'
    (void) ::mremap(static_cast<void *>(0), size_t(0), size_t(42), MREMAP_MAYMOVE);
                                                                   ^
2 errors generated.
make: *** [mremap.o] Error 1

and more :(

@rdpanek
Copy link

rdpanek commented Nov 27, 2014

Hi all, will be a solution?

@tillvollmer
Copy link

Please fix this. We really want to use phantomjs2 on Mac OSX.

Thank you!

@BananaNeil
Copy link

I'm also having this issue. Unfortunately, replacing (src/qt/qtbase/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm) with:
https://qt.gitorious.org/qt/qtbase/source/d0a6fcd925dc2a1553e2086e85f59ba76db85bef:src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm did not work for me.

After switching it out, I'm now seeing these errors:

In file included from Modules/geolocation/Coordinates.cpp:27:
Modules/geolocation/Coordinates.h:36:12: error: unknown type name 'PassRefPtr'
    static PassRefPtr<Coordinates> create(double latitude, double longitude, bool provi...
           ^
Modules/geolocation/Coordinates.h:36:22: error: expected member name or ';' after declaration
      specifiers
    static PassRefPtr<Coordinates> create(double latitude, double longitude, bool provi...
    ~~~~~~~~~~~~~~~~~^
Modules/geolocation/Coordinates.cpp:31:21: error: out-of-line definition of 'altitude' does not
      match any declaration in 'WebCore::Coordinates'
double Coordinates::altitude(bool& isNull) const
                    ^~~~~~~~
3 errors generated.
make[2]: *** [.obj/Modules/geolocation/Coordinates.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [sub-Target-pri-make_first-ordered] Error 2

@tetratorus
Copy link

I managed to get phantomjs 2.0.0 to build on Yosemite 10.10.1 by editing src/qt/qtbase/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm

- (void)dealloc
{
    sharedCocoaApplicationDelegate = nil;
    [dockMenu release];
    [qtMenuLoader release];
    if (reflectionDelegate) {
        [NSApp setDelegate:reflectionDelegate]; // replace this line with [[NSApplication sharedApplication] setDelegate:reflectionDelegate];
        [reflectionDelegate release];
    }
    [[NSNotificationCenter defaultCenter] removeObserver:self];

    [super dealloc];
}

taken from Homebrew/legacy-homebrew#29837

@rdpanek
Copy link

rdpanek commented Jan 9, 2015

@lentan1029 Good Job, your solution is functional.

@Aetherpoint
Copy link

Got the same errors on Yosemite 10.10.1 and worked through the wiki checks and @lentan1029's solution.

What's the final output when building supposed to be? Getting this at the end, and it's still reporting 1.9.8 with phantom.version.


-L/Users/username/Repos/phantomjs/src/qt/qtbase/plugins/bearer -lqcorewlanbearer -framework CoreWLAN -lqgenericbearer -lQt5Network -lssl -lcrypto -L/Users/username/Repos/phantomjs/src/qt/qtbase/plugins/platforms -lqphantom -lQt5PlatformSupport -framework OpenGL -L/Users/username/Repos/phantomjs/src/qt/qtbase/plugins/imageformats -lqico -lQt5Gui -lqtharfbuzzng -lQt5Core -lz -lm

@rdpanek
Copy link

rdpanek commented Jan 27, 2015

When will be this fix merged to 2.0 branch? Thanks

@eugene1g
Copy link
Contributor

eugene1g commented Feb 1, 2015

Thanks @lentan1029 for the pointer in the right direction. I applied your patch and compiled OSX/ubuntu/centos binaries for myself and others at https://github.com/eugene1g/phantomjs/releases

@ariya ariya modified the milestones: Release 2.0.1, Release 2.0 Feb 7, 2015
@dysfungi
Copy link

@lentan1029 got it right for Yosemite 10.10.2

@jywsn
Copy link

jywsn commented Feb 13, 2015

I can also confirm that @lentan1029 got it right for Yosemite 10.10.2

pigats added a commit to pigats/phantomjs that referenced this issue Feb 23, 2015
@ariya ariya closed this as completed Mar 2, 2015
@ariya ariya added the Resolved label Mar 2, 2015
AkeemMcLennon added a commit to AkeemMcLennon/phantomjs that referenced this issue Mar 8, 2015
Issue ariya#12630: Support compiling on OSX10.10...
@tracer123
Copy link

@eugene1g Your solution worked perfectly. Thanks!

donsunsoft added a commit to donsunsoft/phantomjs that referenced this issue Mar 14, 2015
Issue ariya#12630: Support compiling on OSX10.10...
@kamote
Copy link

kamote commented Apr 13, 2015

brew install phantomjs

@jancurn
Copy link

jancurn commented Jul 20, 2015

@antonioreyna I had the same problem when building PhantomJS 2 from sources on Mac OS X Yosemite. It was caused by left-over files from a previous build on Windows. git clean -fx fixed the problem.

@gdubicki
Copy link

gdubicki commented Sep 5, 2015

+1 @kamote - it just works

@mareknov
Copy link

@antonioreyna how did you solve compilation errors? I'm having the same problem on Yosemite 10.10.5, Xcode (both 6.4 and 7.0 beta 6) and none of the aforementioned solutions work for me.

@antonioreyna
Copy link

@mareknov hello, I downloaded a pre-compiled binary and I have been working with that without any problems so far, here is what i use in OSX, if you need it, I hope it helps you https://dl.dropboxusercontent.com/u/1011606/phantomjs-osx-2.zip

@mareknov
Copy link

@antonioreyna thanks for the binary. It works ok as well as installation through homebrew, but I wanted to compile it. On Ubuntu it works for me without any issues.

@antonioreyna
Copy link

@mareknov yes, i have it on debian and everything is ok too. Let us know if you find out a solution :) on Yosemite and I hope it works also on El Capitan.

@sebastianbochan
Copy link

+1 @kamote - it just works

@zackw zackw modified the milestones: Release 2.0.1, Release 2.1 Dec 23, 2015
jwiegley referenced this issue in NixOS/nixpkgs Jan 12, 2018
- add phantomjs2 to PATH for openload plugin
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests