Find the answer to your Linux question:
Results 1 to 8 of 8
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Readline error when trying to compile 'bluez' from source


    Code:
      CC     client/main.o
      CC     client/display.o
      CC     client/agent.o
      CC     monitor/uuid.o
      CCLD   client/bluetoothctl
    /usr/lib/gcc/i486-slackware-linux/4.8.2/../../../libreadline.so: undefined reference to `tputs'
    /usr/lib/gcc/i486-slackware-linux/4.8.2/../../../libreadline.so: undefined reference to `tgoto'
    /usr/lib/gcc/i486-slackware-linux/4.8.2/../../../libreadline.so: undefined reference to `tgetflag'
    /usr/lib/gcc/i486-slackware-linux/4.8.2/../../../libreadline.so: undefined reference to `UP'
    /usr/lib/gcc/i486-slackware-linux/4.8.2/../../../libreadline.so: undefined reference to `tgetent'
    /usr/lib/gcc/i486-slackware-linux/4.8.2/../../../libreadline.so: undefined reference to `tgetnum'
    /usr/lib/gcc/i486-slackware-linux/4.8.2/../../../libreadline.so: undefined reference to `PC'
    /usr/lib/gcc/i486-slackware-linux/4.8.2/../../../libreadline.so: undefined reference to `tgetstr'
    /usr/lib/gcc/i486-slackware-linux/4.8.2/../../../libreadline.so: undefined reference to `BC'
    collect2: error: ld returned 1 exit status
    make[1]: *** [client/bluetoothctl] Error 1
    make: *** [all] Error 2
    As you can see, all seems to be going well until the libreadline errors. Unfortunately I'm not that familiar with these kinds of errors when compiling. Can someone help me out here?

  2. #2
    Linux Guru
    Join Date
    Dec 2013
    Location
    Victoria, B.C. Canada
    Posts
    2,103
    Hi Surgeont.

    It looks like you're missing libcurses.

  3. #3
    Quote Originally Posted by gregm View Post
    Hi Surgeont.

    It looks like you're missing libcurses.
    Hey thanks,
    Looking at the manpage for it it seems right. But libcurses isn't available for linux according to the unix manpages URL (can't link)

    And the README for the program I'm trying to install (bluez) says I only need

    GCC compiler
    GLib library
    D-Bus library
    udev library (optional)
    readline

    all of which I could find on my system.

    Is it ncurses that I need (which seems to be on my system)
    libncurses? (which I can't find almost anything about on google)

    I do have ncurses though, so it seems to be either libcurses or libncurses.

    I'm confused

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Dec 2013
    Location
    Victoria, B.C. Canada
    Posts
    2,103
    It's readline that is looking for libcurses. How did you install it?

  6. #5
    Quote Originally Posted by gregm View Post
    It's readline that is looking for libcurses. How did you install it?
    The standard installation from my distro for the configure is as follows:

    Code:
    ncurses_configure() {
    CFLAGS="$SLKCFLAGS" \
    ./configure \
      --prefix=/usr \
      --libdir=/usr/lib${LIBDIRSUFFIX} \
      --mandir=/usr/man \
      --with-gpm \
      --disable-termcap \
      --with-normal \
      --with-shared \
      --enable-symlinks \
      --enable-pc-files \
      --with-pkg-config-libdir=/usr/lib${LIBDIRSUFFIX}/pkgconfig \
      --without-debug \
      --without-profile \
      --without-ada \
      $X86_64OPTS \
      --program-suffix="" \
      --program-prefix="" \
      $WIDEC \
      --build=$ARCH-slackware-linux
    }

    The whole script (for make install etc.) is here:
    Code:
    #!/bin/sh
    
    # Copyright 2000-2011, 2013  Patrick J. Volkerding, Sebeka, MN, USA
    # All rights reserved.
    #
    # Redistribution and use of this script, with or without modification, is
    # permitted provided that the following conditions are met:
    #
    # 1. Redistributions of this script must retain the above copyright
    #    notice, this list of conditions and the following disclaimer.
    #
    #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
    #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
    #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
    #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
    PKGNAM=ncurses
    VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
    BUILD=${BUILD:-2}
    
    # Automatically determine the architecture we're building on:
    if [ -z "$ARCH" ]; then
      case "$( uname -m )" in
        i?86) export ARCH=i486 ;;
        arm*) export ARCH=arm ;;
        # Unless $ARCH is already set, use uname -m for all other archs:
           *) export ARCH=$( uname -m ) ;;
      esac
    fi
    
    CWD=$(pwd)
    TMP=${TMP:-/tmp}
    PKG=$TMP/package-ncurses
    
    if [ "$ARCH" = "i486" ]; then
      SLKCFLAGS="-O2 -march=i486 -mtune=i686"
      LIBDIRSUFFIX=""
    elif [ "$ARCH" = "s390" ]; then
      SLKCFLAGS="-O2"
      LIBDIRSUFFIX=""
    elif [ "$ARCH" = "x86_64" ]; then
      SLKCFLAGS="-O2 -fPIC"
      X86_64OPTS=" --with-chtype=long --with-mmask-t=long "
      LIBDIRSUFFIX="64"
    else
      SLKCFLAGS="-O2"
      LIBDIRSUFFIX=""
    fi
    
    ncurses_configure() {
    CFLAGS="$SLKCFLAGS" \
    ./configure \
      --prefix=/usr \
      --libdir=/usr/lib${LIBDIRSUFFIX} \
      --mandir=/usr/man \
      --with-gpm \
      --disable-termcap \
      --with-normal \
      --with-shared \
      --enable-symlinks \
      --enable-pc-files \
      --with-pkg-config-libdir=/usr/lib${LIBDIRSUFFIX}/pkgconfig \
      --without-debug \
      --without-profile \
      --without-ada \
      $X86_64OPTS \
      --program-suffix="" \
      --program-prefix="" \
      $WIDEC \
      --build=$ARCH-slackware-linux
    }
    
    rm -rf $PKG
    mkdir -p $TMP $PKG
    
    cd $TMP
    rm -rf ncurses-$VERSION
    tar xvf $CWD/ncurses-$VERSION.tar.?z || exit 1
    cd ncurses-$VERSION || exit 1
    chown -R root:root .
    
    # This allows some other patches to come first by making them bz2...  gz next
    if [ ! -z "$(ls $CWD/patches/ncurses*bz2 2> /dev/null)" ]; then
      bzcat $CWD/patches/ncurses*bz2 > tmp-patch.sh
      bash tmp-patch.sh || exit 1
    fi
    # Apply official upstream patches.
    if [ ! -z "$(ls $CWD/patches/ncurses-$VERSION-2*.patch.gz 2> /dev/null)" ]; then
      for file in $CWD/patches/ncurses-$VERSION-2*.patch.gz ; do
        zcat $file | patch -p1 --verbose || exit 1
      done
    fi
    
    # Apply upstream patch collection:
    xzcat $CWD/ncurses-5.9-20130504-patch.sh.xz > ncurses-5.9-20130504-patch.sh
    sh ncurses-5.9-20130504-patch.sh
    
    zcat $CWD/ncurses.mkhashsize.diff.gz | patch -p1 --verbose || exit 1
    
    ncurses_configure
    make -j4 || exit 1
    # Spamming the partition.
    # Sorry, but it's about the only way to get a good 'tic'.
    make install
    # Install the package:
    make install DESTDIR=$PKG
    
    # Build/install again with wide character support:
    make clean
    WIDEC=--enable-widec
    ncurses_configure
    make -j4 || exit 1
    make install
    make install DESTDIR=$PKG
    
    if [ ! -d $PKG/usr/include/ncursesw -a ! -L $PKG/usr/include/ncursesw ]; then
      ( cd $PKG/usr/include ; ln -sf ncurses ncursesw )
    fi
    
    # Strip stuff:
    find $PKG | xargs file | grep -e "executable" -e "shared object" \
      | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
    
    # Move the include files from /usr/include into
    # /usr/include/ncurses, then make symlinks back
    # into /usr/include.
    ( cd $PKG/usr/include
      rm -rf ncurses
      mkdir ncurses
      mv *.h ncurses
      for file in ncurses/* ; do
        ln -sf $file .
      done
      # This shouldn't clobber the real one:
      mv termcap.h termcap-ncurses.h
    )
    
    # Move the ncurses libraries into /lib, since they're important:
    mkdir -p $PKG/lib${LIBDIRSUFFIX}
    ( cd $PKG/usr/lib${LIBDIRSUFFIX}
      chmod 755 *.so
      chmod 644 *.a
      mv libncurses.so.5* $PKG/lib${LIBDIRSUFFIX}
      mv libncursesw.so.5* $PKG/lib${LIBDIRSUFFIX}
      rm -f libncurses.so
      ln -sf /lib${LIBDIRSUFFIX}/libncurses.so.5 libncurses.so
      rm -f libncursesw.so
      ln -sf /lib${LIBDIRSUFFIX}/libncursesw.so.5 libncursesw.so
      # Olde obsolete names, just in case
      rm -f libcurses.so
      ln -sf libncurses.so libcurses.so
      rm -f libcursesw.so
      ln -sf libncursesw.so libcursesw.so
    )
    
    # Set TERMINFO to point to the package:
    export TERMINFO=$PKG/usr/share/terminfo
    # Fix the xterm, screen, rxvt, and Eterm entries:
    for tfile in $CWD/xterm.terminfo $CWD/screeninfo.src $CWD/rxvt.terminfo $CWD/Eterm.ti ; do
      if [ -r $tfile ]; then
        progs/tic -v $tfile
      fi
    done
    unset TERMINFO
    
    # Then, add /usr/doc/ncurses-xxxxx with appropriate files.
    mkdir -p $PKG/usr/doc/ncurses-$VERSION
    cp -a \
      ANNOUNCE INSTALL MANIFEST NEWS README* TO-DO \
      $PKG/usr/doc/ncurses-$VERSION
    mkdir -p $PKG/usr/doc/ncurses-$VERSION/c++
    cp -a \
      c++/NEWS c++/PROBLEMS c++/README-first \
      $PKG/usr/doc/ncurses-$VERSION/c++
    if [ -r $PKG/usr/man/man1/tack.1 ]; then
      gzip -9 --force $PKG/usr/man/man1/tack.1
    fi
    
    # We don't need the log of every change here, but we'll take some.
    # If you need the whole thing probably you already extracted the
    # sources...
    if [ -r NEWS ]; then
      DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
      cat NEWS | head -n 1000 > $DOCSDIR/NEWS
      echo >> $DOCSDIR/NEWS
      echo "        +++  SNIP  +++  " >> $DOCSDIR/NEWS
      echo >> $DOCSDIR/NEWS
      echo "  see source code for full file  " >> $DOCSDIR/NEWS
      echo >> $DOCSDIR/NEWS
      touch -r NEWS $DOCSDIR/NEWS
    fi
    
    # desc file:
    mkdir -p $PKG/install
    cat $CWD/slack-desc > $PKG/install/slack-desc
    
    cd $PKG
    /sbin/makepkg -l y -c n $TMP/ncurses-$VERSION-$ARCH-$BUILD.txz
    That's for ncruses btw. readline is here:

    Code:
    #!/bin/sh
    
    # Copyright 2005-2010  Patrick J. Volkerding, Sebeka, MN, USA
    # All rights reserved.
    #
    # Redistribution and use of this script, with or without modification, is
    # permitted provided that the following conditions are met:
    #
    # 1. Redistributions of this script must retain the above copyright
    #    notice, this list of conditions and the following disclaimer.
    #
    #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
    #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
    #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
    #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    
    
    VERSION=5.2
    BUILD=${BUILD:-4}
    
    # Automatically determine the architecture we're building on:
    if [ -z "$ARCH" ]; then
      case "$( uname -m )" in
        i?86) export ARCH=i486 ;;
        arm*) export ARCH=arm ;;
        # Unless $ARCH is already set, use uname -m for all other archs:
           *) export ARCH=$( uname -m ) ;;
      esac
    fi
    
    CWD=$(pwd)
    TMP=${TMP:-/tmp}
    PKG=$TMP/package-readline
    
    if [ "$ARCH" = "i486" ]; then
      SLKCFLAGS="-O2 -march=i486 -mtune=i686"
      LIBDIRSUFFIX=""
    elif [ "$ARCH" = "s390" ]; then
      SLKCFLAGS="-O2"
      LIBDIRSUFFIX=""
    elif [ "$ARCH" = "x86_64" ]; then
      SLKCFLAGS="-O2 -fPIC"
      LIBDIRSUFFIX="64"
    else
      SLKCFLAGS="-O2"
      LIBDIRSUFFIX=""
    fi
    
    rm -rf $PKG
    mkdir -p $TMP $PKG
    
    cd $TMP
    rm -rf readline-$VERSION
    tar xvf $CWD/readline-$VERSION.tar.?z* || exit 1
    cd readline-$VERSION || exit 1
    chown -R root:root .
    find . \
      \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
      -exec chmod 755 {} \; -o \
      \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
      -exec chmod 644 {} \;
    for file in $CWD/readline-*-patches/readline*-??? ; do
      cat $file | patch -p0 --verbose || exit 1
    done
    
    CFLAGS="$SLKCFLAGS" \
    ./configure \
      --prefix=/usr \
      --libdir=/usr/lib${LIBDIRSUFFIX} \
      --infodir=/usr/info \
      --with-curses \
      --enable-multibyte \
      --build=$ARCH-slackware-linux-gnu
    
    make -j4 static shared || exit 1
    make install DESTDIR=$PKG
    
    find $PKG | xargs file | grep -e "executable" -e "shared object" \
      | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
    
    rm $PKG/usr/info/dir
    gzip -9 $PKG/usr/man/man3/*
    gzip -9 $PKG/usr/info/*
    
    chmod 755 $PKG/usr/lib${LIBDIRSUFFIX}/lib*.so.*
    
    mkdir -p $PKG/usr/doc/readline-$VERSION
    cp -a \
      CHANGELOG CHANGES COPYING* INSTALL MANIFEST README* USAGE \
      $PKG/usr/doc/readline-$VERSION
    
    mkdir -p $PKG/install
    cat $CWD/slack-desc > $PKG/install/slack-desc
    
    # Build the package:
    cd $PKG
    /sbin/makepkg -l y -c n $TMP/readline-$VERSION-$ARCH-$BUILD.txz

  7. #6
    Linux Guru
    Join Date
    Dec 2013
    Location
    Victoria, B.C. Canada
    Posts
    2,103
    The problem is when readline is configured --with-curses it expects to find the termcap functions in the curses library. Your ncurses invocation is without termcap so you can try removing the --disable-termcap from ncurses or removing the --with-curses form readline in which case it will expect the termcap library to be linked.

  8. #7
    Quote Originally Posted by gregm View Post
    The problem is when readline is configured --with-curses it expects to find the termcap functions in the curses library. Your ncurses invocation is without termcap so you can try removing the --disable-termcap from ncurses or removing the --with-curses form readline in which case it will expect the termcap library to be linked.
    hm, I removed ncurses, and re-installed it without --disable-termcap, but to no avail. The error is the same.

    What kind of topic is this anyway? I'd like to learn this stuff from the basics so I can compile/automate compilation of programs more easily without relying on something like apt-get.

  9. #8
    Linux Guru
    Join Date
    Dec 2013
    Location
    Victoria, B.C. Canada
    Posts
    2,103
    -->
    I'm a programmer so I suppose you could say I learned it the hard way. To learn more about it you can study the linux build tools. gcc is the C compiler, make is the build tool. Then their are the autotools which are used to automate builds.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •