[blfs-support] JSON-C fails to build

Bruce Dubbs bruce.dubbs at gmail.com
Fri Dec 20 09:41:40 PST 2013

Dan McGhee wrote:
> On 12/20/2013 11:18 AM, Armin K. wrote:
>> On 12/20/2013 06:15 PM, Dan McGhee wrote:
>>> I'm building JSON-C as a dependency for PulseAudio.  It fails to build with:
>>>> /bin/sh ./libtool --tag=CC   --mode=link gcc -Wall -Werror -Wextra
>>>> -Wwrite-strings -Wno-unused-parameter -std=gnu99 -D_GNU_SOURCE
>>>> -D_REENTRANT -g -O2 -version-info 1:0:1 -no-undefined -ljson-c  -o
>>>> libjson.la -rpath /usr/lib libjson.lo -ljson-c
>>>> mv -f .deps/json_util.Tpo .deps/json_util.Plo
>>>> mv -f .deps/printbuf.Tpo .deps/printbuf.Plo
>>>> mv -f .deps/linkhash.Tpo .deps/linkhash.Plo
>>>> libtool: link: gcc -shared  .libs/libjson.o   -ljson-c -Wl,-soname
>>>> -Wl,libjson.so.0 -o .libs/libjson.so.0.1.0
>>>> /usr/bin/ld: cannot find -ljson-c
>>>> collect2: error: ld returned 1 exit status
>>>> make[2]: *** [libjson.la] Error 1
>>>> make[2]: *** Waiting for unfinished jobs....
>>>> mv -f .deps/json_object.Tpo .deps/json_object.Plo
>>>> mv -f .deps/json_tokener.Tpo .deps/json_tokener.Plo
>>>> make[2]: Leaving directory `/usr/src/json-c-0.11/json-c-0.11'
>>>> make[1]: Leaving directory `/usr/src/json-c-0.11/json-c-0.11'
>>>> make[1]: *** [all-recursive] Error 1
>>>> make: *** [all] Error 2
>>> I don't know if it's relevant, but the README file contains this:
>>>> Linking to libjson-c
>>>> If your system has pkgconfig then you can just add this to your makefile
>>>> CFLAGS += $(shell pkg-config --cflags json-c)
>>>> LDFLAGS += $(shell pkg-config --libs json-c)
>>>> Without pkgconfig, you would do something like this:
>>>> JSON_C_DIR=/path/to/json_c/install
>>>> CFLAGS += -I$(JSON_C_DIR)/include/json-c
>>>> LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c
>>> If it's relevant to pass any of these things to get JSON-C to build, how
>>> and where would I do it?
>>> Thanks,
>>> Dan
>> libjson-c is built as part of the same package and it should be present
>> in the build directory, .libs subdirectory.
> That's what I thought, and what I saw when I looked into the build
> directory. That's what I found so strange. But the build failed four
> times. I wonder if there's something wrong in $PATH. I use the Package
> Users system, and I'm investigating that possibility right now. However,
> this is the first and only package of almost 200 that I've built in
> {,B}LFS so far that has failed to build.

When you have a problem with package users, try falling back to the 
standard build procedures up to the point where you install.  Also try 
building (again not installing) as root to remove possible permission 
problems.  If that works, you need to go back and debug the problems you 

   -- Bruce

More information about the blfs-support mailing list