https://github.com/akheron/jansson
Instructions are:
$ ./configure
$ make
$ make install
----------------------------------------------------------------------
This did not work, so I tried the other suggestion, to run "autoreconf -i":
pi@raspberrypi /mnt/nas-backup/apps/raspi/jansson $ sudo autoreconf -i
configure.ac:11: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
Error.
----------------------------------------------------------------------
No joy, Googling found this:
http://forum.xbmc.org/showthread.php?tid=63780
"hi try apt-get install libtool an run ./bootstrap ./configure again."
----------------------------------------------------------------------
So try installing libtool:
pi@raspberrypi /mnt/nas-backup/apps/raspi/jansson $ sudo apt-get install libtool
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libltdl-dev libltdl7
Suggested packages:
libtool-doc gfortran fortran95-compiler gcj
The following NEW packages will be installed:
libltdl-dev libltdl7 libtool
0 upgraded, 3 newly installed, 0 to remove and 17 not upgraded.
Need to get 1,170 kB of archives.
After this operation, 2,756 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libltdl7 armhf 2.4.2-1.1 [349 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libltdl-dev armhf 2.4.2-1.1 [203 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libtool armhf 2.4.2-1.1 [618 kB]
Fetched 1,170 kB in 6s (187 kB/s)
Selecting previously unselected package libltdl7:armhf.
(Reading database ... 57093 files and directories currently installed.)
Unpacking libltdl7:armhf (from .../libltdl7_2.4.2-1.1_armhf.deb) ...
Selecting previously unselected package libltdl-dev:armhf.
Unpacking libltdl-dev:armhf (from .../libltdl-dev_2.4.2-1.1_armhf.deb) ...
Selecting previously unselected package libtool.
Unpacking libtool (from .../libtool_2.4.2-1.1_armhf.deb) ...
Processing triggers for man-db ...
Setting up libltdl7:armhf (2.4.2-1.1) ...
Setting up libltdl-dev:armhf (2.4.2-1.1) ...
Setting up libtool (2.4.2-1.1) ...
----------------------------------------------------------------------
And try "autoreconf -i" again:
pi@raspberrypi /mnt/nas-backup/apps/raspi/jansson $ sudo autoreconf -i
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
configure.ac:11: installing `./config.guess'
configure.ac:11: installing `./config.sub'
configure.ac:4: installing `./install-sh'
configure.ac:4: installing `./missing'
src/Makefile.am: installing `./depcomp'
pi@raspberrypi /mnt/nas-backup/apps/raspi/jansson $ ll
total 17408
drwxr-xr-x 1 root root 0 Aug 26 20:45 .
drwxr-xr-x 1 root root 0 Aug 26 20:23 ..
-rwxr-xr-x 1 root root 343810 Aug 26 20:43 aclocal.m4
drwxr-xr-x 1 root root 0 Aug 26 20:44 autom4te.cache
-rwxr-xr-x 1 root root 11735 Aug 11 10:45 CHANGES
-rwxr-xr-x 1 root root 44826 Aug 26 20:45 config.guess
-rwxr-xr-x 1 root root 2397 Aug 26 20:45 config.h.in
-rwxr-xr-x 1 root root 35543 Aug 26 20:45 config.sub
-rwxr-xr-x 1 root root 415106 Aug 26 20:45 configure
-rwxr-xr-x 1 root root 1246 Aug 11 10:45 configure.ac
-rwxr-xr-x 1 root root 20899 Aug 26 20:45 depcomp
drwxr-xr-x 1 root root 0 Aug 26 20:45 doc
-rwxr-xr-x 1 root root 253 Aug 11 10:45 .gitignore
-rwxr-xr-x 1 root root 13998 Aug 26 20:45 install-sh
-rwxr-xr-x 1 root root 244 Aug 11 10:45 jansson.pc.in
-rwxr-xr-x 1 root root 1081 Aug 11 10:45 LICENSE
-rwxr-xr-x 1 root root 283670 Aug 26 20:44 ltmain.sh
-rwxr-xr-x 1 root root 273 Aug 11 10:45 Makefile.am
-rwxr-xr-x 1 root root 26456 Aug 26 20:45 Makefile.in
-rwxr-xr-x 1 root root 10346 Aug 26 20:45 missing
-rwxr-xr-x 1 root root 1322 Aug 11 10:45 README.rst
drwxr-xr-x 1 root root 0 Aug 26 20:45 src
drwxr-xr-x 1 root root 0 Aug 26 20:45 test
drwxr-xr-x 1 root root 0 Aug 26 20:22 win32
Worked!
----------------------------------------------------------------------
Compiling the Jansson example:
http://www.digip.org/jansson/doc/2.3/tutorial.html
http://www.digip.org/jansson/doc/2.3/_downloads/github_commits.c
Requires curl/curl.h!
----------------------------------------------------------------------
So try and install curl dev tools.
pi@raspberrypi ~ $ sudo apt-get install libcurl4-gnutls-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
comerr-dev krb5-multidev libcomerr2 libcurl3-gnutls libgcrypt11-dev libgnutls-dev libgnutls-openssl27 libgnutlsxx27 libgpg-error-dev libgssapi-krb5-2 libgssrpc4
libidn11-dev libk5crypto3 libkadm5clnt-mit8 libkadm5srv-mit8 libkdb5-6 libkrb5-3 libkrb5-dev libkrb5support0 libldap-2.4-2 libldap2-dev libp11-kit-dev librtmp-dev
libssh2-1 libssh2-1-dev libtasn1-3-dev
Suggested packages:
doc-base krb5-doc libgcrypt11-doc gnutls-doc krb5-user
The following NEW packages will be installed:
comerr-dev krb5-multidev libcurl3-gnutls libcurl4-gnutls-dev libgcrypt11-dev libgnutls-dev libgnutls-openssl27 libgnutlsxx27 libgpg-error-dev libgssrpc4 libidn11-dev
libkadm5clnt-mit8 libkadm5srv-mit8 libkdb5-6 libkrb5-dev libldap2-dev libp11-kit-dev librtmp-dev libssh2-1-dev libtasn1-3-dev
The following packages will be upgraded:
libcomerr2 libgssapi-krb5-2 libk5crypto3 libkrb5-3 libkrb5support0 libldap-2.4-2 libssh2-1
7 upgraded, 20 newly installed, 0 to remove and 100 not upgraded.
Need to get 2,375 kB/6,657 kB of archives.
After this operation, 11.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
[installed]
----------------------------------------------------------------------
Proof:
pi@raspberrypi ~ $ sudo find / -name curl.h
/usr/include/curl/curl.h
----------------------------------------------------------------------
No idea where the headers and libraries live. This command was the only way I could get it to work.
Specifying the full path to the jansson.h (-I) and libjansson.so (-L) files.
I found this site quite useful:
http://www.rapidtables.com/code/linux/gcc.htm
pi@raspberrypi /mnt/nas-backup/apps/raspi/jansson $ sudo gcc -o github_commits github_commits.c -lcurl -I/mnt/nas-backup/apps/raspi/jansson/src -L/mnt/nas-backup/apps/raspi/jansson/src/.libs -ljansson
----------------------------------------------------------------------
Again, running was a pain as I was getting this:
pi@raspberrypi /mnt/nas-backup/apps/raspi/jansson $ ./github_commits https://github.com/akheron/jansson.git
./github_commits: error while loading shared libraries: libjansson.so.4: cannot open shared object file: No such file or directory
----------------------------------------------------------------------
So I had to revert to a hack documented here:
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
pi@raspberrypi /mnt/nas-backup/apps/raspi/jansson $ LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH:/mnt/nas-backup/apps/raspi/jansson/src/.libs/ ./github_commits akheron jansson
0dac319b CHANGES entry for #88
0b871a11 Merge branch '2.3'
8176527f fix check-exports test on ppc64
ec7bb71d Add an initial CHANGES entry for v2.4
b6a1d8cf Add json_boolean() macro
52924288 Merge branch '2.3'
7892ecce Fix a small error in tutorial
a501a396 Document the JSON_ESCAPE_SLASH encoding flag
37bc3bbf Tweak slash escaping
2d46ea06 Merge branch 'fix-slash' of git://github.com/jrbasso/jansson
b217cd66 Created flag to dump escaping slash
a0c262d0 Escaping the slash when dump
6ce273e2 Merge branch '2.3'
f62b1f5d Bugfix: must cast void* to do pointer math
2b87fdcb Bugfix: Changed all use of ssize_t to size_t.
c0139681 Update the documentation to mention Visual Studio 2010 support
9d6f9511 Merge pull request #74 from rogerz/contrib
a79f64e1 Fix build warnings under MinGW
7ca783c3 Add vs2010 solution and project
ff0c05b8 Support building on Windows
4601bf71 Merge branch '2.3'
c7f86abf fix slight typo in json_pack apiref example
f309e303 Merge branch '2.3'
233574e8 fix slight typo in json_pack apiref example
4a6939ef Merge branch '2.3'
42bc7a3c Check for missing args and envvars in run-tests.sh
abdb8d99 Merge branch '2.3'
ff6e6ee2 jansson 2.3.1
8b2bfd55 Merge branch '2.3'
e46b912f Fix tutorial to use Github API v3
----------------------------------------------------------------------
Then I actually did what the instructions said!
http://www.digip.org/jansson/doc/dev/gettingstarted.html
That is, I ran the following commands. All as sudo so that my Pi can write to my NAS share.
./configure
make
make check
make install
Did a check for the library, and found it:
pi@raspberrypi ~ $ sudo find / -name libjansson.so
/mnt/nas-backup/apps/raspi/jansson/src/.libs/libjansson.so
/usr/local/lib/libjansson.so
But still didn't work. Apparently I need to do more.
This SO link mentions "/etc/ld.so.conf", so let's have a look:
http://stackoverflow.com/questions/4743233/is-usr-local-lib-searched-for-shared-libraries
pi@raspberrypi ~ $ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
Ok, one include. Let's follow that up:
pi@raspberrypi ~ $ ll /etc/ld.so.conf.d
total 20
drwxr-xr-x 2 root root 4096 Jul 15 20:06 .
drwxr-xr-x 88 root root 4096 Aug 27 17:58 ..
-rw-r--r-- 1 root root 12 Jul 15 18:12 00-vmcs.conf
-rw-r--r-- 1 root root 74 Jun 10 06:07 arm-linux-gnueabihf.conf
-rw-r--r-- 1 root root 44 Jun 10 01:36 libc.conf
And again:
pi@raspberrypi ~ $ cat /etc/ld.so.conf.d/libc.conf
# libc default configuration
/usr/local/lib
Ok, so looks like "libjansson.so" has been copied to the right place. Why isn't it working?
More Googling, and now let's try reloading (?) the libraries:
pi@raspberrypi ~ $ ldconfig
ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
Nope, try sudo:
pi@raspberrypi ~ $ sudo ldconfig
And...
pi@raspberrypi /mnt/nas-backup/apps/raspi/raspi-fun/c/lcd-bbc-json/grimbo $ sudo ./bbctests
grimbo_url_url_to_buffer(http://www.bbc.co.uk/tv/programmes/genres/factual/scienceandnature/schedules/upcoming.json)
Using temp file /tmp/grimbo_url_R6v1wk
File descriptor 3
grimbo_url_url_to_file_descriptor(http://www.bbc.co.uk/tv/programmes/genres/factual/scienceandnature/schedules/upcoming.json, 7704584)
grimbo_url_wget(http://www.bbc.co.uk/tv/programmes/genres/factual/scienceandnature/schedules/upcoming.json)
cmd=wget -qO- http://www.bbc.co.uk/tv/programmes/genres/factual/scienceandnature/schedules/upcoming.json
grimbo_url_copy(7704952, 7704584)
read 10239 bytes
read 10239 bytes
read 10239 bytes
read 8768 bytes
written 39485 bytes
written=39485
status=0
Child exit code: 0
buffer=7704952
page=1.000000
total=66.000000
offset=0.000000
Works!