Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

cannot compile bash or net-snmp

Hi,

I am trying to compile bash with the latest uClinux toolchain, but I get an error when trying to link the libraries:

nios2-linux-uclibc-gcc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde -L./lib/malloc -L./lib/sh -O2 -g  -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED   -I/home/amir/uClinux-dist -I/home/amir/uClinux-dist/include -fno-builtin -Dfork=vfork -D__adjtimex=adjtimex -Wl,-d -Wl,-elf2flt -L./lib/termcap  -rdynamic  -O2 -g  -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED   -I/home/amir/uClinux-dist -I/home/amir/uClinux-dist/include -fno-builtin -Dfork=vfork -D__adjtimex=adjtimex -I./lib/termcap -o bash shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o  dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o hashcmd.o hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o alias.o array.o braces.o bracecomp.o bashhist.o bashline.o siglist.o list.o stringlib.o locale.o findcmd.o redir.o pcomplete.o pcomplib.o syntax.o xmalloc.o -lbuiltins -lsh -lreadline -lhistory ./lib/termcap/libtermcap.a -lglob -ltilde -lmalloc  -L/home/amir/uClinux-dist/lib -L/home/amir/uClinux-dist/lib/libnet -L/home/amir/uClinux-dist/lib/libdes -L/home/amir/uClinux-dist/lib/libaes -L/home/amir/uClinux-dist/lib/libpcap -L/home/amir/uClinux-dist/lib/libssl -lcrypt -lutil -lc
nios2-linux-uclibc-gcc: unrecognized option `-rdynamic'
sh ./mkconfig > .config.tmp
bash.elf2flt(.text+0x58360): In function `tgetent':
/home/amir/uClinux-dist/user/bash/lib/termcap/termcap.c:734: undefined reference to `bcopy'
bash.elf2flt(.text+0x5860c): In function `tparam1':
/home/amir/uClinux-dist/user/bash/lib/termcap/tparam.c:166: undefined reference to `bcopy'
collect2: ld returned 1 exit status

Similarly, with net-snmp, I get the following error:

nios2-linux-uclibc-gcc -O2 -g  -Dlinux -D__linux__ -Dunix -D__uClinux__ -DEMBED   -I/home/urna/uClinux-dist -I/home/urna/uClinux-dist/include -fno-builtin -Dfork=vfork -D__adjtimex=adjtimex -shared  snmp_client.lo mib.lo parse.lo snmp_api.lo snmp.lo snmp_auth.lo asn1.lo md5.lo snmp_parse_args.lo system.lo vacm.lo int64.lo read_config.lo snmp_debug.lo tools.lo snmp_logging.lo snmpv3.lo lcd_time.lo keytools.lo scapi.lo callback.lo default_store.lo snmp_alarm.lo data_list.lo oid_stash.lo mt_support.lo snmp_enum.lo snmp-tc.lo snprintf.lo strlcpy.lo strtol.lo strtoul.lo strtok_r.lo snmp_transport.lo snmpUDPDomain.lo snmpTCPDomain.lo snmpUnixDomain.lo snmpCallbackDomain.lo snmp_secmod.lo snmpusm.lo snmp_version.lo check_varbind.lo container.lo container_binary_array.lo container_null.lo container_list_ssll.lo container_iterator.lo cmu_compat.lo ucd_compat.lo   -Wl,-soname -Wl,libnetsnmp.so.5 -o .libs/libnetsnmp.so.5.2.1
nios2-linux-uclibc-gcc: unrecognized option `-shared'
if cmp -s .config.mkconfig .config.tmp; 
        then 
                rm -f .config.tmp; 
        else 
                make clean; 
                mv -f .config.tmp .config.mkconfig; 
        fi
make: Leaving directory `/home/amir/uClinux-dist/user/busybox'
/opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/../../../../nios2-linux-uclibc/lib/crt1.o(.text+0x10): In function `_start':
: undefined reference to `main'
/opt/nios2/lib/gcc/nios2-linux-uclibc/3.4.6/../../../../nios2-linux-uclibc/lib/crt1.o(.text+0x14): In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status

However, I have set net-snmp to build as a static library in the configuration (make menuconfig). The only application I am building is snmpget.

In the Kernel/Library/Defaults section of the configuration, is Libc Version still allowed to be "None"?

Is there some extra patching that needs to be done to either of these applications before thay can be compiled for uClinux?

Thanks.

- Amir

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    1. you need to add "#include <strings.h>" in the source for bcopy.

    2. you need to modify the Makefile to remove .so targets.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    <div class='quotetop'>QUOTE (hippo @ Jan 18 2007, 08:27 PM) <{post_snapback}> (index.php?act=findpost&pid=20703)</div>

    --- Quote Start ---

    1. you need to add "#include <strings.h>" in the source for bcopy.

    2. you need to modify the Makefile to remove .so targets.[/b]

    --- Quote End ---

    Could you tell me which makefile and how?

    I am trying to build net-snmp but it fails:

    ...
    nios2-linux-uclibc-ranlib .libs/libnetsnmphelpers.a
    creating libnetsnmphelpers.la
    (cd .libs && rm -f libnetsnmphelpers.la && ln -s ../libnetsnmphelpers.la libnetsnmphelpers.la)
    : libnetsnmphelpers.la
    make: Leaving directory `/home/caleb/nios2-linux/uClinux-dist/user/net-snmp/build/agent/helpers&#39;
    making all in /home/caleb/nios2-linux/uClinux-dist/user/net-snmp/build/agent/mibgroup
    echo timestamp > mibgroup/mibII/vacm_conf.lo
    make: Entering directory `/home/caleb/nios2-linux/uClinux-dist/user/net-snmp/build/agent/mibgroup&#39;
    make: Leaving directory `/home/caleb/nios2-linux/uClinux-dist/user/net-snmp/build/agent/mibgroup&#39;
    echo timestamp > snmpd.lo
    make: Leaving directory `/home/caleb/nios2-linux/uClinux-dist/user/net-snmp/build/agent&#39;
    make: ***  Error 1
    make: Leaving directory `/home/caleb/nios2-linux/uClinux-dist/user/net-snmp/build&#39;
    make: ***  Error 2
    make: Leaving directory `/home/caleb/nios2-linux/uClinux-dist/user/net-snmp&#39;
    make: ***  Error 2
    make: Leaving directory `/home/caleb/nios2-linux/uClinux-dist/user&#39;
    make: ***  Error 2
    make: Leaving directory `/home/caleb/nios2-linux/uClinux-dist/user&#39;
    make: ***  Error 1

    Thanks.

    P.s. am I in a time warp? The forum seems to have lost everything after 2007 and I had to remake my login?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    <div class='quotetop'>QUOTE (Austin @ Jun 22 2009, 03:02 AM) <{post_snapback}> (index.php?act=findpost&pid=22875)</div>

    --- Quote Start ---

    am I in a time warp? The forum seems to have lost everything after 2007 and I had to remake my login?[/b]

    --- Quote End ---

    There seems to have been a disk crash and the latest backup of the system seems to have been done 2007 :( :( :( :(