Compilation libjson-c fails

Issue #15 resolved
created an issue

Hi Shibby,

While attempting to compile v132 I ran into issue below, from my understanding its something with libtool but idk what because I didn't change it or upgrade it. My current libtool version is 2.2.10 (the issue presents itself in all builds RT-AC/RT-N and ARM):

make[5]: Leaving directory '/home/jacky/advancedtomato-ac/release/src/router/comgt'
cd /home/jacky/advancedtomato-ac/release/src-rt/router/libjson-c && CC=mipsel-uclibc-gcc STRIP=mipsel-uclibc-strip \
autoconf && \
./configure --host=mipsel-linux --build=x86_64-linux-gnu --prefix=/usr error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation. error: possibly undefined macro: AM_PROG_CC_C_O error: possibly undefined macro: AM_PROG_LIBTOOL
make[4]: *** [libjson-c/stamp-h1] Error 1
Makefile:2583: recipe for target 'libjson-c/stamp-h1' failed
make[4]: Leaving directory '/home/jacky/advancedtomato-ac/release/src/router'
make[3]: *** [all] Error 2
Makefile:118: recipe for target 'all' failed
make[3]: Leaving directory '/home/jacky/advancedtomato-ac/release/src-rt'
make[2]: *** [bin] Error 2
Makefile:1008: recipe for target 'bin' failed
make[2]: Leaving directory '/home/jacky/advancedtomato-ac/release/src-rt'
make[1]: *** [z] Error 2
Makefile:1088: recipe for target 'z' failed
make[1]: Leaving directory '/home/jacky/advancedtomato-ac/release/src-rt'
make: *** [r64z] Error 2
Makefile:1307: recipe for target 'r64z' failed

Comments (39)

  1. Anonymous
    diff --git a/release/src-rt-6.x.4708/router/Makefile b/release/src-rt-6.x.4708/router/Makefile
    index 6085d6c..47867db 100644
    --- a/release/src-rt-6.x.4708/router/Makefile
    +++ b/release/src-rt-6.x.4708/router/Makefile
    @@ -2776,7 +2776,7 @@ ipset-clean:
            cd $(TOP)/libjson-c && CC=$(CC) STRIP=$(CROSS_COMPILE)strip \
    -       autoconf && \
    +       autoreconf -if && \
            $(CONFIGURE) --prefix=/usr
            touch libjson-c/stamp-h1

    But be prepared for other uqmi build problems. Makefile missing in uqmi (cmake should be called, or Makefiles should be committed). Currently I recommend to completely disable uqmi in router/Makefile if you do not need it.

  2. JackyP reporter

    Thank you very much for such fast response! I tried compiling changing the above commands but I'm still getting this (looks like some module or idk what is missing :///):

    cd /home/jacky/advancedtomato-ac/release/src-rt/router/libjson-c && CC=mipsel-uclibc-gcc STRIP=mipsel-uclibc-strip \
    autoreconf -if && \
    ./configure --host=mipsel-linux --build=x86_64-linux-gnu --prefix=/usr warning: macro 'AM_PROG_LIBTOOL' not found in library error: possibly undefined macro: AM_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
  3. JackyP reporter

    K so I checked libtool, when using whereis paths are:

    jacky@build:~$ whereis libtool
    libtool: /usr/bin/libtool /usr/share/libtool /home/jacky/advancedtomato-arm/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin/libtool /usr/share/man/man1/libtool.1.gz

    Which should be ok right? so then I checked installed version is 2.4.2 but when using libtool --version system shows 2.20 which is from tomato toolchain. Now is it possible the problem is that libtool command uses old version instead of installed newer version? I tried lots of things but can't get pass this libjson issue and its driving me nuts =)

  4. JackyP reporter

    Thank you very much Shibby. I tried changing paths so Libtool 2.4 is first and still same issue. Also maybe a note my build commands are under my repo's readme file so if some new lib or something is required in 132 please let me know. And I thanks for your time, very much appreciated!

  5. nikk gitanes

    Thanks, Shibby. Now it's all compiled without issues on my SuSe:

    make -C uqmi SHARED=0 CC='arm-brcm-linux-uclibcgnueabi-gcc -static'
    make[1]: Entering directory '/home/tomato-arm/release/src-rt-6.x.4708/router/uqmi'
    arm-brcm-linux-uclibcgnueabi-gcc -static -o uqmi main.o dev.o commands.o qmi-message.o qmi-message-ctl.o qmi-message-dms.o qmi-message-nas.o qmi-message-pds.o qmi-message-wds.o qmi-message-wms.o qmi-message-wda.o -ffunction-sections -fdata-sections -Wl,--gc-sections -Llibubox -lubox
    make[1]: Leaving directory '/home/tomato-arm/release/src-rt-6.x.4708/router/uqmi'
  6. JackyP reporter

    Still the same issue even after all the changes (manually checked to be sure) idk :(

    UPDATE (it is bit different msg):

    cd /home/jacky/advancedtomato-ac/release/src-rt/router/libjson-c && CC=mipsel-uclibc-gcc STRIP=mipsel-uclibc-strip \
    ./ && \
    ./configure --host=mipsel-linux --build=x86_64-linux-gnu --prefix=/usr
    autoreconf: Entering directory `.'
    autoreconf: not using Gettext
    autoreconf: running: aclocal warning: macro 'AM_PROG_LIBTOOL' not found in library
    autoreconf: tracing
    autoreconf: not using Libtool
    autoreconf: running: /usr/bin/autoconf error: possibly undefined macro: AM_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
    Makefile:2583: recipe for target 'libjson-c/stamp-h1' failed

    P.S.: I've been reading somewhere that with new libtool AM_PROG_LIBTOOL has been deprecated and replaced but =/ what do i know haha i'm noob at these things. Source:

  7. JackyP reporter
    jacky@build:~/advancedtomato-ac/release/src/router/libjson-c$ ./
    autoreconf: Entering directory `.'
    autoreconf: not using Gettext
    autoreconf: running: aclocal warning: macro 'AM_PROG_LIBTOOL' not found in library
    autoreconf: tracing
    autoreconf: not using Libtool
    autoreconf: running: /usr/bin/autoconf
    autoreconf: running: /usr/bin/autoheader
    autoreconf: running: automake --add-missing --copy --no-force error: Libtool library used but 'LIBTOOL' is undefined   The usual way to define 'LIBTOOL' is to add 'LT_INIT'   to '' and run 'aclocal' and 'autoconf' again.   If 'LT_INIT' is in '', make sure   its definition is in aclocal's search path.
    autoreconf: automake failed with exit status: 1
    jacky@build:~/advancedtomato-ac/release/src/router/libjson-c$ aclocal warning: macro 'AM_PROG_LIBTOOL' not found in library

    I have a feeling some app is not the same version as you use either way I tried running various commands for auto configs etc and its always AM_PROG_LIBTOOL problem :D

    Update: Just fixed my sources list files in Debian and got message of 966 upgrades available. I have a feeling I have really old libs installed I will try to update and try again o.O
    Update2: Nope, no changes still same issue.

  8. pl_shibby repo owner

    try remove autom4te.cache directory and configure file from libjson-c, then run

    enter to tollchain directory and check is it include AM_PROG_LIBTOOL

    grep --color -iHnr 'AM_PROG_LIBTOOL' .

    my result:

    shibby@wishmaker:/opt/hndtools-arm-linux-2.6.36-uclibc-4.5.3$ grep --color -iHnr 'AM_PROG_LIBTOOL' .
    ./share/aclocal-1.11/obsol-lt.m4:12:AU_DEFUN([gm_PROG_LIBTOOL], [AM_PROG_LIBTOOL])
    ./share/autoconf/autoconf/oldnames.m4:90:# AU_ALIAS([AM_PROG_LIBTOOL],          [AC_PROG_LIBTOOL])
    ./share/info/ -- Macro: AM_PROG_LIBTOOL
    ./share/info/     `configure' flags.(1)  `AC_PROG_LIBTOOL' and `AM_PROG_LIBTOOL' are
    Plik binarny ./share/info/ pasuje do wzorca
    Plik binarny ./share/info/ pasuje do wzorca
    ./share/aclocal/gtk-doc.m4:10:  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
    ./share/aclocal/libtool.m4:108:AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
    ./share/aclocal/libtool.m4:111:dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
  9. JackyP reporter

    Ok so I tried compiling on my VirtualBox KDE5 machine and Libjson passes under Ubuntu 15.05 without a problem. The compilation does fail at other parts like MySQL though. I know you base your builds on Debian but is there anyway you could maybe teach me or let me know how to handle compilation with Ubuntu instead? I never really liked Debian because it's always behind with updates, not to mention the GUI is just lolz for 2015 :D

  10. JackyP reporter

    I didn't see your previous message, I apologize. Paste from Debian machine bellow:

    jacky@build:/opt/hndtools-arm-linux-2.6.36-uclibc-4.5.3$ grep --color -iHnr
    Usage: grep [OPTION]... PATTERN [FILE]...
    Try 'grep --help' for more information.
    jacky@build:/opt/hndtools-arm-linux-2.6.36-uclibc-4.5.3$ grep --color -iHnr 'AM_PROG_LIBTOOL'
    share/autoconf/autoconf/oldnames.m4:90:# AU_ALIAS([AM_PROG_LIBTOOL],        [AC_PROG_LIBTOOL])
    share/info/     `AM_DISABLE_SHARED' before `AM_PROG_LIBTOOL'.  The configure
    share/info/     (this is where `AM_PROG_LIBTOOL' is defined) and gettext (this is
    share/info/* AM_PROG_LIBTOOL:                       Write  (line 122)
    share/info/* AM_PROG_LIBTOOL in configure:          FAQ.                 (line  19)
    share/info/ -- Macro: AM_PROG_LIBTOOL
    share/info/     `configure' flags.(1)  `AC_PROG_LIBTOOL' and `AM_PROG_LIBTOOL' are
    Binary file share/info/ matches
    share/aclocal/libtool.m4:108:AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
    share/aclocal/libtool.m4:111:dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
    share/aclocal/gtk-doc.m4:10:  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
    share/aclocal-1.11/obsol-lt.m4:12:AU_DEFUN([gm_PROG_LIBTOOL], [AM_PROG_LIBTOOL])

    Got a feeling this isn't good :D

  11. JackyP reporter

    Thanks, done, waiting to see what happens (compiling). The tutorial you posted didn't work though (lots of issues) had to go into each folder and call clean & make again, worked afterwards. We'll see what happens =) Thanks!

  12. JackyP reporter

    That worked! Now I got small issue with Debian vs Ubuntu libtool, I tried running autoreconf and autoconf but didn't help, can you point me where I can remake stuff for Ubuntu if it's not too much ofc, I'm sure I am really annoying now :(.

    mv -f .deps/conf_to_src.Tpo .deps/conf_to_src.Po
    /bin/bash ../libtool --preserve-dup-deps  --tag=CC   --mode=link mipsel-uclibc-gcc  -O2 -Wall -fno-delete-null-pointer-checks -funit-at-a-time --param large-function-growth=800        --
    param max-inline-insns-single=3000 -ffunction-sections -fdata-sections -I/home/jacky/advancedtomato-ac/release/src-rt/router/zlib       -I/home/jacky/advancedtomato-ac/release/src-rt/rou
    ter/openssl/include -I/home/jacky/advancedtomato-ac/release/src-rt/router/libncurses/include   -DUNIV_LINUX -DUNIV_LINUX -static -L/home/jacky/advancedtomato-ac/release/src-rt/router/ope
    nssl -L/home/jacky/advancedtomato-ac/release/src-rt/router/zlib/staged/usr/lib -L/home/jacky/advancedtomato-ac/release/src-rt/router/libncurses/lib -fPIC -EL -rdynamic  -o conf_to_src co
    nf_to_src.o xml.o ctype.o  -lpthread -lnsl -lm -lcrypt -lz -lstdc++ -lssl -lcrypto -lncurses -lpthread
    libtool: Version mismatch error.  This is libtool 2.4.2 Debian-2.4.2-1.11, but the
    libtool: definition of this LT_INIT comes from libtool 2.2.6.
    libtool: You should recreate aclocal.m4 with macros from libtool 2.4.2 Debian-2.4.2-1.11
    libtool: and run autoconf again.
    make[6]: *** [conf_to_src] Error 63
    Makefile:824: recipe for target 'conf_to_src' failed
  13. pl_shibby repo owner

    strange. I migrated few days ago from Debian 7 to 8 and didn`t have any problems with compilation on new server.

    remember: when you compile mysql on Mipsel you have to use configure.mipsel file

    cp -r mysql/configure.mipsel mysql/configure

  14. JackyP reporter

    Actually the last log is from failed libncurses compile :D MySQL went through fine (it seems). I don't know anymore there is so many issues always and each version (for me with basic knowledge) it's killing me =(

  15. JackyP reporter

    Since I added ARM Toolchains I fail with this:

    ./configure: line 3790: AM_PROG_LIBTOOL: command not found
    checking for -Bsymbolic-functions linker flag... yes
    configure: creating ./config.status
    config.status: error: cannot find input file: `'

    And libtool check:

    jacky@PC-BUILD:/opt/hndtools-arm-linux-2.6.36-uclibc-4.5.3⟫ grep --color -iHnr 'AM_PROG_LIBTOOL'
    share/autoconf/autoconf/oldnames.m4:90:# AU_ALIAS([AM_PROG_LIBTOOL],            [AC_PROG_LIBTOOL])
    Binary file share/info/ matches
    share/info/ -- Macro: AM_PROG_LIBTOOL
    share/info/     `configure' flags.(1)  `AC_PROG_LIBTOOL' and `AM_PROG_LIBTOOL' are
    Binary file share/info/ matches
    share/aclocal-1.11/obsol-lt.m4:12:AU_DEFUN([gm_PROG_LIBTOOL], [AM_PROG_LIBTOOL])
    share/aclocal/libtool.m4:108:AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
    share/aclocal/libtool.m4:111:dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
    share/aclocal/gtk-doc.m4:10:  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
  16. JackyP reporter

    Shibby is there any chance I could ask you to attempt to compile ARM/RT-N on Kubuntu 15.05? I really wonder what packages / libs I need to replace to get this working. Also maybe adding required stuff into toolchains so cross-distro compilation is easier?

  17. Tony Arnold

    I'm working through these instructions too and I've got further along thanks to your last commit, @pl_shibby, and I've found that the Makefile in router/pptpd is not being generated. I ran autoreconf -v --install in that directory and recompiled again, but no go — the Makefile still isn't there.

    Update, I restored Makefile.uClinux from, then ran the following to get past the missing Makefile:

    cd router/src-rt-6.x.4708/pptpd
    chmod +x reconf
    ./configure --host=arm-linux --build=i486-linux-gnu --prefix=/usr

    I also deleted router/src-rt-6.x.4708/mysql/.host.tgz

  18. Tony Arnold

    Yeah, I can't get this to build. pptpd keeps building as an i386 binary rather than an ARM binary. I assume there's a missing Makefile here that needs to be committed.

    This whole process seems super fragile — am I missing something? Shouldn't we be able to run autoreconf in most directories then configure and make?

  19. pl_shibby repo owner

    i downloaded fresh git repository, made "make distclean" first and compilation went without any issue well sources in GIT are completed. No need to do any reconf, autoreconf etc.

    @Tony Arnold - in pptpd directory was never Makefile file. But are and After run ./configure, Makefile will be created automatically.

    @JackyP - i will install kubuntu 15.05 in virtualbox and try compile tomato sources. Will let you know.

  20. JackyP reporter

    Thanks Shibby!

    I actually tried Debian 8.2 and compilation fails the same, I did compile all images with AIO (disabling nginx features ONLY) so the only problem I actually have is MySQL. From some digging on google I learned the bison might be the problem, however even after downgrading to 2.7 I still hit same issues. Also there are 2 different problems between ARM/RT-N/RT-AC. On ARM the issue seems "Cross-compilation testing failed" or something like that, as reported on one of threads one of the members changed some ./configure lines to make it work. On RT-AC/RT-N my issue is exactly the same as this users: (One post before last). I would say the difference between ARM/RT-N/RT-AC is the ./configure.mipsel file which fixes the ARM problems.

    For now I released new images without NGINX feature set. So everything works properly its just missing NGINX, PHP and MySQL. E.g.:

    Also one other note if it does mean anything, I created 3th Virtual Machine running Kubuntu 15.10 where tomato is impossible to compile. Half of required packages are deprecated (unavailable) and compilations fail very early. This is just for sharing information I learned nothing more.

    Thank you for your time and actually caring!

  21. pl_shibby repo owner

    Ok Jacky, tested on Kubuntu 15.10 and works. First pull latest commit (made one for fix mysql compilation). Then install/remove packages in order:

    // install base packages with all depends
    sudo apt-get install build-essential autoconf m4 bison flex g++ libtool sqlite gcc g++ binutils patch bzip2 make gettext unzip zlib1g-dev libc6 gperf sudo automake groff
    lib32stdc++6 libncurses5 libncurses5-dev gawk gitk zlib1g-dev autopoint shtool autogen mtd-utils gcc-multilib gconf-editor lib32z1-dev pkg-config libssl-dev automake1.11
    libxml2-dev intltool libglib2.0-dev libstdc++5 texinfo dos2unix xsltproc libnfnetlink0 libcurl4-openssl-dev libxml2-dev libgtk2.0-dev libnotify-dev libevent-dev mc git
    // remove it if installed. It stopped PHP compilation.
    sudo apt-get remove libicu-dev
    // install i386 elf1 packages
    sudo dpkg --add-architecture i386
    sudo apt-get install libelf1
    // install required automake packages
    sudo dpkg -i automake_1.13.2-1ubuntu1_all.deb
    sudo dpkg -i automake_1.14.1-2ubuntu1_all.deb
    // if version of installed bison is 3.0 or higher you have to install older one! PHP support only <3.0
    sudo apt-get remove bison libbison-dev
    sudo dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb
    sudo dpkg -i bison_2.7.1.dfsg-1_amd64.deb

    now add toolchain path to PATH (i changed $HOME/.profile file and added at the end)

    Alert: toolchain has to be AFTER default path`es, not before.

    After that i compiled r7000z without any issue. Didnt have to even recompile mysql/.host.tgz file :) Please let me know is this works for you

    Best Regards

  22. JackyP reporter

    Okay, good news! Compilation succeeded!

    I still hit issues like:

    make[8]: Entering directory '/home/jacky/advancedtomato-arm/release/src-rt-6.x.4708/router/dnscrypt/src/libevent-modified'
     cd . && /bin/bash /home/jacky/advancedtomato-arm/release/src-rt-6.x.4708/router/dnscrypt/src/libevent-modified/missing automake-1.14 --foreign error: version mismatch.  This is Automake 1.14.1, but the definition used by this AM_INIT_AUTOMAKE comes from Automake 1.14.  You should recreate aclocal.m4 with aclocal and run automake again.
    WARNING: 'automake-1.14' is probably too old.
             You should only need it if you modified '' or
             '' or m4 files included by ''.
             The 'automake' program is part of the GNU Automake package:
             It also requires GNU Autoconf, GNU m4 and Perl in order to run:
    make[8]: *** [] Error 1

    But I was able to resolve these on my own.
    I did exactly as you wrote above, any idea why would I hit such issue with exact same packages/prodocure?

    Also last question Shibby, when compiling arm/rt-n/rt-ac should I dynamically modify PATH for each toolchain or can I simply link all at the same time and just run automated compilation process? Like:

    echo "export PATH=$PATH:/sbin/:/opt/hndtools-arm-linux-2.6.36-uclibc-4.5.3/bin:/opt/brcm/hndtools-mipsel-linux/bin:/opt/brcm/hndtools-mipsel-uclibc/bin" 

    I would like to thank you again for helping me out and taking your time to do so! THANK YOU!

  23. 郁闷的太子

    Hi Shibby, regarding you procedure for Kubuntu 15.10, i would like to add in that, i used the same procedure for Ubuntu 15.10, and i need additional libraly for libelf-dev:i386 libelf1:i386 otherwise it wont compile.

    // install i386 elf1 packages
    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install libelf1 libelf-dev:i386 libelf1:i386

    I am compiling now and i hope i wont hit the libjson-c error....

    Update: I can compile correctly. but as soon as i enable nginx features for compile, i will stuck in MySQL cross compiling issues.... i have no idea how to fix this.

  24. 郁闷的太子

    Dear Shibby, thank you, first of all i cannot open the link you provided.

    I can fix the cross compiling error with the following method for configure file under mysql folder, and compiled firmware with MySQL successfully.

    if test "$cross_compiling" = yes; then
      echo "skip corss_compiling test";
    #{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
    #$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
    #{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
    #See \`config.log' for more details." >&5
    #$as_echo "$as_me: error: cannot run test program while cross compiling
    #See \`config.log' for more details." >&2;}
    #{ (exit 1); exit 1; }; }; }
  25. Log in to comment