Find the answer to your Linux question:
Results 1 to 7 of 7
I will be grateful if someone can help me out here please. I wish to make a static binary of the Bash shell. I am using the latest version of ...
  1. #1
    Just Joined!
    Join Date
    Nov 2006
    Posts
    25

    Multiple definitions compliling error

    I will be grateful if someone can help me out here please.

    I wish to make a static binary of the Bash shell. I am using the latest version of make and gcc.

    I compile using the - $>export CFLAGS="-static -O2 -g" before running ./configure, upon make I end up with this error message shown at the bottom of this post every time regardless if I try and use an older version of make and gcc or older Bash source code.

    Can you please tell me what to do to make the source, and if you do provide useful help can they be produced as commands that can be copy and pasted straight on to the command line please.

    Many thanks
    William


    /opt/bash-3.2/bashline.c:1759: warning: Using 'getservent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /opt/bash-3.2/bashline.c:1756: warning: Using 'setservent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /opt/bash-3.2/bashline.c:1781: warning: Using 'endservent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
    /usr/lib/../lib64/libc.a(malloc.o): In function `free':
    (.text+0x1c80): multiple definition of `free'
    ./lib/malloc/libmalloc.a(malloc.o):/opt/bash-3.2/lib/malloc/malloc.c:1271: first defined here
    /usr/lib/../lib64/libc.a(malloc.o): In function `malloc':
    (.text+0x3fd0): multiple definition of `malloc'
    ./lib/malloc/libmalloc.a(malloc.o):/opt/bash-3.2/lib/malloc/malloc.c:1256: first defined here
    /usr/lib/../lib64/libc.a(malloc.o): In function `realloc':
    (.text+0x4460): multiple definition of `realloc'
    ./lib/malloc/libmalloc.a(malloc.o):/opt/bash-3.2/lib/malloc/malloc.c:1264: first defined here
    collect2: ld returned 1 exit status
    make: *** [bash] Error 1

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Code:
    ./configure --enable-static-link --without-bash-malloc
    Might help.

  3. #3
    Just Joined!
    Join Date
    Nov 2006
    Posts
    25
    Thanks,

    That did the trick, though I am now confused. When I went to make install it gave me this error message.

    ( cd ./po/ ; make DESTDIR= installdirs )
    make[1]: Entering directory `/opt/bash-3.2/po'
    /bin/sh /opt/bash-3.2/./support/mkinstalldirs /usr/local/share
    if test "bash" = "gettext-tools"; then \
    /bin/sh /opt/bash-3.2/./support/mkinstalldirs /usr/local/share/gettext/po; \
    else \
    : ; \
    fi
    make[1]: Leaving directory `/opt/bash-3.2/po'
    /usr/local/bin/install -c -m 0755 bash /usr/local/bin/bash
    /usr/local/bin/install -c -m 0555 bashbug /usr/local/bin/bashbug
    ( cd ./doc ; make \
    man1dir=/usr/local/man/man1 man1ext=.1 \
    man3dir=/usr/local/man/man3 man3ext=.3 \
    infodir=/usr/local/info htmldir= DESTDIR= install )
    make[1]: Entering directory `/opt/bash-3.2/doc'
    makeinfo --no-split -I../lib/readline/doc ./bashref.texi
    make[1]: makeinfo: Command not found
    make[1]: *** [bashref.info] Error 127
    make[1]: Leaving directory `/opt/bash-3.2/doc'
    make: [install] Error 2 (ignored)
    ( cd ./builtins ; make DESTDIR= install )
    make[1]: Entering directory `/opt/bash-3.2/builtins'
    make[1]: Nothing to be done for `install'.
    make[1]: Leaving directory `/opt/bash-3.2/builtins'
    ( cd ./po/ ; make DESTDIR= install )
    make[1]: Entering directory `/opt/bash-3.2/po'
    test -z "en@quot.gmo en@boldquot.gmo ru.gmo" || make en@quot.gmo en@boldquot.gmo ru.gmo
    make[2]: Entering directory `/opt/bash-3.2/po'
    make[2]: `en@quot.gmo' is up to date.
    make[2]: `en@boldquot.gmo' is up to date.
    rm -f ru.gmo && /usr/local/bin/msgfmt -c --statistics -o ru.gmo ru.po
    ru.po:21:9: invalid multibyte sequence
    ru.po:21:10: invalid multibyte sequence
    ru.po:21:11: invalid multibyte sequence
    ru.po:21:12: invalid multibyte sequence
    ru.po:21:13: invalid multibyte sequence
    ru.po:21:14: invalid multibyte sequence
    ru.po:21:15: invalid multibyte sequence
    ru.po:21:16: invalid multibyte sequence
    ru.po:21:17: invalid multibyte sequence
    ru.po:21:18: invalid multibyte sequence
    ru.po:21:19: invalid multibyte sequence
    ru.po:21:20: invalid multibyte sequence
    ru.po:21:22: invalid multibyte sequence
    ru.po:21:23: invalid multibyte sequence
    ru.po:21:24: invalid multibyte sequence
    ru.po:21:25: invalid multibyte sequence
    ru.po:21:26: invalid multibyte sequence
    ru.po:21:27: invalid multibyte sequence
    ru.po:21:29: invalid multibyte sequence
    ru.po:21:30: invalid multibyte sequence
    /usr/local/bin/msgfmt: too many errors, aborting
    make[2]: *** [ru.gmo] Error 1
    make[2]: Leaving directory `/opt/bash-3.2/po'
    make[1]: *** [stamp-po] Error 2
    make[1]: Leaving directory `/opt/bash-3.2/po'
    make: [install] Error 2 (ignored)


    What is confusing and can someone confirm this please, is that last step (make install) irrelevant? After running make, it finished properly, many warnings about the statically linked application requires at run time shared libraries in glibc. After make completed it gave this message at the end.

    ls -l bash
    -rwxr-xr-x 1 root root 3537042 2008-09-07 00:59 bash
    size bash
    text data bss dec hex filename
    1427214 59512 37416 1524142 1741ae bash


    Does this state it has already has made the binary? When I checked the bash --version it reported the latest version, the one just compiled? The older version still resides in /bin/bash the newer in /usr/local/bin/bash.

    So is it good just to leave it after make and not proceed any further with make install?

    I guess the answer lies in one of the lines of the error message reported after make install,

    make[1]: Nothing to be done for `install'.

    Can someone please confirm this and that I am not missing something.

    Thanks
    William

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    It seems you don't have makeinfo installed. It's part of the texinfo package, try installing that and repeat the make install step. If all you plan is to get the binary to put it somewhere, then it must be somewhere under the bash source tree that you just compiled.

  5. #5
    Just Joined!
    Join Date
    Nov 2006
    Posts
    25
    I successfully installed texinfo.

    I repeated the steps but upon make install I still have the same error message.

    ( cd ./po/ ; make DESTDIR= installdirs )
    make[1]: Entering directory `/opt/bash-3.2/po'
    /bin/sh /opt/bash-3.2/./support/mkinstalldirs /usr/local/share
    if test "bash" = "gettext-tools"; then \
    /bin/sh /opt/bash-3.2/./support/mkinstalldirs /usr/local/share/gettext/po; \
    else \
    : ; \
    fi
    make[1]: Leaving directory `/opt/bash-3.2/po'
    /usr/local/bin/install -c -m 0755 bash /usr/local/bin/bash
    /usr/local/bin/install -c -m 0555 bashbug /usr/local/bin/bashbug
    ( cd ./doc ; make \
    man1dir=/usr/local/man/man1 man1ext=.1 \
    man3dir=/usr/local/man/man3 man3ext=.3 \
    infodir=/usr/local/info htmldir= DESTDIR= install )
    make[1]: Entering directory `/opt/bash-3.2/doc'
    makeinfo --no-split -I../lib/readline/doc ./bashref.texi
    /bin/sh ../support/mkinstalldirs /usr/local/man/man1
    /bin/sh ../support/mkinstalldirs /usr/local/info
    if test -n "" ; then \
    /bin/sh ../support/mkinstalldirs ; \
    fi
    /bin/sh ./infopost.sh < ./bashref.info > bash.info ; \

    /usr/local/bin/install -c -m 644 ./bash.1 /usr/local/man/man1/bash.1
    /usr/local/bin/install -c -m 644 ./bashbug.1 /usr/local/man/man1/bashbug.1
    /usr/local/bin/install -c -m 644 ./bash.info /usr/local/info/bash.info
    if /bin/sh -c 'install-info --version' >/dev/null 2>&1; then \
    install-info --dir-file=/usr/local/info/dir /usr/local/info/bash.info; \
    else true; fi
    if test -n "" ; then \
    /usr/local/bin/install -c -m 644 ./bash.html ; \
    /usr/local/bin/install -c -m 644 ./bashref.html ; \
    fi
    make[1]: Leaving directory `/opt/bash-3.2/doc'
    ( cd ./builtins ; make DESTDIR= install )
    make[1]: Entering directory `/opt/bash-3.2/builtins'
    make[1]: Nothing to be done for `install'.
    make[1]: Leaving directory `/opt/bash-3.2/builtins'
    ( cd ./po/ ; make DESTDIR= install )
    make[1]: Entering directory `/opt/bash-3.2/po'
    test -z "en@quot.gmo en@boldquot.gmo ru.gmo" || make en@quot.gmo en@boldquot.gmo ru.gmo
    make[2]: Entering directory `/opt/bash-3.2/po'
    make[2]: `en@quot.gmo' is up to date.
    make[2]: `en@boldquot.gmo' is up to date.
    rm -f ru.gmo && /usr/local/bin/msgfmt -c --statistics -o ru.gmo ru.po
    ru.po:21:9: invalid multibyte sequence
    ru.po:21:10: invalid multibyte sequence
    ru.po:21:11: invalid multibyte sequence
    ru.po:21:12: invalid multibyte sequence
    ru.po:21:13: invalid multibyte sequence
    ru.po:21:14: invalid multibyte sequence
    ru.po:21:15: invalid multibyte sequence
    ru.po:21:16: invalid multibyte sequence
    ru.po:21:17: invalid multibyte sequence
    ru.po:21:18: invalid multibyte sequence
    ru.po:21:19: invalid multibyte sequence
    ru.po:21:20: invalid multibyte sequence
    ru.po:21:22: invalid multibyte sequence
    ru.po:21:23: invalid multibyte sequence
    ru.po:21:24: invalid multibyte sequence
    ru.po:21:25: invalid multibyte sequence
    ru.po:21:26: invalid multibyte sequence
    ru.po:21:27: invalid multibyte sequence
    ru.po:21:29: invalid multibyte sequence
    ru.po:21:30: invalid multibyte sequence
    /usr/local/bin/msgfmt: too many errors, aborting
    make[2]: *** [ru.gmo] Error 1
    make[2]: Leaving directory `/opt/bash-3.2/po'
    make[1]: *** [stamp-po] Error 2
    make[1]: Leaving directory `/opt/bash-3.2/po'
    make: [install] Error 2 (ignored)


    Any ideas?

    Before I run make install. I can invoke the bash shell? I type bash and the prompt changes to bash-3.2$.

    Thanks

  6. #6
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Well, it's not the same (now it doesn't complain about makeinfo).

    Maybe there's something odd about utf8 on your system or something. I don't really know. You could try disabling/enabling nls, the parameter is something like "--disable-nls" (or enable), I think. Add it to your configure line and try.

  7. #7
    Just Joined!
    Join Date
    Nov 2006
    Posts
    25
    Thank you, the --disable-nls appeared to have removed the ru.po errors.

    I did a google search for this problem, and it appears the wrong coding was used in the po/ru.po file in early releases of bash 3.2. However, there is no mention of the KOI8 encoding in po/ru.po file for the release I downloaded. So I don't know why it still failed?

    Anyway the -disable-nls switch worked. Thank you.

Posting Permissions

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