[uClinux-dev] Linking librt

Peter peterhillier at digitalnetworks.ca
Tue Oct 25 20:49:50 EDT 2005


Hi all,
   I'm new to Linux and have been learning about pthreads and message
queues. My pthread application compiled and ran fine, but when I
attempted to add message queues (as defined by mqueue.h) I ran into an
undefined reference for all mq functions (mq_open, mq_send, etc). The
Makefile snippet is:

$(EXEC):$(OBJS)
        $(CC) $(LDFLAGS) -o $@  $(OBJS) $(LIBPTHREAD) $(LIBRT) $(LDLIBS)

The output is:

ucfront-gcc m68k-elf-gcc -m5307 -DCONFIG_COLDFIRE -Wl,-elf2flt -Wl,-
move-rodata -msep-data -o atls_drv  atls_api.o atls_api2.o atls.o
atls2.o atls_hw.o atls_rtos.o -lpthread
atls_drv.elf2flt: In function `sysAtlasIntInstallHandler':
/home/phillier/uClinux-dist/user/datapath-
drivers/vcs/atlsdrv/atls_rtos.c:242: undefined reference to `mq_open'
atls_drv.elf2flt: In function `sysAtlasIntRemoveHandler':
/home/phillier/uClinux-dist/user/datapath-
drivers/vcs/atlsdrv/atls_rtos.c:365: undefined reference to `mq_close'
atls_drv.elf2flt: In function `sysAtlasDPRtask':
/home/phillier/uClinux-dist/user/datapath-
drivers/vcs/atlsdrv/atls_rtos.c:512: undefined reference to `mq_receive'
atls_drv.elf2flt: In function `sysAtlasReceiveCellTask':
/home/phillier/uClinux-dist/user/datapath-
drivers/vcs/atlsdrv/atls_rtos.c:545: undefined reference to `mq_receive'
atls_drv.elf2flt: In function `sysAtlasIntPollTask':
/home/phillier/uClinux-dist/user/datapath-
drivers/vcs/atlsdrv/atls_rtos.c:622: undefined reference to `mq_send'
atls_drv.elf2flt: In function `sysAtlsTxMsg':
/home/phillier/uClinux-dist/user/datapath-
drivers/vcs/atlsdrv/atls_rtos.c:737: undefined reference to `mq_send'
/home/phillier/uClinux-dist/user/datapath-
drivers/vcs/atlsdrv/atls_rtos.c:747: undefined reference to `main'
collect2: ld returned 1 exit status

Note that I do not have a main() function as I intend to link this into
a bigger app being ported from VxWorks.

Prob 1:
It appears $(LIBRT) is not defined, although I have verified that the
library is in fact built.

Prob 2:
I added the lib directly via -lrt, but the fact I have to do this tells
me something is up.... regardless, I still get the undefined references.
All the mq_* source files in librt/ are wrapped in #ifdef similar to
#ifdef __NR_mq_open. These are defined in asm-frv/unistd.h, but there
are several different copies of unistd.h floating around that do not
define them.

Soooo, I'm hoping I need to simply enable some menu item, etc, to get
librt to see the defines and build in the mq_* routines. Anyone who has
used uClibc mqueue.h what to throw me a bone?

Any help is appreciated. Version info below.

uClinux version: 2.4.31_uc0
uClibc version: 0.9.27
ToolChain base on gcc 2.95.3:
Target: Arcturus ColdFire 5282

Thanks in advance,
  Peter




More information about the uClinux-dev mailing list