Setting a resolution for xvfb-run and wkhtmltopdf / wkhtmltoimage - centos

I'm trying desperately to give xvfb-run some resolution arguments to take screenshots of websites with wkhtmltox in different resolutions.
I'm using both xvfb-run and wkhtmltox on CentOS.
xvfb-run --server-args="-screen 0 1024x768x24" wkhtmltoimage http://www.whatismyscreenresolution.com/ /tmp/bla.png
Unfortunately my arguments are not respected by xvfb-run. It has always a resolution of 800x600. What am I doing wrong here?
Thanks for any help!

You forgot this option: --use-xserver.
So the whole command is:
xvfb-run --server-args="-screen 0 1024x768x24" wkhtmltoimage --use-xserver http://www.whatismyscreenresolution.com/ /tmp/bla.png
(I tested with wkhtmltopdf, but it should be the same with wkhtmltoimage)

Add a comma between parameters. In your case "-screen 0, 1024x768x24".
Let me know if it helped you.
Regards,
HBK

Are you running wkhtmltoimage with a patched QT? If your QT version is NOT patched, a lot of features are ignored, including any commands sent from xvfb-run.
you can check your version like so:
/usr/bin/wkhtmltoimage --version
Change the path to wherever you've stored your wkhtmltoimage file. If the returned version doesn't include "patched QT", then that's probably where you should start. You can download a patched QT version from here:
https://wkhtmltopdf.org/downloads.html
Installation of a patched QT version is not too complicated, try a variation of the following (I'm running Ubuntu 20, other distros will need tweaking):
cd ~
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb
sudo apt-get install -f
/usr/local/bin/wkhtmltoimage --version
Best of luck.

Related

Mac M1 Homebrew Perl Carton Net::SSLeay is loading libcrypto in an unsafe way

I'm trying to install Net::SSLeay with Carton.
The installation fails with this message
Configuring Net-SSLeay-1.90 Running Makefile.PL Do you want to run external tests?
These tests *will* *fail* if you do not have network connectivity. [n] n
*** Found LibreSSL-2.8.3 installed in /usr
*** Be sure to use the same compiler and options to compile your OpenSSL, perl, and Net::SSLeay. Mixing and matching compilers is not supported.
Checking if your kit is complete... Looks good
WARNING: /opt/homebrew/Cellar/perl/5.32.1_1/bin/perl is loading libcrypto in an unsafe way -> N/A
I've tried this with system perl, brew perl and multiple perlbrew perls.
Google came up with a temp solution to build homebrew using x86_64 architecture.
This did work for the libcrypto error, but gave me a whole different set of issues including mysql not running anymore.
Other "solutions" that I've tried are symlinking libssl & libcrypto as suggested by numerous other posts, all sadly without success.
Any ideas how to fix this or work around this without having to reinstall all brew packages as x86_64 ?
Quick Workaround
If you are looking for a quick workaround follow these steps.
Run carton bundle to create a vendor cache directory.
Go to cached tarball 'cache/authors/id/C/CH/CHRISN/' and unpack tar -xvzf Net-SSLeay-1.90.tar.gz
Edit Makefile.PL, change my $prefix = find_openssl_prefix(); to
my $prefix = '/opt/homebrew/opt/openssl#1.1'; ** adjust to your openssl location.
Save and create new tarball tar -czvf Net-SSLeay-1.90.tar.gz Net-SSLeay-1.90
Run carton install --cached to use the altered version
Hope this helps anyone in search of workaround
You can solve this in two steps:
upgrade ExtUtils::MakeMaker to at least version 7.58 (e.g. cpanm ExtUtils::MakeMaker)
install openssl via macports (sudo port install openssl) or homebrew (brew install --cask openssl)
After the Monterey update this broke again also on the x86_64 architecture, but just symlinking your latest openssl (where ever it is, depending how you have installed it) seemed to fix this. Example:
$ export OPENSSL_PREFIX=[find your openssl installation]
$ sudo ln -s $OPENSSL_PREFIX/lib/libssl.dylib /usr/local/lib/
$ sudo ln -s $OPENSSL_PREFIX/lib/libcrypto.dylib /usr/local/lib/
Better workaround:
I entered export OPENSSL_PREFIX=/opt/homebrew/opt/openssl#1.1 in my shell and then ran cpan. I checked the code in Makefile.PL and the first thing the function find_openssl_prefix does is to check the OPENSSL_PREFIX environment variable. If it is set, then it the function will return its contents.
Add the variable to your .profile, .cshrc, .bashrc, .zshrc, or whatever rc file your shell uses and you never have to worry about it again!!

How to set properly SCALA_HOME in a macport installed scala

I have installed multiple versions of Scala (2.9 and 2.10) on my mac (OS X 10.7.5) using macports. I like this way because can switch easily between these two versions by the simple "port select" command.
But, the SCALA_HOME environment variable does not get set automatically with this command.
Is there a proper nice macport command to set correctly the SCALA_HOME variable?
If no, what directory should the SCALA_HOME point to in a macport installed scala?
Thanks
EDIT:
Until now the best way I found is with a shell script that looks what is the current scala command and adjust the SCALA_HOME variable accordingly. I run it always after switching the Scala version.
Here is the important command in the script. I'm not an expert shell programmer, therefore I'll be thankful for any suggestion:
export SCALA_HOME=$(ls -l `which scala` | gawk 'match($0, "(/opt/local/share/.*)/bin/scala", a) {print a[1]}')
I don't know of a way to have MacPorts do it for you, but Scala is installed at /opt/local/share/scala-2.10/ for me. So I added
export SCALA_HOME="/opt/local/share/scala-2.10/"
to my ~/.profile and everything seems to be working for me now (although you'd have to switch change your $SCALA_HOME every time you switch versions).
OK, until now the best solution I found is to run following command after changing scala version:
export SCALA_HOME=$(ls -l `which scala` | gawk 'match($0, "(/opt/local/share/.*)/bin/scala", a) {print a[1]}')
I have included that command also in my .bash_profile so my SCALA_HOME always points to the scala version I am using currently.
This command uses gawk 4.1.1 installed from MacPorts.
Currently when scala is installed via brew it's path set to
/usr/local/Cellar/scala/[version]
So SCALA_HOME could be defined as follows:
export SCALA_HOME=$(greadlink -f $(dirname "$(greadlink -f $(which scala))")/../../)
p.s: You need to install 'greadlink' for that since the regular readlink doesn't support the 'f' flag.
if you are installing the versions with home brew you can simply:
brew switch scala 2.10.3

Can anyone help me with installation of varnish vagent2

I want to install this varnish vagent2
https://github.com/varnish/vagent2
I am working around it but it is not installing.. it is giving me following error..
root#ns5 [/usr/local/src/vagent2-master]# ./autogen.sh
+ aclocal
configure.ac:65: error: pkg.m4 missing, please install pkg-config
configure.ac:65: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1
now i have pkg-config / m4 / latest version of automake / autoconf installed...
yet it is giving this issue. Can anyone guide me as how can i get through the same ?
You're missing pkg.m4 it seems?
Check the spec files in the redhat/ directory to determine dependencies. We tested this on centos6 and I believe centos5, but I currently lack easy access to a machine to test from, so before I pursue this further, I suggest you check the spec file.
If that doesn't help, open an issue on github, as we don't generally follow stackoverflow :)
You need to install pkgconfig. On a mac, you may first need to install "mac ports" ... here is an article describing the solution:
http://www.fantageek.com/318/install-pkg-config-for-mac-osx/
Long story short. To get varnish-agent working happily on centos5 you needed to manually update automake and autoconf, which means that aclocal may not look into the right directory for pkg.m4.
Assuming you have installed pkgconfig using yum, line 22 in autogen.sh should look like this below.
aclocal -I /usr/share/aclocal
To make this a little easier, I have changed autogen.sh to include the above changes. See commit below, In addition, I have provided a Vagrantfile to illustrate how you can build a happy centos5 vm for varnish-agent. Hope this helps.
https://github.com/varnish/vagent2/commit/3921083f5fef12f06527e3361cc880121aa6b66b

Installing mod_perl-2.0.7 on Apache httpd-2.4.2

I am having an infuriating time trying to get an install of apache with perl. I am following the instructions on the mod_perl site located here: http://perl.apache.org/docs/2.0/user/install/install.html
I get as far as the part where it asks me to run this command, but I get an error:
$ perl Makefile.PL MP_APXS=/usr/local/httpd/prefork/bin/apxs
Reading Makefile.PL args from #ARGV
MP_APXS = /usr/local/httpd/prefork/bin/apxs
no conflicting prior mod_perl version found - good.
Configuring Apache/2.4.2 mod_perl/2.0.7 Perl/v5.12.3
[ error] Can't find apr include/ directory,
[ error] use MP_APR_CONFIG=/path/to/apr-config
I ran the commands they suggested for installing apache to install my apache:
$ ./configure --prefix=$HOME/httpd/prefork --with-mpm=prefork
$ make && make install
But I am not sure where this apr-config thing is supposed to be as it doesn't appear to be anywhere in my apache2 folder.
If it might be an issue, I am using Mac OS X 10.7.3. I know an apache server comes with Mac OS X, but I need to do this install on a different computer from the ground up, so I have to start this whole install from the ground up on my computer.
Thanks ahead of time for any help you can provide.
When mod_perl 2.0.8 comes out, I hope that it gets finally httpd 2.4 support, because the current versions surely don't have.
When you fix your initial problems, you will eventually get stuck at ‘conn_rec’ has no member named ‘remote_ip’. Delete httpd 2.4 and use 2.2 meanwhile.
You need to include the path to binary executable file apr-1-config. Run the below command
perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs MP_APR_CONFIG=/usr/local/apr/bin/apr-1-config
It worked for me..Hope the same for you too.
On Lion here, my APR include directory seems to be /usr/include/apr-1, but it already came with mod_perl.
$ find / -name apr*
/usr/include/apr-1
...
$ find / -name mod_perl.so
/usr/libexec/apache2/mod_perl.so
If you have the .so already you should be able to just add in your config file:
LoadModule perl_module libexec/apache2/mod_perl.so

libgfortran: version `GFORTRAN_1.4' not found

I am getting the following error when I trying to a run mex file in MATLAB:
??? Invalid MEX-file
'findimps3.mexa64':
/MATLAB/bin/glnxa64/../../sys/os/glnxa64/libgfortran.so.3: version `GFORTRAN_1.4' not found (required by /usr/lib/libblas.so.3gf)
Any ideas how to solve this problem?
update:
I found out that "strings MATLAB/.../libgfortran.so.3 | grep GFORTRAN" output GFORTRAN_1.0. I tried to changed libgfortran inside MATLAB but it didn't work. Not I think it's better to find a suitable libblas that works with GFORTRAN_1.0.
read this link, it explains how to configure matlab on some linux systems.
here the steps that are relevant to you:
To enable running external programs, […] fortran libraries need to be properly updated and linked. Look at the output of this command:
ll "$MATLABDIR/bin/glnxa64/"
It is likely that [this link] exist:
libgfortran.so.3 -> libgfortran.so.3.0.0
Search for [this library] on your machine:
locate libgfortran.so
[…] Update Matlab's links to point to these newer versions:
sudo ln -sf [location of libgfortran.so.3.0.0] "$MATLABDIR/bin/glnxa64/libgfortran.so.3"
I (think I) fixed this problem by running matlab with LD_PRELOAD, like this
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libfreetype.so:/usr/lib/x86_64-linux-gnu/libgfortran.so.3 matlab
Notice freetype was another library I was having a similar problem with.
In my case the following command worked:
sudo ln -sf /usr/lib/gcc/i686-linux-gnu/4.7/libgfortran.so /usr/local/MATLAB/R2012a/sys/os/glnx86/libgfortran.so.3
Matlab was complaining it couldn't find the GFORTRAN1.4 in the following location:
/usr/lib/gcc/i686-linux-gnu/4.7/libgfortran.so
So I linked this location to the library I had :
/usr/local/MATLAB/R2012a/sys/os/glnx86/libgfortran.so.3
I found the location of this library by using the locate command as given above:) Thanks for the help:)
In my case, fixed by
$ ln -sf /usr/lib64/libgfortran.so.3.0.0 /opt/matlab/sys/os/glnxa64/libgfortran.so.3
Errors I meet when using CDSP:
csdp: /opt/matlab/sys/os/glnxa64/libgfortran.so.3: version GFORTRAN_1.4' not found (required by /usr/lib64/atlas/libptf77blas.so.3)
csdp: /opt/matlab/sys/os/glnxa64/libgfortran.so.3: versionGFORTRAN_1.4' not found (required by /usr/lib64/atlas/libf77blas.so.3)
I just ran into the same problem (error usr/lib64/libgfortran.so.3: version `gfortran_1.4' not found) and it was actually not hard to fix. The problem seems to be that gfortran_1.4 version of libgfortran.so.3 comes from the release gcc-4.6.2 (i.e. fortran 4.6).
What I did was downloaded gcc-4.6.2 and built, using the steps: tar -xvf gcc-4.6.2.tar.gz cd gcc-4.6.2 ./contrib/download_prerequisites cd .. mkdir objdir cd objdir $PWD/../gcc-4.6.2/configure --prefix=$HOME/gcc-4.6.2 --enable-languages=c,fortran,c++,go make make install
Then, once everything was made, I went to the directory where the new, fresh libgfortran.so.3 was sitting (in my case it was /home/testuser/objdir/x86_64-unknown-linux-gnu/32/libgfortran/.libs/)
I copied this version of libgfortran.so.3, and went to the directory where my program was expecting to find libgfortran.so.3. I replaced the old one (the old libgfortran.so.3) with the new one (the one we just copied).
The problem instantly went away. I hope this helps you too!