undefined reference to 'nanosleep'

Joel Sherrill joel.sherrill at oarcorp.com
Wed Sep 12 14:43:58 UTC 2007


André Neves wrote:
> On Wed, September 12, 2007 14:55, Joel Sherrill wrote:
>   
>> André Neves wrote:
>>     
>>> First of all sorry for forgetting the subject.
>>> Bah, not helpful. >_<
>>>
>>> On Wed, September 12, 2007 13:48, Ralf Corsepius wrote:
>>>
>>>       
>>>> On Wed, 2007-09-12 at 12:20 +0100, André Neves wrote:
>>>>
>>>>         
>>>>> Hi all.
>>>>>
>>>>> I cave in and admit that the system outsmarted me.
>>>>> Here goes newbie question. :)
>>>>> Compiling RTEMS for a LEON2 simulator in a Linux (Ubuntu 7.04)
>>>>> machine.
>>>>> autoconf 2.61, automake 1.10, gcc 4,1,2.
>>>>>
>>>>> I'm in the last step of the compilation described in the wiki's Quick
>>>>> Start:
>>>>>
>>>>>           
>>>>>> cd rtems
>>>>>> export PATH=/opt/rtems-4.8/bin:$PATH
>>>>>> ./bootstrap
>>>>>> cd ..
>>>>>> mkdir b-sis
>>>>>> cd b-sis
>>>>>> ../rtems/configure
>>>>>>
>>>>>>             
>>>>> --target=sparc-rtems
>>>>>
>>>>>           
>>>>            ^^^^^^^^^^^
>>>> This must match with the target you used to build your toolchain.
>>>>
>>>>
>>>>         
>>>>>  --enable-rtemsbsp=sis
>>>>> --enable-tests=samples --disable-posix --disable-itron
>>>>>
>>>>>           
>>>>>> make
>>>>>>
>>>>>>             
>>>>> Doing 'make all'.
>>>>>
>>>>>           
>>>>>> (...)
>>>>>> Making all in capture
>>>>>> make[5]: Entering directory
>>>>>>
>>>>>>             
>>>>> `/home/ac-neves/workdir/sparc-rtems/c/leon2/testsuites/samples/capture'
>>>>>
>>>>>           
>>>>>> sparc-rtems-gcc -B../../../../../leon2/lib/ -specs bsp_specs -qrtems
>>>>>>
>>>>>>             
>>>> ^^^^^^ ^^^^^^^^^^^^
>>>>
>>>> OK, so you, for reason being incomprehensible to me used
>>>> --target=sparc-rtems
>>>>
>>>>         
>>> The wiki Quick Start page said to use
>>> --target=sparc-rtems4.8
>>>
>>> It was making some part of my compilation fail, and my internship tutor
>>> had a look at it and said that probably dropping the "4.8" would make it
>>> work. So i used
>>> --target=sparc-rtems
>>> instead, to see if that would solve the problem.
>>> It did, and so i went and edited the wiki accordingly.
>>> If i did wrong, please edit it back into the correct option·
>>>
>>> (Low) personal experience says the right option is the one I used,
>>> expert
>>> says what I used makes no sense.
>>> Hmm... I don't know what should be there. I know no other option. :)
>>>
>>>
>>>       
>> Where did your tools come from?  If you built then and used sparc-rtems,
>> then you have to match that or the RTEMS configure scripts won't default
>> to the right tool names.
>>
>> If you downloaded binaries using that name from somewhere, then you
>> are at risk of not having the right C library version for the RTEMS you
>> are using.
>>     
>
> That explains a bit of it.
> Thus the lock with
> --target=sparc-rtems
> , which makes my last edit on the Quick Start improper - i went and
> reverted it.
>
>   
I came behind you and add a WARNING about target name
matching across all tools and RTEMS configure.
> I got the Cross-Compiler from: ftp://gaisler.com/gaisler.com/rcc/bin/linux
> The 4.7.99.2 version.
>
>   
I suspected that was the source but didn't want to say. :-D
> Perhaps it's better that i work on a "more stable" version?
>   
That is reasonably stable.  It just had that bug.  You can either:

+ configure with --enable-posix
+ configure with --disable-tests
+ Apply the attached patch to cpukit/posix/Makefile.am and
   run "bootstrap" in cpukit.
> Would the problems diminish? Or is the 4.7.99.2 a "stable version"?
>
>   
4.7.99.2 was a pre-4.8 snapshot.  It was generally OK.  Apply the
patch and move on. :-D
>>>>> -mcpu=cypress -msoft-float -O2 -g      -o capture.exe init.o test1.o
>>>>>
>>>>>           
>>>>>> ../../../../../leon2/lib/librtemscpu.a(libposix_a-usleep.o): In
>>>>>>
>>>>>>             
>>>>> function
>>>>> `usleep':
>>>>>
>>>>>           
>>>>>> /home/ac-neves/workdir/sparc-rtems/c/leon2/cpukit/posix/../../../../../../rtems-leon2/c/src/../../cpukit/posix/src/usleep.c:29:
>>>>>>
>>>>>>             
>>>>> undefined reference to `nanosleep'
>>>>>
>>>>>           
>> nanosleep was enabled all the time now in CVS.  What RTEMS version
>> are you using?  It would be wise to switch to CVS if you are interested
>> in the bleeding edge.
>>
>> 2007-08-28      Joel Sherrill <joel.sherrill at OARcorp.com>
>>
>>         * posix/Makefile.am: Always build nanosleep.
>>     
>
> The 4.7.99.2 version.
> Maybe i should "downgrade" to a "stable" version instead.
> Perhaps that would be better, instead of facing these little problems that
> i don't yet know how to deal with.
>
>
> Thanks for all the feedback. :)
>
>   
>>     
>>>>>> collect2: ld returned 1 exit status
>>>>>> make[5]: *** [capture.exe] Error 1
>>>>>> make[5]: Leaving directory
>>>>>>
>>>>>>             
>>>>> `/home/ac-neves/workdir/sparc-rtems/c/leon2/testsuites/samples/capture'
>>>>>
>>>>>           
>>>>>> (...)
>>>>>>
>>>>>>             
>>>>> I've been trying to fix it myself, but failed to understand how
>>>>> everything
>>>>> is well except for nanosleep.
>>>>> Can something not have been included properly?
>>>>>
>>>>>           
>>>> Have you build newlib?
>>>>
>>>> Ralf
>>>>
>>>>
>>>>
>>>>
>>>>         
>>> Hmm... libnewlib-dev was missing.
>>> (Like libc-dev was missing, and manpages-dev was missing. o_O I'm
>>> starting
>>> to dislike this Kubuntu.)
>>>
>>> I installed it, but there was no change, i get the same error on 'make
>>> all'.
>>>
>>>
>>> So:
>>> - i didn't have [lib]newlib[-dev], but that didn't change anything;
>>> - weird '--target=sparc-rtems';
>>> - still "undefined reference to 'nanosleep'" when 'make all'.
>>>
>>> I hope I'm not being too cryptic or... undefined.
>>>  Andre´ Neves
>>>
>>>
>>> ps: I found some minor errors in the online documentation. How should i
>>> report/fix that sort of things?
>>>
>>>
>>> _______________________________________________
>>> rtems-users mailing list
>>> rtems-users at rtems.com
>>> http://rtems.rtems.org/mailman/listinfo/rtems-users
>>>
>>>       
>>     
>
>
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: posix-Makefile-am.diff
Type: text/x-patch
Size: 1128 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20070912/34a45d2b/attachment.bin>


More information about the users mailing list