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

Static build complication on Linux due to OpenSSL and ICU #12948

Closed
ariya opened this issue Feb 4, 2015 · 190 comments
Closed

Static build complication on Linux due to OpenSSL and ICU #12948

ariya opened this issue Feb 4, 2015 · 190 comments

Comments

@ariya
Copy link
Owner

ariya commented Feb 4, 2015

Compared to 1.x, PhantomJS 2.0 has exhibits some problem when being built statically to produce the official Linux binaries.

@ariya
Copy link
Owner Author

ariya commented Feb 4, 2015

When the binary is built on Centos 6.6 and tested on Ubuntu 12.04, there will be this error:

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.5 LTS"
$ bin/phantomjs 
bin/phantomjs: error while loading shared libraries: libicudata.so.42: cannot open shared object file: No such file or directory
$ ldd bin/phantomjs 
    linux-vdso.so.1 =>  (0x00007fff31fff000)
    libicudata.so.42 => not found
    libssl.so.10 => not found
    libcrypto.so.10 => not found
    libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007ff99863e000)
    libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ff9983a2000)
    libjpeg.so.62 => not found
    libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007ff998179000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ff997f62000)
    libicui18n.so.42 => not found
    libicuuc.so.42 => not found
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff997d5d000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff997b54000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff997937000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff997637000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff99733a000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff997124000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff996d65000)
    /lib64/ld-linux-x86-64.so.2 (0x00007ff99887d000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007ff996b3a000)

@ariya
Copy link
Owner Author

ariya commented Feb 4, 2015

When the binary is built on Ubuntu 12.04 and tested on CentOS 6, there is this error:

$ cat /etc/redhat-release 
CentOS release 6.6 (Final)
$ bin/phantomjs 
bin/phantomjs: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: No such file or directory
$ ldd bin/phantomjs 
bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by bin/phantomjs)
bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by bin/phantomjs)
bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by bin/phantomjs)
    linux-vdso.so.1 =>  (0x00007fff9e9ff000)
    libssl.so.1.0.0 => not found
    libcrypto.so.1.0.0 => not found
    libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x0000003970600000)
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x0000003970e00000)
    libjpeg.so.8 => not found
    libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x0000003974200000)
    libz.so.1 => /lib64/libz.so.1 (0x000000396fa00000)
    libicui18n.so.48 => not found
    libicuuc.so.48 => not found
    libdl.so.2 => /lib64/libdl.so.2 (0x000000396e600000)
    librt.so.1 => /lib64/librt.so.1 (0x000000396f200000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x000000396ee00000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fbbd8347000)
    libm.so.6 => /lib64/libm.so.6 (0x000000396f600000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fbbd8130000)
    libc.so.6 => /lib64/libc.so.6 (0x000000396ea00000)
    /lib64/ld-linux-x86-64.so.2 (0x000000396e200000)
    libexpat.so.1 => /lib64/libexpat.so.1 (0x0000003973600000)

@ariya
Copy link
Owner Author

ariya commented Feb 4, 2015

As a comparison, ldd on PhantomJS 1.9.8 statically built binary on Ubuntu 12.04 gives the following:

ldd bin/phantomjs 
    linux-vdso.so.1 =>  (0x00007fff987cf000)
    libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f88af68e000)
    libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f88af458000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f88af253000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f88af04b000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f88aee2e000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f88aeb2d000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f88ae831000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f88ae61b000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f88ae25b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f88af932000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f88ae044000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f88ade1a000)

@ariya ariya mentioned this issue Feb 4, 2015
7 tasks
@vitallium
Copy link
Collaborator

ICU upstream bug: https://bugreports.qt.io/browse/QTBUG-38445

@vitallium
Copy link
Collaborator

@ariya, found the problem. Starting commit - 8d23afb

@ariya
Copy link
Owner Author

ariya commented Feb 6, 2015

@vitallium Do you mean that the mentioned commit start to introduce the broken build?

@vitallium
Copy link
Collaborator

@ariya yes, check the line 162 https://github.com/ariya/phantomjs/blob/2.0/src/qt/preconfig.sh#L162 I assume it should be just openssl.

@vitallium
Copy link
Collaborator

With openssl, I got this on Ubuntu 14.04:

 ldd ../bin/phantomjs 
    linux-vdso.so.1 =>  (0x00007fff347c0000)
    libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f9fe8df8000)
    libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f9fe8b50000)
    libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f9fe8748000)
    libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f9fe83c8000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9fe81c0000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9fe7fb8000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9fe7d98000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9fe7a90000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9fe7788000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9fe7570000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9fe71a8000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f9fe9050000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f9fe6f78000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f9fe6d58000)
    libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f9fe6b30000)
    libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f9fe52c0000)

@ariya
Copy link
Owner Author

ariya commented Feb 7, 2015

@vitallium Good news! Now we just need to solve the ICU library...

@kenips
Copy link

kenips commented Feb 12, 2015

@ariya isn't ICU bug fixed in 5.3.1? Or we're talking about something else?

@ariya
Copy link
Owner Author

ariya commented Feb 13, 2015

@kenips Can you elaborate?

@kenips
Copy link

kenips commented Feb 13, 2015

hey @ariya I thought the ICU bug is https://bugreports.qt.io/browse/QTBUG-38445, which is fixed in 5.3.1, isn't it?

@ohenak
Copy link

ohenak commented Feb 18, 2015

Want to bring this up again as my team is depending on PhantomJS 2.0 for testing.
However, I am not expert in this. How can I help verifying one static build is working, what is the metric of testing we are looking at?

If I simply do ./build.sh and it completed successfully, does it mean I can copy over to other machines to test?

@AkeemMcLennon
Copy link

@ohenak From my understanding, that should theoretically work across similar environments. (e.g. all machines running the same version of Ubuntu).

@achiang
Copy link

achiang commented Feb 25, 2015

I do think ICU was fixed in 5.3.1, but Ubuntu 14.04 has an older version:

libqt5core5a:amd64 5.2.1+dfsg-1ubuntu14.2

@achiang
Copy link

achiang commented Feb 25, 2015

Probably this fix can be backported:

https://codereview.qt-project.org/#/c/84012/

Although it's not clear to me whether the problem is in the bundled Qt or in the system's version of Qt.

@avindra
Copy link

avindra commented Mar 5, 2015

Any ETA / roadmap on this issue? We would like to deploy PhantomJS 2.0 without having to compile.

@ashkulz
Copy link
Contributor

ashkulz commented Mar 9, 2015

The only solution which is sustainable in the long term is to have distro-specific packages, like I have done for wkhtmltopdf. Due to the patched/bundled Qt, it does not get packaged with most distributions anyway so having "official" binaries is important.

I'm willing to take up just the packaging part, as I'll be working on that anyway in the near future for wkhtmltopdf 0.13 based on Qt 5.4.1 😄

@ashkulz
Copy link
Contributor

ashkulz commented Mar 9, 2015

Note that I won't be supporting CentOS 5, as not all security fixes are being backported and getting it to work would be very tough due to very old software versions.

@zachgersh
Copy link

For people that are actually looking for a built binary of phantom-js 2.0 it seems that the Travis-CI team has one (currently only for Ubuntu-12.04). Thought this would at least help some people on the thread until official binaries are available.

https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2

We've got this working on 14.04 by manually installing (dpkg) this package:

http://mirrors.kernel.org/ubuntu/pool/main/i/icu/libicu48_4.8.1.1-3ubuntu0.4_amd64.deb

@emaphp
Copy link

emaphp commented Mar 12, 2015

you can download libicu for ubuntu 14 (amd64) from this link: http://packages.ubuntu.com/en/precise/amd64/libicu48/download

sudo dpkg -i [package-name].deb

@ariya
Copy link
Owner Author

ariya commented Mar 13, 2015

@ashkulz Good call on CentOS 5. PhantomJS 2 probably should not be bothered with it.

@ariya
Copy link
Owner Author

ariya commented Mar 13, 2015

@emaphp This issue has nothing to do with libicu availability.

@Pyppe
Copy link

Pyppe commented Mar 13, 2015

FYI: I added compiled binary, built on Ubuntu 14.04 x64 (DigitalOcean 8GB virtual machine), if someone else finds it helpful: https://github.com/Pyppe/phantomjs2.0-ubuntu14.04x64

@zackw zackw modified the milestones: Release 2.0.1, Release 2.1 Dec 23, 2015
@jeanlucaslima
Copy link

Is it solved? Any help needed?

@Vanuan
Copy link

Vanuan commented Dec 26, 2015

@jeanleonino I don't think it's solved. An official phantomjs 2.x binary for Linux is still missing.

@Vanuan
Copy link

Vanuan commented Dec 26, 2015

On the other hand, it looks like being fixed in #13822

@bprodoehl
Copy link

Work is ongoing in #13822, and it sounds really close.

On Saturday, December 26, 2015, John Yani notifications@github.com wrote:

@jeanleonino https://github.com/jeanleonino I don't think so. An
official phantomjs 2.x binary for Linux is still missing.


Reply to this email directly or view it on GitHub
#12948 (comment).

http://www.connectify.me/

This email message is for the sole use of the intended recipient(s) and may
contain Connectify confidential or privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not an
intended recipient, please contact the sender by reply email and destroy
all copies of the original message.

@ariya
Copy link
Owner Author

ariya commented Dec 27, 2015

The solution is to use Docker. The binaries will be provided in the next release 2.1 (when? whenever it's ready!). For further details, refer to #13822 and/or consult the mailing-list.

@ariya ariya closed this as completed Dec 27, 2015
@jeanlucaslima
Copy link

@ariya Thanks, and thanks for closing. 👍

@iSuslov
Copy link

iSuslov commented Jan 6, 2016

Guys please make it finally for Ubuntu! It's almost a year since we don't have it. I tried building from binaries, and after 15 hours I still don't have it working!

@sproffer
Copy link

sproffer commented Jan 6, 2016

For ubuntu, take a look at below page :
https://github.com/bprodoehl/phantomjs/releases
On Jan 5, 2016 10:31 PM, "Ivan Suslov" notifications@github.com wrote:

Guys please make it finally for Ubuntu! It's almost a year since we don't
have it. I tried building from binaries, and after 15 hours I still don't
have it working!


Reply to this email directly or view it on GitHub
#12948 (comment).

@iSuslov
Copy link

iSuslov commented Jan 6, 2016

Thank you very much! It works!

@Vanuan
Copy link

Vanuan commented Jan 6, 2016

Ubuntu is trivial. The problem is with CentOS 6.

@ariya
Copy link
Owner Author

ariya commented Jan 7, 2016

Here is a summarized list of several alternatives for everyone.

If you can wait for an official Linux binary, watch for the next release of version 2.1. Follow #12970 for further detailed updates.

If you can't wait and you want to run PhantomJS on your own Linux system:

  • compile it yourself per the instruction given in http://phantomjs.org/build.html
  • unable to compile it yourself due to various reasons? Find a person you can trust to compile it for you

Note on trust: While you may have a certain level of trust on your Linux distribution, its packagers, or the folks behind PhantomJS, you need to be cautious in extending that trust to anyone (especially on the Intertubes). Downloading and running an executable from a random person is not necessary the best security practice.

If you want to find a way to build PhantomJS Linux binary statically:

I believe that everyone's needs can be fulfilled with one of the above paths.

Let's stop this thread for everyone's benefit.

@EFF
Copy link

EFF commented Jan 21, 2016

@sproffer got it working pretty easily on aws lambda with your centos7 build, thanks for the good work !

MatousJobanek added a commit to qa/arquillian-phantom-binary that referenced this issue Jan 22, 2016
Linux binaries exclusion - for more information see:
ariya/phantomjs#12948
@alexellis
Copy link

I am wanting to build PhantomJS for an ARMv7 Debian-based distro and output a static binary, I don't need a .deb file. There's a lot of noise on the thread you tell us to read.. can you point me at a Dockerfile or a clear set of instructions please? @ariya

@zowers
Copy link

zowers commented Aug 6, 2016

@alexellis as described in https://github.com/ariya/phantomjs/tree/master/deploy

Once you have Docker installed, run these commands from the top level of the PhantomJS source repository:

 $ git clean -xfd .
 $ docker run -v $PWD:/src debian:wheezy /src/deploy/docker-build.sh

@alexellis
Copy link

So there are no instructions for ARM processors? Is there any reason why you don't have a Dockerfile, too?

@wizardyhnr
Copy link

I have written a blog regarding cross compile armv7 binary in docker. You
can have a look at that:
http://wizardyhnr.blogspot.com/2016/04/how-to-build-cross-compliatio.html?m=1

On Sat, Aug 6, 2016 at 10:03 AM Alex Ellis notifications@github.com wrote:

So there are no instructions for ARM processors? Is there any reason why
you don't have a Dockerfile, too?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#12948 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHBcny-qnv5J44UEif5IFlVyZ7bM-elcks5qdJRLgaJpZM4DbY7J
.

@mschlebusch
Copy link

mschlebusch commented Nov 17, 2016

Is there any description how to build a PhantomJS version on Ubuntu with static dependencies (especially libicu) based on the latest sources?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests