Unable to install JSON::Parse with cpan - json

I'm trying to install JSON::Parse through cpan on an old Debian Etch server. When I do, it fails:
cpan[2]> install JSON::Parse
CPAN: Storable loaded ok (v2.15)
Going to read /root/.cpan/Metadata
Database was generated on Wed, 23 Nov 2016 14:41:02 GMT
Running install for module 'JSON::Parse'
Running make for B/BK/BKB/JSON-Parse-0.48.tar.gz
CPAN: Digest::SHA loaded ok (v5.86)
CPAN: Compress::Zlib loaded ok (v2.068)
Checksum for /root/.cpan/sources/authors/id/B/BK/BKB/JSON-Parse-0.48.tar.gz ok
Scanning cache /root/.cpan/build for sizes
............................................................................DONE
JSON-Parse-0.48/
JSON-Parse-0.48/unicode.c
JSON-Parse-0.48/examples/
JSON-Parse-0.48/t/
JSON-Parse-0.48/errors.c
JSON-Parse-0.48/lib/
JSON-Parse-0.48/utf8-byte-one.c
JSON-Parse-0.48/json-entry-points.c
JSON-Parse-0.48/json-common.c
JSON-Parse-0.48/json-perl.c
JSON-Parse-0.48/MANIFEST
JSON-Parse-0.48/MANIFEST.SKIP
JSON-Parse-0.48/typemap
JSON-Parse-0.48/utf8-next-byte.c
JSON-Parse-0.48/script/
JSON-Parse-0.48/unicode.h
JSON-Parse-0.48/json-whitespace.c
JSON-Parse-0.48/Json3.xs
JSON-Parse-0.48/Makefile.PL
JSON-Parse-0.48/README
JSON-Parse-0.48/Changes
JSON-Parse-0.48/META.yml
JSON-Parse-0.48/META.json
JSON-Parse-0.48/script/validjson
JSON-Parse-0.48/lib/JSON/
JSON-Parse-0.48/lib/JSON/Tokenize.pod
JSON-Parse-0.48/lib/JSON/Parse.pm
JSON-Parse-0.48/lib/JSON/Tokenize.pm
JSON-Parse-0.48/lib/JSON/Parse.pod
JSON-Parse-0.48/t/collision.t
JSON-Parse-0.48/t/whitespace.t
JSON-Parse-0.48/t/test.json
JSON-Parse-0.48/t/syntax.t
JSON-Parse-0.48/t/valid-json.t
JSON-Parse-0.48/t/numbers.t
JSON-Parse-0.48/t/unicode.t
JSON-Parse-0.48/t/perl-monks-1165399.t
JSON-Parse-0.48/t/array.t
JSON-Parse-0.48/t/syntax-error-1.json
JSON-Parse-0.48/t/kolmorogov42-1.t
JSON-Parse-0.48/t/object.t
JSON-Parse-0.48/t/utf8.t
JSON-Parse-0.48/t/Json3.t
JSON-Parse-0.48/t/test-empty-string.t
JSON-Parse-0.48/t/read-file.t
JSON-Parse-0.48/t/rfc7159.t
JSON-Parse-0.48/t/JSON-Parse.t
JSON-Parse-0.48/examples/assert.pl
JSON-Parse-0.48/examples/sasori.pl
JSON-Parse-0.48/examples/tokenize-synopsis.pl
JSON-Parse-0.48/examples/bad-utf8.pl
JSON-Parse-0.48/examples/kani.pl
JSON-Parse-0.48/examples/true-subs.pl
JSON-Parse-0.48/examples/long-number.pl
JSON-Parse-0.48/examples/synopsis.pl
JSON-Parse-0.48/examples/collide.pl
JSON-Parse-0.48/examples/array.pl
JSON-Parse-0.48/examples/key-collision.pl
JSON-Parse-0.48/examples/first-bit.pl
JSON-Parse-0.48/examples/json-tiny-round-trip-demo.pl
JSON-Parse-0.48/examples/chr.pl
JSON-Parse-0.48/examples/bad-utf8.txt
JSON-Parse-0.48/examples/ebi.pl
JSON-Parse-0.48/examples/hash.pl
CPAN: File::Temp loaded ok (v0.2304)
CPAN: YAML loaded ok (v0.88)
CPAN.pm: Going to build B/BK/BKB/JSON-Parse-0.48.tar.gz
Checking if your kit is complete...
Looks good
Warning: Perl version 5.008009 or higher required. We run 5.008008.
JSON::PP 2.27103 is not available
at /usr/local/share/perl/5.8.8/CPAN/Meta/Converter.pm line 57.
at /usr/local/share/perl/5.8.8/ExtUtils/MM_Any.pm line 831.
Generating a Unix-style Makefile
Writing Makefile for JSON::Parse
Writing MYMETA.yml and MYMETA.json
cp lib/JSON/Parse.pod blib/lib/JSON/Parse.pod
cp lib/JSON/Tokenize.pm blib/lib/JSON/Tokenize.pm
cp lib/JSON/Tokenize.pod blib/lib/JSON/Tokenize.pod
cp lib/JSON/Parse.pm blib/lib/JSON/Parse.pm
Running Mkbootstrap for JSON::Parse ()
chmod 644 Parse.bs
/usr/bin/perl /usr/local/share/perl/5.8.8/ExtUtils/xsubpp -typemap /usr/share/perl/5.8/ExtUtils/typemap -typemap typemap Json3.xs
> Json3.xsc && mv Json3.xsc Json3.c
cc -c -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"0.48\" -DXS_VERSION=\"0.48\" -fPIC "-I/usr/lib/perl/5.8/CORE" Json3.c
rm -f blib/arch/auto/JSON/Parse/Parse.so
cc -shared -L/usr/local/lib Json3.o -o blib/arch/auto/JSON/Parse/Parse.so \
\
chmod 755 blib/arch/auto/JSON/Parse/Parse.so
/usr/bin/perl -MExtUtils::Command::MM -e 'cp_nonempty' -- Parse.bs blib/arch/auto/JSON/Parse/Parse.bs 644
cp script/validjson blib/script/validjson
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/validjson
Manifying blib/man3/JSON::Parse.3pm
Manifying blib/man3/JSON::Tokenize.3pm
BKB/JSON-Parse-0.48.tar.gz
/usr/bin/make -- OK
Running make test
Running Mkbootstrap for JSON::Parse ()
chmod 644 Parse.bs
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'b
lib/lib', 'blib/arch')" t/*.t
t/array.t ............... ok
t/collision.t ........... ok
t/JSON-Parse.t .......... ok
t/Json3.t ............... ok
t/kolmorogov42-1.t ...... ok
t/numbers.t ............. 1/? Attempt to free unreferenced scalar: SV 0x814ebe0, Perl interpreter: 0x814e008 during global destructi
on.
t/numbers.t ............. ok
t/object.t .............. ok
t/perl-monks-1165399.t .. 1/? Use of uninitialized value in undef operator at t/perl-monks-1165399.t line 38.
t/perl-monks-1165399.t .. ok
t/read-file.t ........... ok
t/rfc7159.t ............. ok
t/syntax.t .............. ok
t/test-empty-string.t ... ok
t/unicode.t ............. ok
t/utf8.t ................ ok
t/valid-json.t .......... All 5 subtests passed
t/whitespace.t .......... ok
Test Summary Report
-------------------
t/valid-json.t (Wstat: 11 Tests: 5 Failed: 0)
Non-zero wait status: 11
Parse errors: No plan found in TAP output
Files=16, Tests=277, 0 wallclock secs ( 0.05 usr 0.01 sys + 0.25 cusr 0.04 csys = 0.35 CPU)
Result: FAIL
Failed 1/16 test programs. 0/277 subtests failed.
make: *** [test_dynamic] Error 255
BKB/JSON-Parse-0.48.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports BKB/JSON-Parse-0.48.tar.gz
Running make install
make test had returned bad status, won't install without force
Failed during this command:
BKB/JSON-Parse-0.48.tar.gz : make_test NO
Like I said, it's an old Debian Etch server which is running an old version of cpan as well:
# cpan -v
/usr/bin/cpan script version 1.9, CPAN.pm version 1.9205
Can anyone offer any tips?

Your errors include this:
Warning: Perl version 5.008009 or higher required. We run 5.008008.
The current version of JSON::Parse (0.48) requires a more recent version of Perl than the one you have.
This minimum version requirement was added in version 0.25. But looking at the CPAN testers results, it seems that this was just documenting a problem that had been around for some time. You might be able to install version 0.18, but you would be far better advised to upgrade to a version of Debian with a newer version of Perl installed.

If JSON::Parse isn't a dependency for anything you want. You can just use JSON to do the same thing.
#!/usr/bin/perl
use strict;
use warnings;
use JSON;
my $jsonString = "{\"foo\":\"bar\"}";
my $hash = decode_json($jsonString);
print ${$hash}{"foo"} . "\n";

Related

Can't install JSON.pm

I'm trying to use a Perl script to transform my data structure into a JSON-format string. This uses the asm2stats.pl Perl script in the pl folder here
Here is the command line I used
perl /Users/Buscou.out/ACG-scaffold.fa > output.json
But I got this issue:
Can't locate JSON.pm in #INC (you may need to install the JSON module) (#INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /Users/etudiant/Downloads/assembly-stats-master/pl/asm2stats.pl line 5.
BEGIN failed--compilation aborted at /Users/etudiant/Downloads/assembly-stats-master/pl/asm2stats.pl line 5.
BY looking in internet, I made these installations:
brew install cpanm
and
sudo cpan JSON
but I still get the same error..
Here is the issue I get when I run cpanm --force install JSON :
!
! Can't write to /Library/Perl/5.18 and /usr/local/bin: Installing modules to /Users/etudiant/perl5
! To turn off this warning, you have to do one of the following:
! - run me as a root or with --sudo option (to install to /Library/Perl/5.18 and /usr/local/bin)
! - Configure local::lib in your existing shell to set PERL_MM_OPT etc.
! - Install local::lib by running the following commands
!
! cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
!
--> Working on install
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/install-0.01.tar.gz ... OK
Configuring install-0.01 ... OK
Building and testing install-0.01 ... FAIL
! Installing install failed. See /Users/etudiant/.cpanm/work/1526230657.17102/build.log for details. Retry with --force to force install it.
--> Working on JSON
Fetching http://www.cpan.org/authors/id/I/IS/ISHIGAKI/JSON-2.97001.tar.gz ... OK
Configuring JSON-2.97001 ... OK
Building and testing JSON-2.97001 ... FAIL
! Installing JSON failed. See /Users/etudiant/.cpanm/work/1526230657.17102/build.log for details. Retry with --force to force install it.
Content of the 1526230657.17102/build.log file:
more /Users/etudiant/.cpanm/work/1526230657.17102/build.log
cpanm (App::cpanminus) 1.7044 on perl 5.018002 built for darwin-thread-multi-2level
Work directory is /Users/etudiant/.cpanm/work/1526230657.17102
You have make /usr/bin/make
You have LWP 6.05
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
!
! Can't write to /Library/Perl/5.18 and /usr/local/bin: Installing modules to /Users/etudiant/perl5
! To turn off this warning, you have to do one of the following:
! - run me as a root or with --sudo option (to install to /Library/Perl/5.18 and /usr/local/bin)
! - Configure local::lib in your existing shell to set PERL_MM_OPT etc.
! - Install local::lib by running the following commands
!
! cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
!
Searching install () on cpanmetadb ...
--> Working on install
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/install-0.01.tar.gz
-> OK
Unpacking install-0.01.tar.gz
Entering install-0.01
Checking configure dependencies from META.yml
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.34)
Configuring install-0.01
Running Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for install
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.34)
Building and testing install-0.01
cp lib/install.pm blib/lib/install.pm
Manifying 1 pod document
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/install.t .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.02 cusr 0.00 csys = 0.06 CPU)
Result: PASS
Manifying 1 pod document
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/Users/etudiant/perl5/lib/perl5'
Do not have write permissions on '/Users/etudiant/perl5/lib/perl5'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
at -e line 1.
make: *** [pure_site_install] Error 13
-> FAIL Installing install failed. See /Users/etudiant/.cpanm/work/1526230657.17102/build.log for details. Retry with --force to force install it.
Searching JSON () on cpanmetadb ...
--> Working on JSON
Fetching http://www.cpan.org/authors/id/I/IS/ISHIGAKI/JSON-2.97001.tar.gz
-> OK
Unpacking JSON-2.97001.tar.gz
Entering JSON-2.97001
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (7.34)
Configuring JSON-2.97001
Running Makefile.PL
Welcome to JSON (v.2.97001)
=============================
** BACKWARD INCOMPATIBILITY **
Since version 2.90, stringification (and string comparison) for
JSON::true and JSON::false has not been overloaded. It shouldn't
matter as long as you treat them as boolean values, but a code that
expects they are stringified as "true" or "false" doesn't work as
you have expected any more.
if (JSON::true eq 'true') { # now fails
print "The result is 1 now."; # => The result is 1 now.
And now these boolean values don't inherit JSON::Boolean, either.
When you need to test a value is a JSON boolean value or not, use
JSON::is_bool function, instead of testing the value inherits
a particular boolean class or not.
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for JSON
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::MakeMaker 0 ... Yes (7.34)
Checking if you have Test::More 0 ... Yes (0.98)
Building and testing JSON-2.97001
cp lib/JSON/backportPP/Compat5005.pm blib/lib/JSON/backportPP/Compat5005.pm
cp lib/JSON/backportPP/Boolean.pm blib/lib/JSON/backportPP/Boolean.pm
cp lib/JSON/backportPP/Compat5006.pm blib/lib/JSON/backportPP/Compat5006.pm
cp lib/JSON/backportPP.pm blib/lib/JSON/backportPP.pm
cp lib/JSON.pm blib/lib/JSON.pm
Manifying 5 pod documents
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
# JSON::backportPP 2.97001
t/00_backend_version.t ................ ok
t/00_load.t ........................... ok
t/00_load_backport_pp.t ............... ok
t/00_pod.t ............................ ok
t/01_utf8.t ........................... ok
t/02_error.t .......................... ok
t/03_types.t .......................... ok
t/06_pc_pretty.t ...................... ok
t/07_pc_esc.t ......................... ok
t/08_pc_base.t ........................ ok
t/09_pc_extra_number.t ................ ok
t/104_sortby.t ........................ ok
t/105_esc_slash.t ..................... ok
t/106_allow_barekey.t ................. ok
t/107_allow_singlequote.t ............. ok
t/108_decode.t ........................ ok
t/109_encode.t ........................ ok
t/10_pc_keysort.t ..................... ok
t/110_bignum.t ........................ ok
t/112_upgrade.t ....................... ok
t/113_overloaded_eq.t ................. ok
t/114_decode_prefix.t ................. ok
t/115_tie_ixhash.t .................... ok
t/116_incr_parse_fixed.t .............. ok
t/117_numbers.t ....................... ok
t/11_pc_expo.t ........................ ok
t/12_blessed.t ........................ ok
t/13_limit.t .......................... ok
t/14_latin1.t ......................... ok
t/15_prefix.t ......................... ok
t/16_tied.t ........................... ok
t/17_relaxed.t ........................ ok
t/18_json_checker.t ................... ok
t/19_incr.t ........................... ok
t/20_unknown.t ........................ ok
t/21_evans_bugrep.t ................... ok
t/22_comment_at_eof.t ................. ok
t/99_binary.t ......................... ok
t/e00_func.t .......................... ok
t/e01_property.t ...................... ok
# 1
t/e02_bool.t .......................... ok
t/e03_bool2.t ......................... ok
t/e11_conv_blessed_univ.t ............. ok
t/e90_misc.t .......................... ok
t/gh_28_json_test_suite.t ............. ok
t/gh_29_trailing_false_value.t ........ ok
t/rt_116998_wrong_character_offset.t .. ok
t/rt_90071_incr_parse.t ............... ok
t/x00_load.t .......................... ok
t/x02_error.t ......................... ok
t/x12_blessed.t ....................... ok
t/x16_tied.t .......................... ok
t/x17_strange_overload.t .............. ok
t/xe04_escape_slash.t ................. ok
t/xe05_indent_length.t ................ ok
t/xe12_boolean.t ...................... ok
t/xe19_xs_and_suportbypp.t ............ ok
t/xe20_croak_message.t ................ ok
t/xe21_is_pp.t ........................ ok
t/zero-mojibake.t ..................... ok
All tests successful.
Files=60, Tests=3720, 5 wallclock secs ( 0.47 usr 0.16 sys + 4.45 cusr 0.34 csys = 5.42 CPU)
Result: PASS
Manifying 5 pod documents
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/Users/etudiant/perl5/lib/perl5'
Do not have write permissions on '/Users/etudiant/perl5/lib/perl5'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
at -e line 1.
make: *** [pure_site_install] Error 13
-> FAIL Installing JSON failed. See /Users/etudiant/.cpanm/work/1526230657.17102/build.log for details. Retry with --force to force install it.

Error installing mercurial on linux: unable to generate hg.mo

I am trying to install mercurial from source. I tried installing mercurial version 3.5 and 3.6 from here: https://www.mercurial-scm.org/release/
My Linux version: Red Hat Enterprise Linux Server release 5.11 (Tikanga)
and my python version: Python 2.6.5
This is the error I get when I try to built it locally.
make local
python setup.py \
build_py -c -d . \
build_ext -i \
build_hgexe -i \
build_mo
running build_py
running build_ext
running build_hgexe
running build_mo
generating mercurial/locale/zh_TW/LC_MESSAGES/hg.mo from i18n/zh_TW.po
msgfmt -v -o mercurial/locale/zh_TW/LC_MESSAGES/hg.mo i18n/zh_TW.po -c
usage: msgfmt [ -dv ] [ - ] [ name ... ]
mercurial/locale/zh_TW/LC_MESSAGES/hg.mo: No such file or directory
error: command 'msgfmt' failed with exit status 2
make: *** [local] Error 1
Looks like you have a msgfmt in your PATH that isn't the one that the installer expects to find.
Do:
which msgfmt
and if the result isn't /usr/bin/msgfmt that's probably the cause

How to verify CuDNN installation?

I have searched many places but ALL I get is HOW to install it, not how to verify that it is installed. I can verify my NVIDIA driver is installed, and that CUDA is installed, but I don't know how to verify CuDNN is installed. Help will be much appreciated, thanks!
PS.
This is for a caffe implementation. Currently everything is working without CuDNN enabled.
The installation of CuDNN is just copying some files. Hence to check if CuDNN is installed (and which version you have), you only need to check those files.
Install CuDNN
Step 1: Register an nvidia developer account and download cudnn here (about 80 MB). You might need nvcc --version to get your cuda version.
Step 2: Check where your cuda installation is. For most people, it will be /usr/local/cuda/. You can check it with which nvcc.
Step 3: Copy the files:
$ cd folder/extracted/contents
$ sudo cp include/cudnn.h /usr/local/cuda/include
$ sudo cp lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
Check version
You might have to adjust the path. See step 2 of the installation.
$ cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
edit: In later versions this might be the following (credits to Aris)
$ cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
Notes
When you get an error like
F tensorflow/stream_executor/cuda/cuda_dnn.cc:427] could not set cudnn filter descriptor: CUDNN_STATUS_BAD_PARAM
with TensorFlow, you might consider using CuDNN v4 instead of v5.
Ubuntu users who installed it via apt: https://askubuntu.com/a/767270/10425
My answer shows how to check the version of CuDNN installed, which is usually something that you also want to verify. You first need to find the installed cudnn file and then parse this file. To find the file, you can use:
whereis cudnn.h
CUDNN_H_PATH=$(whereis cudnn.h)
If that doesn't work, see "Redhat distributions" below.
Once you find this location you can then do the following (replacing ${CUDNN_H_PATH} with the path):
cat ${CUDNN_H_PATH} | grep CUDNN_MAJOR -A 2
The result should look something like this:
#define CUDNN_MAJOR 7
#define CUDNN_MINOR 5
#define CUDNN_PATCHLEVEL 0
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
Which means the version is 7.5.0.
Ubuntu 18.04 (via sudo apt install nvidia-cuda-toolkit)
This method of installation installs cuda in /usr/include and /usr/lib/cuda/lib64, hence the file you need to look at is in /usr/include/cudnn.h.
CUDNN_H_PATH=/usr/include/cudnn.h
cat ${CUDNN_H_PATH} | grep CUDNN_MAJOR -A 2
Debian and Ubuntu
From CuDNN v5 onwards (at least when you install via sudo dpkg -i <library_name>.deb packages), it looks like you might need to use the following:
cat /usr/include/x86_64-linux-gnu/cudnn_v*.h | grep CUDNN_MAJOR -A 2
For example:
$ cat /usr/include/x86_64-linux-gnu/cudnn_v*.h | grep CUDNN_MAJOR -A 2
#define CUDNN_MAJOR 6
#define CUDNN_MINOR 0
#define CUDNN_PATCHLEVEL 21
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
#include "driver_types.h"
indicates that CuDNN version 6.0.21 is installed.
Redhat distributions
On CentOS, I found the location of CUDA with:
$ whereis cuda
cuda: /usr/local/cuda
I then used the procedure about on the cudnn.h file that I found from this location:
$ cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
To check installation of CUDA, run below command, if it’s installed properly then below command will not throw any error and will print correct version of library.
function lib_installed() { /sbin/ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep $1; }
function check() { lib_installed $1 && echo "$1 is installed" || echo "ERROR: $1 is NOT installed"; }
check libcuda
check libcudart
To check installation of CuDNN, run below command, if CuDNN is installed properly then you will not get any error.
function lib_installed() { /sbin/ldconfig -N -v $(sed 's/:/ /' <<< $LD_LIBRARY_PATH) 2>/dev/null | grep $1; }
function check() { lib_installed $1 && echo "$1 is installed" || echo "ERROR: $1 is NOT installed"; }
check libcudnn
OR
you can run below command from any directory
nvcc -V
it should give output something like this
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61
Installing CuDNN just involves placing the files in the CUDA directory. If you have specified the routes and the CuDNN option correctly while installing caffe it will be compiled with CuDNN.
You can check that using cmake. Create a directory caffe/build and run cmake .. from there. If the configuration is correct you will see these lines:
-- Found cuDNN (include: /usr/local/cuda-7.0/include, library: /usr/local/cuda-7.0/lib64/libcudnn.so)
-- NVIDIA CUDA:
-- Target GPU(s) : Auto
-- GPU arch(s) : sm_30
-- cuDNN : Yes
If everything is correct just run the make orders to install caffe from there.
Getting cuDNN Version [Linux]
Use following to find path for cuDNN:
cat $(whereis cudnn.h) | grep CUDNN_MAJOR -A 2
If above doesn't work try this:
cat $(whereis cuda)/include/cudnn.h | grep CUDNN_MAJOR -A 2
Getting cuDNN Version [Windows]
Use following to find path for cuDNN:
C:\>where cudnn*
C:\Program Files\cuDNN6\cuda\bin\cudnn64_6.dll
Then use this to dump version from header file,
type "%PROGRAMFILES%\cuDNN6\cuda\include\cudnn.h" | findstr "CUDNN_MAJOR CUDNN_MINOR CUDNN_PATCHLEVEL"
Getting CUDA Version
This works on Linux as well as Windows:
nvcc --version
When installing on ubuntu via .deb you can use sudo apt search cudnn | grep installed
I have cuDNN 8.0 and none of the suggestions above worked for me. The desired information was in /usr/include/cudnn_version.h, so
cat /usr/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
did the trick.
On Ubuntu 20.04LTS:
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR
returned the expected results
torch.backends.cudnn.version()
should do the trick
How about checking with python code:
from tensorflow.python.platform import build_info as tf_build_info
print(tf_build_info.cudnn_version_number)
# 7 in v1.10.0
Run ./mnistCUDNN in /usr/src/cudnn_samples_v7/mnistCUDNN
Here is an example:
cudnnGetVersion() : 7005 , CUDNN_VERSION from cudnn.h : 7005 (7.0.5)
Host compiler version : GCC 5.4.0
There are 1 CUDA capable devices on your machine :
device 0 : sms 30 Capabilities 6.1, SmClock 1645.0 Mhz, MemSize (Mb) 24446, MemClock 4513.0 Mhz, Ecc=0, boardGroupID=0
Using device 0
For CUDnn 8.1 and above use the following command:
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
torch.backends.cudnn.m.is_available()

Cannot build bitcoin

Get sauce from github, read instructions in doc/build-unix.txt. But make can not into compile!
[urs1412#noname bitcoin]$ cd src
[urs1412#noname src]$ make -f makefile.unix
g++ -c -O2 -pthread -Wall -Wextra -Wformat -Wformat-security \
-Wno-unused-parameter -g -DBOOST_SPIRIT_THREADSAFE \
-D_FILE_OFFSET_BITS=64 -I/home/urs1412/w/bitcoin/src \
-I/home/urs1412/w/bitcoin/src/obj -DUSE_UPNP=0 -DUSE_IPV6=1 \
-I/home/urs1412/w/bitcoin/src/leveldb/include \
-I/home/urs1412/w/bitcoin/src/leveldb/helpers \
-DHAVE_BUILD_INFO -fno-stack-protector \
-fstack-protector-all -Wstack-protector \
-D_FORTIFY_SOURCE=2 -MMD -MF obj/alert.d \
-o obj/alert.o alert.cpp \
alert.cpp:6:53: fatal error: boost/algorithm/string/classification.hpp:
No such file or directory
compilation terminated.
make: *** [obj/alert.o] Error 1
td;dr could not build bitcoin, dumping system info
[urs1412#noname src]$ uname -r
3.6.10-4.fc18.x86_64
[urs1412#noname src]$ git log -n 1
commit 77a1e12eed5fc66dce16584696f54988a8c2bf4e
Merge: fe15aa3 0565b71
Author: Gavin Andresen
Date: Wed Apr 24 08:48:06 2013 -0700
Merge pull request #2554 from fanquake/qt-pro-brew-patch
bitcoin-qt.pro Brew patch
I finally was able to build bitcoin-1.8 (not the git sources, although I believe these same steps will be applicable) on my CentOS VPS.
Here are the packages I had to install. Note that I had to build some of these.
As root:
yum install gcc-c++ make
install boost-devel
yum install db4-devel
yum install openssl-devel # but this didn't provide ec.h, hence the next steps
yum install rpm-build
rpm -U ~jcomeau/rpmbuild/RPMS/x86_64/openssl-devel-1.0.0e-1.x86_64.rpm
yum install lynx # for downloading some source packages
yum install python-devel # for building miniupnpc
rpm -i ~jcomeau/rpmbuild/RPMS/x86_64/libminiupnpc9-1.8.20130503-0.1.x86_64.rpm
rpm -i ~jcomeau/rpmbuild/RPMS/x86_64/libminiupnpc-devel-1.8.20130503-0.1.x86_64.rpm
Then as user, make BOOST_LIB_SUFFIX=-mt all test
If you need instructions on building the openssl-devel (the spec file was in the sources and mostly functional) and libminiupnpc-devel (I got the spec file from an OpenSUSE source RPM and adapted it) let me know.
I believe your immediate problem is you didn't install openssl-devel. But you will likely run into these other problems after that, if you don't do some of the steps I did.
Make sure that boost library for gcc is working correctly. Try a test "hello world" program with boost. You can find it in the directory: BOOST_BUILD_PATH/example/hello
Compile it with BOOST_BUILD_PATH/bin/b2 toolset=gcc
If it doesnt work then boost is not correctly installed.

How do I fix "Symbol not found: _is_prefix" when compiling Perl's DBD::mysql?

First I wanted to build the DBD::mysql package. That kept failing because whatever make resulted in could not be loaded for the tests with a Symbol not found: _is_prefix. So I assumed that cpan might be a tad old. I know it's a random assumption, but cpan did tell me to install the latest Bundle::CPAN.
Who's successfully installed either DBD::mysql or Bundle::CPAN on Mac OS X 10.5? Could you recommend any thing I could be doing differently?
This is perl, v5.8.8 built for darwin-thread-multi-2level
(with 4 registered patches, see perl -V for more detail)
/usr/local/mysql/bin/mysql Ver 14.14 Distrib 5.1.36,
for apple-darwin9.5.0 (i386) using readline 5.1
Here's a log of the CPAN output for DBD::mysql:
Writing Makefile for DBD::mysql
cc -c -I/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI -I/usr/local/mysql/include -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch ppc -arch i386 -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include -O3 -DVERSION=\"4.012\" -DXS_VERSION=\"4.012\" "-I/System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE" dbdimp.c
/usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI/Driver.xst > mysql.xsi
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
/usr/bin/perl /System/Library/Perl/5.8.8/ExtUtils/xsubpp -typemap /System/Library/Perl/5.8.8/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs
chmod 644 blib/arch/auto/DBD/mysql/mysql.bs
Warning: duplicate function definition 'do' detected in mysql.xs, line 225
Warning: duplicate function definition 'rows' detected in mysql.xs, line 650
cc -c -I/Library/Perl/5.8.8/darwin-thread-multi-2level/auto/DBI -I/usr/local/mysql/include -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -arch ppc -arch i386 -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -Wdeclaration-after-statement -I/usr/local/include -O3 -DVERSION=\"4.012\" -DXS_VERSION=\"4.012\" "-I/System/Library/Perl/5.8.8/darwin-thread-multi-2level/CORE" mysql.c
dbdimp.c: In function 'mysql_describe':
dbdimp.c:3309: warning: assignment from incompatible pointer type
dbdimp.c: In function 'mysql_describe':
dbdimp.c:3309: warning: assignment from incompatible pointer type
rm -f blib/arch/auto/DBD/mysql/mysql.bundle
LD_RUN_PATH="/usr/local/mysql/lib" /usr/bin/perl myld cc -mmacosx-version-min=10.5.7 -arch ppc -arch i386 -bundle -undefined dynamic_lookup -L/usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle \
-L/usr/local/mysql/lib -lmysqlclient -lz -lm \
chmod 755 blib/arch/auto/DBD/mysql/mysql.bundle
Manifying blib/man3/DBD::mysql.3pm
Manifying blib/man3/DBD::mysql::INSTALL.3pm
Manifying blib/man3/Bundle::DBD::mysql.3pm
CAPTTOFU/DBD-mysql-4.012.tar.gz
/usr/bin/make -j3 -j3 -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base.t .................. 1/6 Bailout called. Further testing stopped: Unable to load DBD::mysql
# Failed test 'use DBD::mysql;'
# at t/00base.t line 21.
# Tried to use 'DBD::mysql'.
# Error: Can't load '/Users/dlamblin/.cpan/build/DBD-mysql-4.012-4n3pv8/blib/arch/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Users/dlamblin/.cpan/build/DBD-mysql-4.012-4n3pv8/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Symbol not found: _is_prefix
# Referenced from: /Users/dlamblin/.cpan/build/DBD-mysql-4.012-4n3pv8/blib/arch/auto/DBD/mysql/mysql.bundle
# Expected in: dynamic lookup
# at (eval 7) line 2
# Compilation failed in require at (eval 7) line 2.
# BEGIN failed--compilation aborted at (eval 7) line 2.
FAILED--Further testing stopped: Unable to load DBD::mysql
make: *** [test_dynamic] Error 255
CAPTTOFU/DBD-mysql-4.012.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports CAPTTOFU/DBD-mysql-4.012.tar.gz
Running make install
make test had returned bad status, won't install without force
Failed during this command:
CAPTTOFU/DBD-mysql-4.012.tar.gz : make_test NO
Okay, if you get these errors I now know the following:
MySQL 5.1 for Mac OS X x86_64 is not compatible with DBD::mysql (yet). Install the 32-bit x86 version, and try again. You'll succeed. I wish the perl Makefile.pl would just tell you that in a banner.
Bundle::CPAN had issues because I wasn't installing as root. Why that makes it report circular references instead of installation permission issues, I'll never understand.
Please add a comment if and when this became outdated information.
Installing the (beta) 5.4.1 64 bit version of mysql, available from their developer website, fixes the issue. Tested on Snow Leopard.
Did you try installing Bundle::DBD::mysql?
I haven't dealt with this problem, but I found that MacPorts cleaned up all my UNIX incompatibility problems. You might want to try that before enduring too much pain and suffering.
Where is it complaining about a circular dependency? It looks like you are trying to link to an incompatible version of the mysql libraries. The symbol it's looking for isn't in the library you loaded. I don't think this is a problem caused by CPAN.pm or the cpan script.
Some questions:
Who compiled perl? Is this Apple's perl?
Who compiled mysql? Is that your own version since it's in /usr/local?
Did you previously compile other versions? I start with a compile to ensure everything points to the right places.
Installing latest beta 64bit version of Mysql fixed problem on my computer.