Lua was Re: Quickstart Build instructions
Gedare Bloom
gedare at rtems.org
Sun Apr 1 12:24:48 UTC 2018
On Sun, Apr 1, 2018 at 1:52 AM, Russell Haley <russ.haley at gmail.com> wrote:
>
>
> On Fri, Mar 30, 2018 at 12:48 PM, Russell Haley <russ.haley at gmail.com>
> wrote:
>>
>>
>>
>> On Fri, Mar 30, 2018 at 7:54 AM, Joel Sherrill <joel at rtems.org> wrote:
>>>
>>>
>>>
>>> On Fri, Mar 30, 2018 at 1:05 AM, Russell Haley <russ.haley at gmail.com>
>>> wrote:
>>>>
>>>> Thanks Joel. I haven't looped back to test if it was my mistake or
>>>> something else so I'll assume my mistake for now.
>>>>
>>>> Either way, I'm able to build and run the examples_v2 repository against
>>>> erc32, so... YAY!
>>>>
>>>> I'd like to build Lua 5.3, do I just build the static lib "a" file and
>>>> include it in a test application? Would that happen in RTEMS proper or in
>>>> waf? I need sleep now but any suggestions would be grand.
>>>
>>>
>>> Porting Lua was an early GSoC project. Some information is here.:
>>>
>>> https://devel.rtems.org/wiki/Packages/LUA
>>>
>>> That effort predates the RSB but the proper solution would be to have
>>> an RSB recipe for it. My understanding is that it was quite easy to build
>>> for RTEMS.
>>>
>>> https://github.com/lparam/rtems-liblua appears to be enough to help you
>>> build it.
>>>
>>> Needs an RSB recipe though. :)
>>
>>
>> That would be great. I've managed to get lua 5.3 built and installed from
>> the github repo by lparam. I've run out of time but will clean it up
>> tonight. The SGOC link seems to be pointing to a modified/extended lua build
>> and the link to the source code is dead.
>>
>> I'll try modifying the hello world example tonight as well and see what I
>> get.
>
>
> So building liblua.a was pretty straightforward as a "Ken" has already done
> the heavy lifting in the makefile. I can call gmake as:
>
> gmake ARCH=sparc-rtems5 BSP=erc32 BSP_BASE=~/development/rtems/5
>
> and "make install" puts liblua.a in the correct directory. But I am getting
> a linking errors with my example code that seem to imply a missing math
> library? I copied the RTEMS hello example and added the Lua C example from
> the Programming in Lua book (4th edition for 5.3). The files and build
> output follow.
>
> //test-lua.c
> #include <bsp.h>
> #include <lua.h>
> #include <lualib.h>
> #include <lauxlib.h>
>
> //This is the reference to the lua interpreter
> lua_State* L;
>
> rtems_task Init(
> rtems_task_argument ignored
> )
> {
> lua_State *L = luaL_newstate();
> luaL_openlibs(L);
> char buff[256] = "print('Hello from Lua')";
> //Test of basic lua functionality
> int error;
> error = luaL_loadstring(L, buff);
> if(error)
> {
> fprintf(stderr, "%s\n", lua_tostring(L,-1));
> lua_pop(L,1);
> }
> lua_close(L);
> return 0;
> }
>
> /* NOTICE: the clock driver is explicitly disabled */
> #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> #define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
>
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> #define CONFIGURE_MAXIMUM_TASKS 1
>
> #define CONFIGURE_INIT
> #include <rtems/confdefs.h>
> /* end of file */
>
>
> #wscript
> # Copyright 2018 Russell Haley (russ.haley at gmail.com)
> # Copyright 2013 Gedare Bloom (gedare at rtems.org)
> #
> # This file's license is 2-clause BSD as in this distribution's LICENSE.2
> file.
> #
>
> # Waf build script for a Lua test harness
> import rtems_waf.rtems as rtems
>
> def build(bld):
> rtems.build(bld)
>
> bld.includes = ['.
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/include']
>
> bld.read_stlib('lua',
> paths=['/home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/'])
> bld(features = 'c cprogram',
> target = 'test-lua.exe',
> source = ['test-lua.c'],
> use = 'lua')
>
>
> #output
>
> russellh at g1 ~/d/e/lua53-test> waf -v
> Waf: Entering directory
> `/usr/home/russellh/development/examples-v2/build/sparc-rtems5-erc32'
> [2/3] Linking ../build/sparc-rtems5-erc32/lua53-test/test-lua.exe
> 22:33:27 runner ['/home/russellh/development/rtems/5/bin/sparc-rtems5-gcc',
> '-qrtems', '-B/home/russellh/development/rtems/5/sparc-rtems5/lib/',
> '-B/home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/', '--specs',
> 'bsp_specs', '-mcpu=cypress', '-mcpu=cypress', '-ffunction-sections',
> '-ffunction-sections', '-fdata-sections', '-fdata-sections',
> '-Wl,--gc-sections', 'lua53-test/test-lua.c.2.o',
> '-o/usr/home/russellh/development/examples-v2/build/sparc-rtems5-erc32/lua53-test/test-lua.exe',
> '-Wl,-Bstatic',
> '-L/home/russellh/development/rtems/5/sparc-rtems5/erc32/lib', '-llua',
> '-Wl,-Bdynamic']
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lobject.o):
> In function `numarith':
> lobject.c:(.text+0x570): undefined reference to `powf'
> lobject.c:(.text+0x598): undefined reference to `floorf'
> lobject.c:(.text+0x5c4): undefined reference to `fmodf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lvm.o):
> In function `luaV_tointeger':
> lvm.c:(.text+0x308): undefined reference to `floorf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lvm.o):
> In function `luaV_execute':
> lvm.c:(.text+0x43cc): undefined reference to `fmodf'
> lvm.c:(.text+0x4640): undefined reference to `floorf'
> lvm.c:(.text+0x47f8): undefined reference to `powf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_sin':
> lmathlib.c:(.text+0xd8): undefined reference to `sinf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_cos':
> lmathlib.c:(.text+0x130): undefined reference to `cosf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_tan':
> lmathlib.c:(.text+0x188): undefined reference to `tanf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_asin':
> lmathlib.c:(.text+0x1e0): undefined reference to `asinf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_acos':
> lmathlib.c:(.text+0x238): undefined reference to `acosf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_atan':
> lmathlib.c:(.text+0x2b8): undefined reference to `atan2f'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_floor':
> lmathlib.c:(.text+0x460): undefined reference to `floorf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_ceil':
> lmathlib.c:(.text+0x4ec): undefined reference to `ceilf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_fmod':
> lmathlib.c:(.text+0x654): undefined reference to `fmodf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_modf':
> lmathlib.c:(.text+0x720): undefined reference to `ceilf'
> lmathlib.c:(.text+0x738): undefined reference to `floorf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_sqrt':
> lmathlib.c:(.text+0x7dc): undefined reference to `sqrtf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_log':
> lmathlib.c:(.text+0x8b8): undefined reference to `logf'
> lmathlib.c:(.text+0x904): undefined reference to `log2f'
> lmathlib.c:(.text+0x93c): undefined reference to `log10f'
> lmathlib.c:(.text+0x954): undefined reference to `logf'
> lmathlib.c:(.text+0x964): undefined reference to `logf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_exp':
> lmathlib.c:(.text+0x9c4): undefined reference to `expf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_cosh':
> lmathlib.c:(.text+0xf70): undefined reference to `coshf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_sinh':
> lmathlib.c:(.text+0xfc8): undefined reference to `sinhf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_tanh':
> lmathlib.c:(.text+0x1020): undefined reference to `tanhf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_pow':
> lmathlib.c:(.text+0x108c): undefined reference to `powf'
> /home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/liblua.a(lmathlib.o):
> In function `math_log10':
> lmathlib.c:(.text+0x11c4): undefined reference to `log10f'
> collect2: error: ld returned 1 exit status
>
> Waf: Leaving directory
> `/usr/home/russellh/development/examples-v2/build/sparc-rtems5-erc32'
> Build failed
> -> task in 'test-lua.exe' failed with exit status 1:
> {task 34394256160: cprogram test-lua.c.2.o -> test-lua.exe}
> ['/home/russellh/development/rtems/5/bin/sparc-rtems5-gcc', '-qrtems',
> '-B/home/russellh/development/rtems/5/sparc-rtems5/lib/',
> '-B/home/russellh/development/rtems/5/sparc-rtems5/erc32/lib/', '--specs',
> 'bsp_specs', '-mcpu=cypress', '-mcpu=cypress', '-ffunction-sections',
> '-ffunction-sections', '-fdata-sections', '-fdata-sections',
> '-Wl,--gc-sections', 'lua53-test/test-lua.c.2.o',
> '-o/usr/home/russellh/development/examples-v2/build/sparc-rtems5-erc32/lua53-test/test-lua.exe',
> '-Wl,-Bstatic',
> '-L/home/russellh/development/rtems/5/sparc-rtems5/erc32/lib', '-llua',
> '-Wl,-Bdynamic']
>
See the examples-v2/benchmarks/nbench/wscript for how to link the math
lib with waf
https://git.rtems.org/examples-v2/tree/benchmarks/nbench/wscript
>
> Cheers,
> Russ
>>
>>
>> Thanks everyone!
>>
>> Russ
>>>
>>>
>>> --joel
>>>
>>>>
>>>>
>>>> Thanks!
>>>> Russ
>>>>
>>>> On Wed, Mar 28, 2018 at 6:48 AM, Joel Sherrill <joel at rtems.org> wrote:
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Mar 28, 2018 at 12:51 AM, Russell Haley <russ.haley at gmail.com>
>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> ---------- Forwarded message ----------
>>>>>> From: Russell Haley <russ.haley at gmail.com>
>>>>>> Date: Tue, Mar 27, 2018 at 10:45 PM
>>>>>> Subject: Re: Quickstart Build instructions
>>>>>> To: Sebastian Huber <sebastian.huber at embedded-brains.de>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Mar 27, 2018 at 10:36 PM, Sebastian Huber
>>>>>> <sebastian.huber at embedded-brains.de> wrote:
>>>>>>>
>>>>>>> Please send e-mails to the mailing list.
>>>>>>
>>>>>> Sorry, my mistake.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 28/03/18 07:34, Russell Haley wrote:
>>>>>>>>
>>>>>>>> Where did the directory 5 come from in these instructions? Are you
>>>>>>>> missing a mkdir?
>>>>>>>
>>>>>>>
>>>>>>> The
>>>>>>>
>>>>>>> --prefix=/usr/home/chris/development/rtems/5
>>>>>>>
>>>>>>>
>>>>>>> directory is created by the sb-set-builder. It is the base
>>>>>>> installation directory.
>>>>>>
>>>>>> I was getting a directory not writeable error until I created the
>>>>>> folder myself (even after correcting for my username). I'll try again later,
>>>>>> but it builds if I create the 5/ directory.
>>>>>
>>>>>
>>>>> What is your $HOME? Mine is usually /home/joel. If yours is similar,
>>>>> then
>>>>> not being able to write into /usr as non-root is expected.
>>>>>
>>>>> Perhaps the documentation should say ${HOME}/development/rtems/5?
>>>>>
>>>>> FWIW Around OAR, we tend to use ${HOME}/rtems-work/tools/5 or for
>>>>> wider deployments /rtems/5
>>>>>
>>>>> --joel
>>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Russ
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> $cd
>>>>>>>> $ mkdir -p development/rtems
>>>>>>>> $cd development/rtems
>>>>>>>> $ git clone git://git.rtems.org/rtems-source-builder.git
>>>>>>>> <http://git.rtems.org/rtems-source-builder.git> rsb
>>>>>>>> ...
>>>>>>>> $cd rsb
>>>>>>>> $ ./source-builder/sb-check
>>>>>>>> ...
>>>>>>>> $cd rtems
>>>>>>>> $ ../source-builder/sb-set-builder\
>>>>>>>> --prefix=/usr/home/chris/development/rtems/55/rtems-sparc
>>>>>>>> ...
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Russ
>>>>>>>>
>>>>>>>> On Tue, Mar 27, 2018 at 10:28 PM, Russell Haley
>>>>>>>> <russ.haley at gmail.com <mailto:russ.haley at gmail.com>> wrote:
>>>>>>>>
>>>>>>>> Thanks!
>>>>>>>> Russ
>>>>>>>>
>>>>>>>> On Tue, Mar 27, 2018 at 10:23 PM, Sebastian Huber
>>>>>>>> <sebastian.huber at embedded-brains.de
>>>>>>>> <mailto:sebastian.huber at embedded-brains.de>> wrote:
>>>>>>>>
>>>>>>>> On 28/03/18 07:14, Russell Haley wrote:
>>>>>>>>
>>>>>>>> Hi, the quick start indicates using ./bootstrap -p, but
>>>>>>>> using said parameter only results in the error/hep
>>>>>>>> output.
>>>>>>>> Using ./bootstrap without any parameters started the the
>>>>>>>> process for me?
>>>>>>>>
>>>>>>>>
>>>>>>>> https://docs.rtems.org/branches/master/user/start/index.html
>>>>>>>>
>>>>>>>> <https://docs.rtems.org/branches/master/user/start/index.html>
>>>>>>>>
>>>>>>>>
>>>>>>>> Sorry for the confusion. I updated the documentation:
>>>>>>>>
>>>>>>>>
>>>>>>>> https://git.rtems.org/rtems-docs/commit/?id=fc9db4c26eb66b1b94f79617d850d2b0f161c00e
>>>>>>>>
>>>>>>>> <https://git.rtems.org/rtems-docs/commit/?id=fc9db4c26eb66b1b94f79617d850d2b0f161c00e>
>>>>>>>>
>>>>>>>> -- Sebastian Huber, embedded brains GmbH
>>>>>>>>
>>>>>>>> Address : Dornierstr. 4, D-82178 Puchheim,
>>>>>>>>
>>>>>>>> <https://maps.google.com/?q=dress+:+Dornierstr.+4,+D-82178+Puchheim,&entry=gmail&source=g>
>>>>>>>> Germany
>>>>>>>> Phone : +49 89 189 47 41-16
>>>>>>>> <tel:%2B49%2089%20189%2047%2041-16>
>>>>>>>> Fax : +49 89 189 47 41-09
>>>>>>>> <tel:%2B49%2089%20189%2047%2041-09>
>>>>>>>> E-Mail : sebastian.huber at embedded-brains.de
>>>>>>>> <mailto:sebastian.huber at embedded-brains.de>
>>>>>>>> PGP : Public key available on request.
>>>>>>>>
>>>>>>>> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne
>>>>>>>> des EHUG.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Sebastian Huber, embedded brains GmbH
>>>>>>>
>>>>>>> Address : Dornierstr. 4, D-82178 Puchheim, Germany
>>>>>>> Phone : +49 89 189 47 41-16
>>>>>>> Fax : +49 89 189 47 41-09
>>>>>>> E-Mail : sebastian.huber at embedded-brains.de
>>>>>>> PGP : Public key available on request.
>>>>>>>
>>>>>>> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> users mailing list
>>>>>> users at rtems.org
>>>>>> http://lists.rtems.org/mailman/listinfo/users
>>>>>
>>>>>
>>>>
>>>
>>
>
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
More information about the users
mailing list