PhantomJS 2 does not build on OS X 10.0 (Yosemite)
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
Duplicate of #12622.
#12622 is about PhantomJS 1 not building ob Yosemite, this one is about PhantomJS 2. Why a duplicate?
@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.
@mzgol @sikachu Good catch! Thanks for the notice. Reopening since this is for PhantomJS 2.
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.
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.
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.
Updating qcocoaapplicationdelegate.mm solved my problem. Thanks @bprodoehl
hello, I tried the replacement of that file but didn't work for me, I have more errors now
@antonioreyna What errors are you seeing?
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
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 :(
Hi all, will be a solution?
Please fix this. We really want to use phantomjs2 on Mac OSX.
Thank you!
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
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 https://github.com/Homebrew/homebrew/issues/29837
@lentan1029 Good Job, your solution is functional.
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
When will be this fix merged to 2.0 branch? Thanks
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