embedded - Difficulty in using C standard libraries in the SoCLib tool -
i'm electronic engineering student brazil , i'm working embedded systems.
i'm trying port mp3 decoder (written in c), called minimp3, platform built aid of soclib tool (this tool has bunch of hardware models such processors, memories , interconnections written in systemc witch allows build embedded systems models).
the platform i'm building consists of mips processor, ram, interconnection , tty (virtual terminal), mp3 decoder must cross compiled.
this mp3 decoder uses c standard libraries not instantiated in soclib tool (witch contains stdio.h , stdlib.h).
i first tried run platform without making changes in makefiles provided soclib tool. this, when entered "make" command got following messages (among others of same type):
undefined reference `tan' undefined reference `sin' undefined reference `cos' undefined reference `memset' undefined reference `realloc' undefined reference `open' undefined reference `strlen'
researching errors, found because linker not linking c headers, added following commands (emphasized) on makefile:
cflags=-wall -o2 -i. $(add_cflags) $(debug_cflags) $($(arch)_cflags) -ggdb -i$(common) **-i/usr/include** $(interface_cflags) mipsel-unknown-elf-ld -q $($(arch)_ldflags) $(add_ldflags) -o $@ $(filter %.o,$^) **-lm** -t $(filter %ldscript,$^) $(libgcc)*
however, entering "make" command again, got following error:
mipsel-unknown-elf-ld: cannot find -lm
and don't know do.
can me?
when entered "make" command, got following error:
mipsel-unknown-elf-ld: cannot find -lm
the "mipsel-unknown-elf-" says using mips cross compiler, , prefixes "ld" linker-loader command. -lm option says link (the "-l" part) "m" library, spelled "libm.a" or "libm.so". means make compiled code, , trying link object file "libm" library.
see link more information,
how c compiler find -lm pointing file libm.a?
what want tell linker-loader path(s) search libraries, means need find "libm.a" and/or "libm.so", , other libraries plan use, "lib*.a" , "lib*.so*". determine paths need, , add these library search paths using "-l path" option.
and know do. -chuck
Comments
Post a Comment