I have a NodeJS app using PhantomJS to generate PDF files. My app is deployed to Heroku and I'm using this phantom build pack. Unfortunately this build pack does not support the page-break-inside: avoid CSS property.
I did a research and found 2 hacks on this GitHub issue page. I've tried both of them, but unfortunately I can't use the CSS one, due to my page structure and the JavaScript one isn't page-breaking properly.
One of the guys in the GitHub link above mentioned that this problem is fixed if I compile from source, but I have no idea how I can compile from source on Heroku App and is it even possible. All the buildpacks I found are using the binaries.
It's really important for my app to break pages properly, but I can't find a way to get this feature working. Any suggestion/guide about how to fix my issue will be greatly appreciated!
I've downloaded it to my machine(Debian 7.6.0) and compiled PhantomJS using this guide.
So I executed:
sudo apt-get update
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev libxft-dev
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 1.9
./build.sh
And then I took the binary from /bin folder and added it to custom buildpack. I added this buildpack to heroku, but it crashed with the following error:
/phantomjs: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./phantomjs)
So I did on my machine
ldd bin/phantomjs
and I took all dependencies:
root#deepsypotato:/home/viktor# ldd phantomjs.1
linux-vdso.so.1 => (0x00007fffe9f74000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fd914fcd000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fd914d96000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd914b91000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd914989000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd91476d000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd914465000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd9141e3000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd913fcd000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd913c41000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd915283000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd913a2a000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fd913800000)
then I copied libstdc++.so.6 from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 and added it to my custom buildpack and now its working flawlessly :).
Related
I'm trying to run RF-TrulyMagical, but it says:
error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory
I've tried re-installing the library and running apt-get update and ldconfig, but nothing's changed. The library is at /lib/x86_64-linux-gnu and that path was already listed (I didn't add it myself) in a file inside the /etc/ld.so.conf.d directory.
Output for ldd RF-TrulyMagical is:
linux-gate.so.1 (0xf7fa1000)
libSM.so.6 => not found
libICE.so.6 => not found
libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xf7f6f000)
libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xf7e25000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7e20000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xf7e16000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7df7000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf7c71000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7b6f000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf7b51000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7973000)
/lib/ld-linux.so.2 (0xf7fa2000)
libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xf7947000)
libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xf7943000)
libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xf793c000)
libbsd.so.0 => /lib/i386-linux-gnu/libbsd.so.0 (0xf7921000)
Somewhere it said I should install lib32-libsm, but apt-get says Unable to locate package.
I have no idea what to do. Thanks in advance. (I'm running Ubuntu 18.04.1, if that helps)
Might be a simple case of:
apt-get install libsm6:i386
I first cross compile my Rust project to linux target
cargo build --target x86_64-unknown-linux-gnu
Then run ldd on my local ubuntu and the linker works fine.
linux-vdso.so.1 (0x00007fffddc62000)
libssl.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f6d34500000)
libcrypto.so.1.0.0 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f6d340b0000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6d33ea0000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6d33c90000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6d33a70000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6d33850000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6d33440000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6d35a00000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6d330a0000)
But on my target os, ldd fails to find the libraries
libssl.so.1.0.0 => not found
libcrypto.so.1.0.0 => not found
/lib64/libc.so.6 => version `GLIBC_2.18' not found
Actually I have libssl.so.10 and libcrypto.so.10 installed under LD_LIBRARY_PATH. Unfortunately I am not able to install shared libraries of version 1.0.0 required by Rust.
I have read Rust Cross and the recommended solution is to install the missing shared libraries. Unfortunately that's not possible for me. So I am looking for alternative solutions to missing libraries.
libssl.so.1.0.0 and libcrypto.so.1.0.0 sound ancient. How can I tell cargo to use a later version?
How can I deal with /lib64/libc.so.6 => version GLIBC_2.18 not found?
According to this, GLIBC_2.18 can't be installed to RHEL7. I gave up dynamically linked libraries.
This post helped me out. The solution is:
[dependencies]
nats = "*"
protobuf = { version = "~2.0" }
# Add openssl-sys as a direct dependency so it can be cross compiled to
# x86_64-unknown-linux-musl using the "vendored" feature below
openssl-sys = "*"
[features]
# Force openssl-sys to staticly link in the openssl library. Necessary when
# cross compiling to x86_64-unknown-linux-musl.
vendored = ["openssl-sys/vendored"]
This way I can compile to a single executable with no library dependencies using:
cargo build --target=x86_64-unknown-linux-musl --features vendored
I use rust 1.34 and 1.35. Currently it links to GLIBC_2.18.
How can I limit cargo build to link GLIBC up to version 2.14?
Unfortunately, you can't. Not really, and not consistently. This is a problem with any binary that dynamically links to GLIBC. You can try setting up multiple GLIBC versions and linking to one, or you can try patching the resulting binary, but it's inconsistent and impractical.
So what are some practical options?
Compile Statically
By using MUSL instead of GLIBC we can compile statically.
To install the MUSL target with rustup (assuming x86_64 architecture):
$ rustup component add rust-std-x86_64-unknown-linux-musl
And to use it when compiling:
$ cargo build --target x86_64-unknown-linux-musl
This is the easiest method by far, but won't always work, especially when using native libraries, unless they can also be compiled statically.
Make a VM That Has an Older Version
This is a common approach. By using an OS with an outdated, GLIBC the binary will have GLIBC symbols that are compatible with it.
Use a Docker Container
This is probably the most convenient method, in my opinion. If you have Docker, you can just compile your project with a container that contains an old GLIBC. View the Rust contianer's README for compilation instructions. The command below will compile a project using Rust 1.67 and GLIBC 2.28 (which comes with buster):
$ docker run --rm --user "$(id -u)":"$(id -g)" -v "$PWD":/usr/src/myapp -w /usr/src/myapp rust:1.67-buster cargo build --release
I compiled this on Ubuntu 22.04 and tested it on Ubuntu 20.04.
To test further, I made sure the binary relied on another dynamic library (OpenSSL) and here's the result of ldd ./mybinary after compiling with the Docker container:
$ ldd ./mybinary
linux-vdso.so.1 (0x00007ffd98fdf000)
libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fe49e248000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe49e22d000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe49e223000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe49e200000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe49e0b1000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe49e0ab000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe49deb7000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe49ea30000)
And this is what it looks like without the container:
$ ldd ./mybinary
linux-vdso.so.1 (0x00007ffd5d7b7000)
libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007fe85564c000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe85562c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe855545000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe85531d000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe855f98000)
In ubuntu 19.04 when working with Python3 in an anaconda environment with pyodbc 4.0.26 installed I get the Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1' : file not found (0) (SQLDriverConnect)")!
Installed msodbcsql17 in ubuntu 19.04 like described here. I tried all the suggestions from here and here. I did the analysis like described here.
With pyodbc 4.0.26, it is possible to check the driver in the anaconda environment with python3 -c 'import pyodbc; print(pyodbc.drivers())' and got ['ODBC Driver 17 for SQL Server'].
After the analysis and the solutions from the links shown above, I still am not able to get a connection to work with MS-SQL and Python3. Please help me!
Edit:
...:~$ ldd /opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.3.so.1.1
linux-vdso.so.1
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1
libodbcinst.so.2 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.2
libcrypto.so.1.0.0 => not found
libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3
libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2
libssl.so.1.0.0 => not found
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
/lib64/ld-linux-x86-64.so.2
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7
libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2
libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2
Also:
~$ sudo locate libcrypto.so.1.0.0
/home/xxx/anaconda3/pkgs/openssl-1.0.2o-h20670df_0/lib/libcrypto.so.1.0.0
/home/xxx/anaconda3/pkgs/openssl-1.0.2p-h14c3975_0/lib/libcrypto.so.1.0.0
/home/xxx/anaconda3/pkgs/openssl-1.0.2p-h470a237_1/lib/libcrypto.so.1.0.0
and:
~$ sudo locate libssl.so.1.0.0
/home/xxx/anaconda3/pkgs/openssl-1.0.2o-h20670df_0/lib/libssl.so.1.0.0
/home/xxx/anaconda3/pkgs/openssl-1.0.2p-h14c3975_0/lib/libssl.so.1.0.0
/home/xxx/anaconda3/pkgs/openssl-1.0.2p-h470a237_1/lib/libssl.so.1.0.0
And I am working in Anaconda environment.
Installing libssl1.0.0 manually in Ubuntu 19.04 solves the problem, maybe with some other tuning I have done before - see the links mentioned in my question above. You can install the old lib in ubuntu 19.04 with wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu6.2_amd64.deb && dpkg -i libssl1.0.0_1.0.2n-1ubuntu6.2_amd64.deb. It will be installed parallel to libssl1.1.
As of 2019-05-22 Microsoft's installation instructions have not been updated to include Ubuntu 19.04. Microsoft has added an entry for 19.04 in the repository, i.e.,
https://packages.microsoft.com/config/ubuntu/19.04/prod.list
but it may not be ready for prime-time. It certainly looks like they need to sort out the libssl dependency for 19.04 since libssl1.0.0 is apparently no longer available
gord#VBox-Xubuntu1904:~$ sudo apt install libssl1.0.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libssl1.0.0 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libssl1.0.0' has no installation candidate
I am trying to install the Haskell Platform on Linux for the first time (I'm also a fairly new Linux user). The victim system is a fresh Red Hat system. And everything involved here should be 64 bit.
The directions at the platform website [1] indicate that I need a ghc7.0.3 to boostrap things. They provide a link to a generic binary of ghc-7.0.3 to do this. I fetched this and ran
$ ./configure ...
$ make install ...
as per the directions without incident (it is a binary, so no compilation needed)
However, when I tried to run ghci I get the output.
$ ghci
GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... <command line>: can't load .so/.DLL for: gmp (libgmp.so: cannot open shared object file: No such file or directory)
For some reason ghci cannot find libgmp.so. Running ghci ultimately invokes
/usr/local/lib/ghc-7.0.3/ghc
with a mess of options. I checked the dependencies via ldd
$ ldd /usr/local/lib/ghc-7.0.3/ghc
linux-vdso.so.1 => (0x00007fffe5f5c000)
libncursesw.so.5 => /lib64/libncursesw.so.5 (0x0000003ee7000000)
librt.so.1 => /lib64/librt.so.1 (0x0000003ee5800000)
libutil.so.1 => /lib64/libutil.so.1 (0x0000003ef3000000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000003ee5000000)
libgmp.so.3 => /usr/lib64/libgmp.so.3 (0x0000003ee4400000)
libm.so.6 => /lib64/libm.so.6 (0x0000003ee4c00000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003ee5400000)
libc.so.6 => /lib64/libc.so.6 (0x0000003ee4800000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003ef3400000)
/lib64/ld-linux-x86-64.so.2 (0x0000003ee4000000)
and it shows that it foud libgmp. libgmp is in /usr/local/lib and /usr/local/lib64.
I am not sure how to get further with this. Any suggestions?
[1] http://hackage.haskell.org/platform/linux.html
You either add /usr/local/lib and/or /usr/local/lib64 to $LD_LIBRARY_PATH, or add them to /etc/ld.so.conf, or (since you already have /usr/lib64/libgmp.so.3) add a missing symbolic link:
cd /usr/lib64
sudo ln -s libgmp.so.3 libgmp.so
(and perhaps the same for /usr/lib).
Note that /usr/lib64/libgmp.so.3 might be a different version from /usr/local/lib64/libgmp.so, make sure ghc can actually be used with the former.
Installing gmp-devel package helped in my case (opensuse)
I'm not sure that setting a symbolic link from libgmp.so to libgmp.so.3 is the right way to go. What happens when you get a version update and so libgmp.so.3 disappears. Setting LD_LIBRARY_PATH seems like a better solution.
There's also another solution for RedHat/CentOS and by extension probably Fedora: install the gmp-devel package. This sets up the symbolic link above, but does so with in the distribution (so updates should update the symbolic link also).