Getting WebKit bindings to work with Perl and gkt2 - perl

I need to use WebKit in my perl + gtk2 application. Found a package Gtk2::WebKit on CPAN, but can't get it working.
cpan> install Gtk2::WebKit
gives following output:
Package webkit-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `webkit-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'webkit-1.0' found
at inc/Module/Install/PRIVATE/WebKit.pm line 24
*** can not find package webkit-1.0
*** check that it is properly installed and available in PKG_CONFIG_PATH
at inc/Module/Install/PRIVATE/WebKit.pm line 24
No 'Makefile' created'YAML' not installed, will not store persistent state
FLORA/Gtk2-WebKit-0.09.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Failed during this command:
FLORA/Gtk2-WebKit-0.09.tar.gz : writemakefile NO -- No 'Makefile' created
It looks as if cpan wasn't able to find webkit, but I'm not sure how to fix that (my first time using perl and cpan).
Env: perl 5.12.4, ubuntu 11.10

Install libwebkitgtk-devel: sudo apt-get install libwebkitgtk-devel.

sudo apt-get install libwebkitgtk-dev

For Debian/Ubuntu and similar, the package name to install is libwebkitgtk-dev.
For OpenSuse and other RPM-based systems, the package name is libwebkitgtk-devel.

Related

Cwd.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)

All Perl modules and 'cpan' stopped working after an upgrade of Ubuntu 16.04 LTS to 18.04 LTS. Every time I run my script it leads to the error
threads.c: loadable library and Perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)
when I try to open cpan it shows
Cwd.c: loadable library and Perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)
I had installed "Cwd", "threads" modules in ubuntu 16.04 where Perl version was 5.22.1, whereas in ubuntu 18.04 the Perl version is 5.26.1.
I tried to remove the old version of modules but failed. I deleted content on ~/.cpan folder.
PS:
Everything works fine in root user.
if I run
sudo su
cpan
works perfectly. But as a normal user, I cant run any perl modules/scripts/cpan.
How do I correct the issue?
How can I re-install cpan or cpan modules?
I tried to reinstall Perl which did not help
sudo apt-get --reinstall install perl
sudo apt-get --reinstall install libcwd-guard-perl
I installed cpan minus, cpan plus which gave the same error.
For solve problem next links can be used:
https://dev.to/foursixnine/about-perl-and-mismatched-binaries-346l
https://metacpan.org/pod/release/DBOOK/App-MigrateModules-0.002/script/perl-migrate-modules
Or in commands: (Replace to your perl5 folder, in my case it was ~/perl5)
mv <perl5> perl5_old
cpan
cpan App::MigrateModules
perl-migrate-modules --from perl5_old /usr/bin/perl
Where perl5 your perl folder, usually in path exists in ENV variable PERL5LIB.
I solved this issue by following https://github.com/Perl/perl5/issues/15861
I ran the command perl -MCPAN -e 'recompile()'
It recompile all the module, at last it worked.

Cannot install GD module on darwin 13.0.1 using cpan

I'm having a tough job trying to get GD installed. I'm running a Mas OSX 10.9.2 darwin 13.0.1
When I run this:
cpan[1]> install GD
perl -MCPAN -e shell
I get the follwing error:
cpan[1]> install GD
Reading '/Users/me/.cpan/Metadata'
Database was generated on Sun, 21 Dec 2014 18:53:17 GMT
Running install for module 'GD'
Running make for L/LD/LDS/GD-2.56.tar.gz
Checksum for /Users/me/.cpan/sources/authors/id/L/LD/LDS/GD-2.56.tar.gz ok
Scanning cache /Users/me/.cpan/build for sizes
............................................................................DONE
CPAN.pm: Building L/LD/LDS/GD-2.56.tar.gz
Configuring for libgd version 2.0.11.
Checking for stray libgd header files...none found.
GD library used from: /usr/local
Please choose the features that match how libgd was built:
Undefined subroutine &main::prompt called at Build.PL line 169.
Warning: No success on command[/usr/bin/perl Build.PL ]
'YAML' not installed, will not store persistent state
LDS/GD-2.56.tar.gz
/usr/bin/perl Build.PL -- NOT OK
Running Build test
Make had some problems, won't test
Running Build install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
Failed during this command:
LDS/GD-2.56.tar.gz : writemakefile NO '/usr/bin/perl Build.PL ' returned status 512
Build.PL is trying to call a function called prompt but it doesn't exist. This is because they recently switched build systems from ExtUtils::MakeMaker (Makefile.PL) to Module::Build (Build.PL) but didn't fully convert the program. I've reported the bug.
Most people don't notice this because the prompting is only necessary if GD can't configure itself. It does this by looking for the gdlib-config program. If that can't be found, or it doesn't work, it will ask you for your gdlib configuration. It's best to let gdlib-config take care of that. Best way to solve this problem is to make sure gdlib-config is somewhere in your PATH and that gdlib-config --all works.
Otherwise replace all the instances of prompt in Build.PL with Module::Build->prompt and it should work.
I'm not sure about doing this on OSX, but I recently had similar problems with installing CPAN modules on CentOS.
Some prerequisite modules simply wouldn't install properly from CPAN. These modules had RPMs available. After installing some of the prerequisites via yum, I was able to get CPAN to install the modules I needed.
In particular, I had to install Module-Build and Archive-Tar (which brought in a number of other dependency rpm's) using yum.
Hope this helps.

Redhat Linux 6.5 Perl GD CPAN Module yum

when i try to install "GD" (perl -e shell -MCPAN ->(next step) cpan[1]> install GD) on Redhat 6.5 i got the error:
->
CPAN.pm: Building L/LD/LDS/GD-2.53.tar.gz
UNRECOVERABLE ERROR
Could not find gdlib-config in the search path. Please install libgd 2.0.28 or higher.
If you want to try to compile anyway, please rerun this script with the option --ignore_missing_gd.
Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=site]
CPAN: YAML loaded ok (v0.90)
LDS/GD-2.53.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
Failed during this command:
LDS/GD-2.53.tar.gz : writemakefile NO '/usr/bin/perl Makefile.PL INSTALLDIRS=site' returned status 512
<-
I tryed to install "libgd 2.0.28 or higher" but don't find this in "yum".
locate libgd (shows):
/usr/lib64/libgd.so.2
/usr/lib64/libgd.so.2.0.0
Does anyone know an advice?
Many perl modules are available already built and packaged for RHEL and derivatives such as CentOS. In the case of perl-GD, it seems it is available in the CentOS in the base repo even though it is not in the RHEL repo.
However you can still use the Centos repo by adding it to your yum configuration. Create a file /etc/yum.repos.d/cantos.repo containing:
[centos]
name=CentOS $releasever - $basearch
baseurl=http://mirror.centos.org/centos-6/6/os/$basearch/
enabled=0
gpgcheck=0
After which you should be able to install perl-GD
yum install --enablerepo centos perl-GD
It looks as though the current version of perl-GD for centos is 2.44.
If you do need a newer version that that, you will either need to find a 3rd party yum repo which has the later version of libgd available, or compile it from source. In a quick google I could not find the former, so I would recommend you download the latest source package and install that.
You need the package gd-devel then rebuild the GD module.

running Build.PL Could not create MYMETA files

I want to install File-MimeInfo-0.16 package and run "perl Build.PL", it threw out:
Could not create MYMETA files
Creating new 'Build' script for 'File-MimeInfo' version '0.16'
Does anyone know how to fix? thanks in advance
The package that creates MYMETA.json and MYMETA.yml files is called CPAN::Meta. You can install it with one of the following:
Mac OS X: type sudo port install p5-cpan-meta in the terminal (assuming you have MacPorts installed)
Ubuntu Linux: type sudo apt-get install libcpan-meta-perl in the terminal
Other platforms: run the CPAN shell (typically by typing cpan from a terminal or command prompt), and type:
install CPAN::Meta
You can install File::MimeInfo from CPAN directly.
cpan File::MineInfo
OR, if you want to do it manually,
Install the following dependencies if you don't have them:
Carp
Exporter
Fcntl
Pod::Usage
File::Basename
File::BaseDir
File::DesktopEntry
Download the distribution
wget http://search.cpan.org/CPAN/authors/id/P/PA/PARDUS/File-MimeInfo/File-MimeInfo-0.16.tar.gz
Run the following sequence of command:
tar xvzf File-MimeInfo-0.16.tar.gz
cd File-MimeInfo-0.16
perl MakeFile.PL
make test
make install
I do not know why you want to run perl Build.PL.
But as far as installation of the module is concerned, above step will get you the module installed for sure (Provided you take care of the dependencies...OR use CPAN)
PS: Above instruction are meant for Linux platform. I have never done any perlish thing on windows.

How to install XML::Parser without expat-devel?

XML::Parser fails to build on a quite fresh 64-bit Debian box. After issuing cpan XML::Parser, cpan fails with lots of errors about Expat.c and Expat.xs:
[...]
Expat.xs:2182: error: ‘CallbackVector’ has no member named ‘skip_until’
Expat.c: In function ‘XS_XML__Parser__Expat_Do_External_Parse’:
Expat.c:2904: error: ‘XML_Parser’ undeclared (first use in this function)
Expat.c:2904: error: expected ‘;’ before ‘parser’
Expat.xs:2194: error: ‘parser’ undeclared (first use in this function)
make[1]: *** [Expat.o] Error 1
make[1]: Leaving directory `/root/.cpan/build/XML-Parser-2.41-rpV6ok/Expat'
make: *** [subdirs] Error 2
TODDR/XML-Parser-2.41.tar.gz
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Message at the start of the output explains that expat-devel is needed for building.
Expat must be installed prior to building XML::Parser and I can't find
it in the standard library directories. Install 'expat-devel' package with your
OS package manager. See 'README'.
But expat-devel is not in Debian repository.
Is it possible to get over this without need to build/install expat from source?
The package you want to install is named libexpat1-dev. You could also just install libxml-parser-perl via apt-get. Or if you really want to install via CPAN try installing the Debian packages dependencies first via apt-get build-dep libxml-parser-perl.
libexpat1-dev contains both libexpat and expat.h, which are both mentioned in the message as well:
If expat is installed, but in a non-standard directory, then use the
following options to Makefile.PL:
EXPATLIBPATH=... To set the directory in which to find libexpat
EXPATINCPATH=... To set the directory in which to find expat.h
Installing libexpat1-dev seems to solve the problem:
$ aptitude install libexpat1-dev
There is always the manual method - to build/install expat from source.
(This example shows installing to an alternative location for XAMPP | LAMPP)
Download from:
http://sourceforge.net/projects/expat/files/expat/
tar zxf /[where-ever]/expat-2.1.0.tar.gz -C /tmp
cd /tmp/expat-2.1.0
/opt/lampp/bin/perl ./configure --prefix=/opt/lampp LDFLAGS=-L/opt/lampp/lib
make
make install
http://search.cpan.org - search for and download - XML::Parser
tar zxf /[where-ever]/XML-Parser-2.41.tar.gz -C /tmp
cd /tmp/XML-Parser-2.41
/opt/lampp/bin/perl ./Makefile.PL EXPATLIBPATH=/opt/lampp/lib EXPATINCPATH=/opt/lampp/include
make
make test
make install
Work like a charm in Ubuntu 15.04. The only thing that I need is install Perl XML Parser with:
sudo apt-get install libxml-parser-perl
And following the instructions here, I was able to import successfully all my ratings into Rhythmbox. Now, the only work that I need to do is create again the smart play lists, that is nothing compared with my entire libray ratings.
Today I had the same issue wanting to complile the new GIMP 2.9.4 beta on OSX 10.8 and the aid of homebrew.
First install perl
brew install perl
Then the XML::Parser module by going into the perl shell with
perl -MCPAN -e shell
And inside the shell install XML::Parser by typing
install XML::Parser
Exit shell
exit
Now, verify it has been installed successfully. If everything is ok, you will not see an error.
perl -e "require XML::Parser"
If the ./configure still fails missing XML::Parser, then intltools is not using the perl you have installed. Looking at the script tells me it does the test with $INTLTOOL_PERL -e "require XML::Parser". Trying a echo $INTLTOOL_PERL gave out nothing, so the magic is to set it with
export $INTLTOOL_PERL=perl
Now run ./configure again.
None of the above methods worked for me. I had the right environment variables setup but they were somehow not picked up by cpanm that I use to install perl modules. Expat was also installed.
Here is what I did to overcome the same problem that OP is reporting.
This is very close to what #LadyBuzz suggested.
Download the XML::Parser from cpan.org
Extract the tarball into directory and descend to it.
Open the Makefile.pl and edit the first lines to actually have the absolute paths to both: EXPATLIBPATH and EXPATINCPATH
Save the Makefile.pl, go up one level and create a new tarball with the Makefile.pl that you just edited.
Execute cpanm on the newly created tarball.
This resulted in successful installation of the module.