[uClinux-dev] Linking librt

Peter peterhillier at digitalnetworks.ca
Tue Oct 25 23:03:12 EDT 2005

Allow me to interrupt myself....

I see now that the list of #defines for sys calls is picked up in
bits/syscalls.h through sys/syscalls.h included in all mq_*.c files in
librt. The sys call numbers are magically generated based on unistd.h.

After following the peanut under the shell for too many passes, it looks
like unistd.h can be different depending on the processor. In my case,
for the coldfire I use the m68k (no mmu). And viola, include/asm is
linked to include/asm-m68knommu, and the unistd.h file contains no
#define for _NR_mq_open.

It appears that only asm-frv contains the #define for _NR_mq_open.

So is it safe to say mqueue.h is only support on FR-V? Is there another
easy to use IPC available for Coldfire?


On Tue, 2005-10-25 at 20:49 -0400, Peter wrote:
> 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
> _______________________________________________
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
> This message was resent by uclinux-dev at uclinux.org

More information about the uClinux-dev mailing list