On 5/11/19 5:28 PM, Niels Terp wrote:

On 5/10/19 5:25 PM, Niels Terp wrote:

    Hey, I’m kind of new here. I build LFS several times a few years
    ago, but then got busy with other things.

    Now I’m back, I’m following current stable lfs, and here is my
    first problem:

    I have a script that builds the  temporary system. Since i want to
    install RPM, I continue with the deps of RPM, among wich is elfutils.

    It is set up like chapter 6.48.1 with ./configure –prefix=/tools
    –program-prefix=”eu-”

    When I run ”make” I get these errors:

      CC dwarf_next_lines.os

      AR libdw.a

      AR libdw_pic.a

      CCLD libdw.so

    
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
    
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/libbz2.a(bzlib.o):
    relocation R_X86_64_32S against symbol `BZ2_crc32Table' can not be
    used when making a shared object; recompile with -fPIC

    
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
    
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/libbz2.a(compress.o):
    relocation R_X86_64_32 against `.rodata.str1.1' can not be used
    when making a shared object; recompile with -fPIC

    
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
    
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/libbz2.a(decompress.o):
    relocation R_X86_64_32S against `.rodata' can not be used when
    making a shared object; recompile with -fPIC

    
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
    
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../lib64/libbz2.a(blocksort.o):
    relocation R_X86_64_32 against `.rodata.str1.1' can not be used
    when making a shared object; recompile with -fPIC

    
/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
    final link failed: nonrepresentable section on output

    collect2: error: ld returned 1 exit status

    make[3]: *** [Makefile:1372: libdw.so] Error 1

    make[2]: *** [Makefile:614: all] Error 2

    make[1]: *** [Makefile:485: all-recursive] Error 1

    make: *** [Makefile:401: all] Error 2

    The full log file is enclosed.

    I see that I have to recompile with -fPIC – but how do I do that ?

Bzip2 is the problem child, here this is a snippet from my build scripts (tools.sh) and it will "correct" your problem

set -o errexit    # exit if error...insurance ;)
set -o nounset    # exit if variable not initalized
set +h        # disable hashall
#    Common variables
PRGNAME=${0##*/}        # script name minus the path
TOPDIR=${PWD}            # this directory
PARENT=/usr/src/LFS-RPM        # build system master directory
LOGFILE=$(date +%Y-%m-%d).log    # Not Used
MKFLAGS="-j 1"            # Number of cpu to use in building pkgs default = 1
#    environment from lfs user
LFS=/mnt/lfs            # where the build will be
LC_ALL=POSIX
LFS_TGT=${HOSTTYPE}-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH

function msg {
    printf "%s\n" "${1}"
    return
}

function msg_line {
    printf "%s" "${1}"
    return
}

function msg_success {
    local _green="\\033[1;32m"
    local _normal="\\033[0;39m"
    printf "${_green}%s${_normal}\n" "SUCCESS"
    return
}

function clean_build-directory {
    msg_line "Cleaning BUILD directory: "
        rm -rf ${TOPDIR}/BUILD/*
        rm -rf ${TOPDIR}/BUILDROOT/*
    msg_success
    return
}

function Bzip {
    #    Bzip2-1.0.6
    local pkg=bzip2-1.0.6.tar.gz
    local pkg_dir=${pkg%%.tar*}
    local logfile="${TOPDIR}/LOGS/tools-${FUNCNAME}.log"
    local OPTFLAGS=" -march=x86-64 -mtune=generic -O2 -pipe -fPIC "
    [ -e ${logfile}.complete ] && { msg "Skipping: ${FUNCNAME}";return 0; } || msg "Building: ${FUNCNAME}"
    > ${logfile}
    pushd ${TOPDIR}/BUILD >> /dev/null 2>&1
        unpack "${pkg}"
        pushd ${pkg_dir} >> /dev/null 2>&1
            msg_line "    Configure: "
                sed -i "s|-O2|${OPTFLAGS}|g" Makefile
                sed -i "s|-O2|${OPTFLAGS}|g" Makefile-libbz2_so
            msg_success
            msg_line "         Make: "
                make ${MKFLAGS} >> ${logfile} 2>&1
            msg_success
            msg_line "      Install: "
                make PREFIX=/tools install >> ${logfile} 2>&1
            msg_success
        popd > /dev/null 2>&1
    popd > /dev/null 2>&1
    clean_build-directory
    mv ${logfile} ${logfile}.complete
    return
}

I copyed the two sed lines and the def of OPTFLAGS to my script. After doing that, I could now build elfutils without error.

The next problem is rpm itself, ’make’ ends in

thread -Wl,-rpath -Wl,/tools/lib

/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1/lib/.libs/librpm.so: undefined reference to `db_env_set_func_fsync'

/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1/lib/.libs/librpm.so: undefined reference to `db_create'

/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1/lib/.libs/librpm.so: undefined reference to `db_env_create'

/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1/lib/.libs/librpm.so: undefined reference to `db_strerror'

collect2: error: ld returned 1 exit status

make[2]: *** [Makefile:955: rpm] Error 1

make[2]: Leaving directory '/mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1'

make[1]: *** [Makefile:1332: all-recursive] Error 1

"chapter-05-rpm.log" 665L, 105518C                            657,1         99%

/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1/lib/.libs/librpm.so: undefined reference to `db_env_set_func_fsync'

/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1/lib/.libs/librpm.so: undefined reference to `db_create'

/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1/lib/.libs/librpm.so: undefined reference to `db_env_create'

/mnt/lfs/tools/bin/../lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1/lib/.libs/librpm.so: undefined reference to `db_strerror'

collect2: error: ld returned 1 exit status

make[2]: *** [Makefile:955: rpm] Error 1

make[2]: Leaving directory '/mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1'

make[1]: *** [Makefile:1332: all-recursive] Error 1

make[1]: Leaving directory '/mnt/lfs/usr/src/Octothorpe/BUILD/rpm-4.14.2.1'

make: *** [Makefile:767: all] Error 2

I have attached the full log file. Hope you can help with this one too.

Cheers

Niels



This is my configureation to build rpm, maybe it will help you

You need openssl, popt and berkley db I use ver 6.0.20

  sed -i 's/--srcdir=$db_dist/--srcdir=$db_dist --with-pic/' db3/configure
  ln -vs db-6.0.20 db
  ./configure \
                --prefix=/tools \
                --program-prefix= \
                --sysconfdir=/tools/etc \
                --disable-dependency-tracking \
                --disable-shared \
                --disable-silent-rules \
                --without-archive \
                --without-lua \
                --without-plugins \
                --with-crypto=openssl \
                --enable-static \
                --enable-zstd=no \
                --enable-lmdb=no \
                --disable-rpath \
                --without-external-db



-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to