[Rtai] shared memory: collect2: ld returned 1 exit status

Paolo Mantegazza mantegazza at aero.polimi.it
Thu Jan 14 09:22:04 CET 2010


Ivo Daniel Alves wrote:
> Hi,
> 
> first, your righ!. The last email was from a application that I'm trying 
> to do. The kernel module has always compiled with no problem. The 
> problem still with the user-space application. After I add MODULE_CFLAGS 
> = $(shell rtai-config --module-cflags) and LXRT_CFLAGS = $(shell 
> rtai-config --lxrt-cflags) the user-space program compiled, but when I 
> try to run it I get the following message:
> 
> ./user.o: relocation error: ./user.o: symbol , version GLIBC_2.0 
> notdefined in file libc.so.6 with link time reference
> 
> I also tryed one example from the showroom ( last revision from:  
> http://cvs.gna.org/cvsweb/showroom/v3.x/kern/shm/?cvsroot=rtai ) , and 
> you can see the output below:
> 
> [ivo at cronos memp2]$ ls
> display    GNUmakefile  Module.symvers  shm.o      shm_rt.mod.c  shm_rt.o
> display.c  Makefile     shm.c           shm_rt.ko  shm_rt.mod.o
> 

Sorry but what I see above is not the same as what is in that dir. It is 
likely your are messing things up.

> [ivo at cronos memp2]$ ./display
> nam2num(MYSHM) = 0x34c4560
> Segmentation fault

See the run script please.

paolo

> 
> 
> 
> mantegazza at aero.polimi.it escreveu:
>>> Hi,
>>>
>>> I went to the showroom, and when I took a look at the makefile I noticed
>>> that I need some more options to compile my user-space application:
>>>
>>> MODULE_CFLAGS = $(shell rtai-config --module-cflags)
>>> LXRT_CFLAGS = $(shell rtai-config --lxrt-cflags)
>>>
>>> gcc $(CC) $(LXRT_CFLAGS) -o user.o user.c
>>>
>>> However when I try to run the user.o I get the folowing error:
>>>
>>> [ivo at cronos rt_lpt_task]$ ./user.o
>>> ./user.o: relocation error: ./user.o: symbol , version GLIBC_2.0 not
>>> defined in file libc.so.6 with link time reference
>>>
>>> best regards,
>>>
>>> Ivo
>>>
>>>     
>>
>> Since there is no whatever user.? in that showroom example the only thing
>> I can suggest is to add LXRT_LDFLAGS, to ensure the RTAI library is
>> linked. REcall to add the RTAI lib installation path to your
>> LD_LIBRARY_PATH.
>>
>> Please keep posting to the RTAI list.
>>
>> paolo
>>
>>
>>  
>>> Paolo Mantegazza escreveu:
>>>    
>>>> Ivo Daniel Alves wrote:
>>>>      
>>>>> Hello Paolo,
>>>>>
>>>>> I added the '#include <rtai_nam2num.h>' and I'm having the same
>>>>> problem.
>>>>>
>>>>> I'm running a kernel 2.6.24 with RTAI 3.6 CV version.
>>>>>
>>>>> ivo
>>>>>
>>>>>         
>>>> Can you try running the kernel shmem test in showroom CVS? Better
>>>> check on a common existing ground, first.
>>>>
>>>> paolo
>>>>
>>>>      
>>>>>
>>>>> mantegazza at aero.polimi.it escreveu:
>>>>>        
>>>>>> In the similar showrrom example I see the following includes:
>>>>>> #include <rtai_shm.h>
>>>>>> #include <rtai_nam2num.h>
>>>>>>
>>>>>> paolo
>>>>>>
>>>>>>
>>>>>>          
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm trying to compile a example of RTAi shared memory.
>>>>>>>
>>>>>>> I've no problem compiling the module but I'm having problem 
>>>>>>> compiling
>>>>>>> the user-space application.
>>>>>>>
>>>>>>> *User-space application:*
>>>>>>>
>>>>>>> #include <stdio.h>
>>>>>>> #include <unistd.h>
>>>>>>> #include <sys/types.h>
>>>>>>> #include <sys/mman.h>
>>>>>>> #include <sys/stat.h>
>>>>>>> #include <fcntl.h>
>>>>>>> #include <signal.h>
>>>>>>> #include <rtai_shm.h>
>>>>>>> #include "parameters.h"
>>>>>>>
>>>>>>> static int end;
>>>>>>>
>>>>>>> static void endme(int dummy) { end=1; }
>>>>>>>
>>>>>>> int main (void)
>>>>>>> {
>>>>>>>     struct data_str *data;
>>>>>>>     signal(SIGINT, endme);
>>>>>>>     data = rtai_malloc (nam2num(SHMNAM),1);
>>>>>>>     while (!end) {
>>>>>>>         printf("Counter: %d Sine: %f Cosine: %f \n",
>>>>>>> data->indx_counter,
>>>>>>>                   data->sin_value, data->cos_value);
>>>>>>>     }
>>>>>>>     rtai_free (nam2num(SHMNAM), &data);
>>>>>>>     return 0;
>>>>>>> }
>>>>>>>
>>>>>>> *
>>>>>>> Shell output:*
>>>>>>>
>>>>>>> gcc -I/usr/realtime/include -I/usr/include/ -o scope scope.c
>>>>>>> /tmp/ccmlZfZw.o: In function `main':
>>>>>>> scope.c:(.text+0x2ee): undefined reference to `nam2num'
>>>>>>> scope.c:(.text+0x316): undefined reference to `_rt_shm_alloc'
>>>>>>> scope.c:(.text+0x35b): undefined reference to `nam2num'
>>>>>>> scope.c:(.text+0x363): undefined reference to `rt_shm_free'
>>>>>>> collect2: ld returned 1 exit status
>>>>>>> make: *** [default] Error 1
>>>>>>>
>>>>>>> Thanks in advance and best regards,
>>>>>>>
>>>>>>> Ivo
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Rtai mailing list
>>>>>>> Rtai at rtai.org
>>>>>>> https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
>>>>>>>
>>>>>>>
>>>>>>>             
>>>>>>
>>>>>>
>>>>>>
>>>>>>           
>>>>>         
>>>>
>>>>       
>>>     
>>
>>
>>
>>
>>   
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Rtai mailing list
> Rtai at rtai.org
> https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai



More information about the Rtai mailing list