[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [Unikraft] Static Libraries not being linked properly



Hi Simon.

Thanks for the help.

I am just curious, as to what determines as to what code would be
included and what excluded in nolibc/newlibc (or any unikraft-library
for that matter)?
Would the same criteria apply when integrating code of
fiilesystem/lwip/other libraries?

On Thu, May 3, 2018 at 6:41 PM, Simon Kuenzer <simon.kuenzer@xxxxxxxxx> wrote:
> On 03.05.2018 09:02, Ajay Garg wrote:
>>
>> Thanks a ton Simon for reverting back.
>>
>> I removed calling librt.a and libpthread.a.
>> Then, I cloned newlib, added it to config-files, and it compiled to
>> libnewlibc and libnewlibm fine.
>>
>> However, I am still getting
>>
>>                         undefined reference to `clock_gettime'
>>
>> On doing a grep in newlib folder, there is no string with name
>> "clock_gettime".
>>
>> Obviously, we need to add some more code in newlib, right?
>
>
> In this case, you are right. You have to provide your own implementation for
> this function. As a start, you could use the monotonic clock to retrieve
> time information from the Unikraft platform and convert it to the according
> data types.
>
>
>>
>> On Tue, Apr 24, 2018 at 6:59 PM, Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
>> wrote:
>>>
>>> Hey Ajay,
>>>
>>> welcome to Unikraft! Sorry for being non-response for so long time. This
>>> should change now since the core Unikraft people (including me) are back
>>> to
>>> the project.
>>>
>>> In your application's Makefile.uk, you can try to add static libraries by
>>> appending them to the APPNAME_OBJS list. However, I would not do this
>>> with
>>> librt.a and libpthread.a. The libraries you selected expect a Linux
>>> system
>>> call interface being available to reach functionality provided by  the
>>> kernel. We obviously do not have this on Unikraft, so the libraries
>>> wouldn't
>>> work (even if you might be able to create a binary with them).
>>>
>>> The functions of those libraries are usually provided by a libc. Wei is
>>> right that libnolibc - which is available in the tree - only provides a
>>> subset of libc functionality. But you could try using newlib instead:
>>>
>>> http://xenbits.xen.org/gitweb/?p=unikraft/libs/newlib.git;a=summary
>>>
>>> This port uses calls to the Unikraft API directly instead of using system
>>> calls. For instance, pthread_create() is going to call
>>> uk_sched_thread_create() in libuksched. Please note that we have a patch
>>> series pending that enhances scheduling functionality in Unikraft. There
>>> will be another patch series upcoming that does integrate those changes
>>> to
>>> newlib. So, the current state might not work yet for you, you may need to
>>> check again in two weeks.
>>>
>>> Thanks,
>>>
>>> Simon
>>>
>>> On 18.04.2018 06:34, Ajay Garg wrote:
>>>>
>>>>
>>>> Ok, thanks Wei for the clarification ..
>>>>
>>>> On Wed, Apr 18, 2018 at 9:59 AM, Wei Chen <Wei.Chen@xxxxxxx
>>>> <mailto:Wei.Chen@xxxxxxx>> wrote:
>>>>
>>>>      I think currently the answer is ‘YES’. We could not link libc.a____
>>>>
>>>>      directly in Unikraft. Libc.a requires some dependencies that____
>>>>
>>>>      unikraftdoesn’t provide.____
>>>>
>>>>      __ __
>>>>
>>>>      *From:*Ajay Garg <ajaygargnsit@xxxxxxxxx
>>>>      <mailto:ajaygargnsit@xxxxxxxxx>>
>>>>      *Sent:* 2018年4月18日11:45
>>>>
>>>>
>>>>      *To:* Wei Chen <Wei.Chen@xxxxxxx <mailto:Wei.Chen@xxxxxxx>>
>>>>      *Cc:* minios-devel@xxxxxxxxxxxxxxxxxxxx
>>>>      <mailto:minios-devel@xxxxxxxxxxxxxxxxxxxx>
>>>>      *Subject:* Re: [Minios-devel] [Unikraft] Static Libraries not being
>>>>      linked properly____
>>>>
>>>>      __ __
>>>>
>>>>      Ok Wei, got it ...
>>>>
>>>>      So, I added "/usr/lib/x86_64-linux-gnu/libc.a" also in
>>>>      "APPCOREMARK_OBJS-y", but the linking errors still persist.____
>>>>
>>>>      I now assume that pre-compiled static libc.a CANNOT be added into
>>>>      unikraft, right?____
>>>>
>>>>      __ __
>>>>
>>>>      On Wed, Apr 18, 2018 at 9:01 AM, Wei Chen <Wei.Chen@xxxxxxx
>>>>      <mailto:Wei.Chen@xxxxxxx>> wrote:____
>>>>
>>>>          Hi Ajay,____
>>>>
>>>>          ____
>>>>
>>>>          I think we have to classify the static-pre-compiled
>>>> libraries.____
>>>>
>>>>          For instance, if the static-pre-compiled library is a math
>>>>          library.____
>>>>
>>>>          It just does some Mathematical Computing and doesn’t depend
>>>> on____
>>>>
>>>>          Other libraries. I think this math library can be link to____
>>>>
>>>>          Unikraft. Another instance, if the static-pre-compiled
>>>> library____
>>>>
>>>>          depends on other libraries. You have to guarantee the
>>>> dependent____
>>>>
>>>>          libraries are in the Unikraft library pool.____
>>>>
>>>>          ____
>>>>
>>>>          In your case, the /usr/lib/x86_64-linux-gnu/librt.a and
>>>>          /usr/lib/x86_64-linux-gnu/libpthread.a____
>>>>
>>>>          would link to libc.a to solve their link dependencies. But the
>>>>          nolibc____
>>>>
>>>>          In Unikraft is just a subset of libc.a____
>>>>
>>>>          ____
>>>>
>>>>          Regards,____
>>>>
>>>>          Wei Chen____
>>>>
>>>>          ____
>>>>
>>>>          *From:* Ajay Garg <ajaygargnsit@xxxxxxxxx
>>>>          <mailto:ajaygargnsit@xxxxxxxxx>>
>>>>          *Sent:* 2018年4月18日 11:17
>>>>          *To:* Wei Chen <Wei.Chen@xxxxxxx <mailto:Wei.Chen@xxxxxxx>>
>>>>          *Cc:* minios-devel@xxxxxxxxxxxxxxxxxxxx
>>>>          <mailto:minios-devel@xxxxxxxxxxxxxxxxxxxx>
>>>>          *Subject:* Re: [Minios-devel] [Unikraft] Static Libraries not
>>>>          being linked properly____
>>>>
>>>>          ____
>>>>
>>>>          Hi Wei.____
>>>>
>>>>          Thanks for the help.____
>>>>
>>>>          Actually, my original query is how to link pre-compiled
>>>> (static)
>>>>          libraries in unikraft?____
>>>>
>>>>          I tried as per the documentation at
>>>>
>>>>
>>>> http://xenbits.xen.org/gitweb/?p=unikraft/unikraft.git;a=blob;f=doc/guides/developers-app.rst;h=45d9bd5b2bb10b3d04135d66b5162a59d54dc2b6;hb=HEAD#l163
>>>>
>>>>
>>>> <http://xenbits.xen.org/gitweb/?p=unikraft/unikraft.git;a=blob;f=doc/guides/developers-app.rst;h=45d9bd5b2bb10b3d04135d66b5162a59d54dc2b6;hb=HEAD#l163>
>>>>          ____
>>>>
>>>>          but the libraries do not resolve linking problems.____
>>>>
>>>>          Or am I understanding it incorrectly? Can pre-compiled static
>>>>          libraries be integrated/linked at all in unikraft?____
>>>>
>>>>          ____
>>>>
>>>>          ____
>>>>
>>>>          On Wed, Apr 18, 2018 at 7:48 AM, Wei Chen <Wei.Chen@xxxxxxx
>>>>          <mailto:Wei.Chen@xxxxxxx>> wrote:____
>>>>
>>>>              But the clock_gettime hasn’t been implemented in nolibc or
>>>>              libtime.____
>>>>
>>>>              If your application just uses this function to print
>>>>              timestampe, you____
>>>>
>>>>              can implement a dummy function in your code in this time to
>>>>              pass the____
>>>>
>>>>              linking.____
>>>>
>>>>              ____
>>>>
>>>>              ____
>>>>
>>>>
>>>>
>>>>
>>>>          -- ____
>>>>
>>>>          Regards,
>>>>          Ajay____
>>>>
>>>>          IMPORTANT NOTICE: The contents of this email and any
>>>> attachments
>>>>          are confidential and may also be privileged. If you are not the
>>>>          intended recipient, please notify the sender immediately and do
>>>>          not disclose the contents to any other person, use it for any
>>>>          purpose, or store or copy the information in any medium. Thank
>>>>          you. ____
>>>>
>>>>
>>>>
>>>>
>>>>      -- ____
>>>>
>>>>      Regards,
>>>>      Ajay____
>>>>
>>>>      IMPORTANT NOTICE: The contents of this email and any attachments
>>>> are
>>>>      confidential and may also be privileged. If you are not the
>>>> intended
>>>>      recipient, please notify the sender immediately and do not disclose
>>>>      the contents to any other person, use it for any purpose, or store
>>>>      or copy the information in any medium. Thank you.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Ajay
>>>>
>>>>
>>>> _______________________________________________
>>>> Minios-devel mailing list
>>>> Minios-devel@xxxxxxxxxxxxxxxxxxxx
>>>> https://lists.xenproject.org/mailman/listinfo/minios-devel
>>>>
>>>
>>
>>
>>
>



-- 
Regards,
Ajay

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.