Bug 7844 - Lua with hard-float on MIPS by buildroot doesn't work
Summary: Lua with hard-float on MIPS by buildroot doesn't work
Status: RESOLVED INVALID
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2014.11
Hardware: PC Linux
: P5 critical
Target Milestone: ---
Assignee: Vicente Olivert Riera
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-29 00:04 UTC by Jinho Yoo
Modified: 2015-04-02 15:28 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
Our linux build configuration (33.50 KB, application/octet-stream)
2015-01-30 14:43 UTC, Jinho Yoo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jinho Yoo 2015-01-29 00:04:18 UTC
I found something strange.

I wrote simple script that print the variable in Lua. It worked on x86 on linux. I tried to run it on my target device that is MIPS little endian. I prepared the lua by buildroot. I used 'hard-float' option for performance issue. But this simple script doesn't work. I used Sourcery CodeBench.

I tested it with 'soft-float' option. Then lua worked correctly. Have you the experience like that?

The lua code is like below.

=================
local var = 131523;
print(var);
=================

It must print 131523. But my target printed 0 . What's wrong?
Comment 1 Jinho Yoo 2015-01-29 00:06:55 UTC
Lua version is Lua 5.1.
Comment 2 Thomas Petazzoni 2015-01-29 08:18:41 UTC
Thanks for the report. I've reassigned the bug to our MIPS guy Vicente.
Comment 3 Vicente Olivert Riera 2015-01-29 10:51:14 UTC
Hello.

I have done a Buildroot build for x86_64 using the Sourcery CodeBench toolchain and then I chrooted into it to check if this problem is not present in other architectures.

I have never used Lua so, please tell me if this is expected:

# chroot images /bin/bash
bash-4.3# lua  
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> local var = 12345
> print(var)
nil
> var = 12345
> print(var)
12345

I see exactly the same behavior on MIPS big endian, tested in real hardware, for both soft and hard float. I will check it on little endian if you think that is necessary.
Comment 4 Gustavo Zacarias 2015-01-29 11:05:27 UTC
Vicente: yes, it's expected, see http://www.lua.org/pil/4.2.html (search for interactive, it's not considered the same block in that case).
Try to run it from a file.
Comment 5 Carlos Santos 2015-01-29 11:17:42 UTC
This is the expected behavior, as documented on http://www.lua.org/pil/4.2.html

$ rpm -qi lua
Name        : lua
Version     : 5.2.2
Release     : 8.fc21
Architecture: x86_64
Install Date: Wed 03 Dec 2014 06:33:31 PM BRST
Group       : Development/Languages
Size        : 602972
License     : MIT
Signature   : RSA/SHA256, Sun 17 Aug 2014 12:08:57 PM BRT, Key ID 89ad4e8795a43f54
Source RPM  : lua-5.2.2-8.fc21.src.rpm
Build Date  : Sun 17 Aug 2014 11:59:50 AM BRT
Build Host  : buildhw-02.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://www.lua.org/
Summary     : Powerful light-weight programming language
[...]
$ lua
Lua 5.2.2  Copyright (C) 1994-2013 Lua.org, PUC-Rio
> local var = 12345
> print(var)
nil
> var = 12345
> print(var)
12345
> if 6 > 4 then
>> local var = 12345
>> print(var)
>> end
12345
> 

I'd close this as "not a bug".
Comment 6 Vicente Olivert Riera 2015-01-29 12:16:51 UTC
I have tested it on real MIPS hardware. I have built a Buildroot rootfs for MIPS32 Little-Endian Hard-Float using the Sourcery CodeBench toolchain.

This is the defconfig I have used:

BR2_mipsel=y
# BR2_MIPS_SOFT_FLOAT is not set
BR2_TOOLCHAIN_EXTERNAL=y
BR2_INIT_SYSV=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
BR2_PACKAGE_LUA=y

It works for me:

Welcome to Buildroot
buildroot login: root
Password: 
# cat > test.lua << EOF
> local var = 12345;
> print(var);
> EOF
# lua test.lua 
12345

What target device do you have? Can you share your defconfig with us? What kernel are you using?

Thanks.
Comment 7 Jinho Yoo 2015-01-30 14:43:39 UTC
Created attachment 5834 [details]
Our linux build configuration

It's my linux build configuration.
Comment 8 Vicente Olivert Riera 2015-01-30 14:46:01 UTC
(In reply to comment #7)
> Created attachment 5834 [details]
> Our linux build configuration
> 
> It's my linux build configuration.

Please, tell us:
1. what target device are you using
2. what kernel version are you using
3. what defconfig are you using to generate the buildroot rootfs
Comment 9 Jinho Yoo 2015-01-31 00:48:47 UTC
OK, I see. 

>1. what target device are you using
It's MIPS Little endian device. We're developing our own embedded system by collaborating other H/W company. 

>2. what kernel version are you using
It's Linux kernel release 3.x. 

>3. what defconfig are you using to generate the build root rootfs
Please check the attached file. (https://bugs.busybox.net/attachment.cgi?id=5834). We don't use buildroot to build kernel. We're using buildroot to build 3rd parties. 

Jinho Yoo
Comment 10 Vicente Olivert Riera 2015-02-03 12:21:27 UTC
(In reply to comment #9)
> >1. what target device are you using
> It's MIPS Little endian device. We're developing our own embedded system by
> collaborating other H/W company. 

Ok, so it's not a common device but a custom one you are developing. Could you tell me at least which SoC are you using?
 
> >2. what kernel version are you using
> It's Linux kernel release 3.x. 

3.x? Please, tell me the exact version you are using so I can try to reproduce your problem. If you tell me 3.x, what kernel should I try? 3.0, 3.0.1, 3.0.2, ... 3.18.3, 3.19?

> >3. what defconfig are you using to generate the buildroot rootfs
> Please check the attached file.
> (https://bugs.busybox.net/attachment.cgi?id=5834). We don't use buildroot to
> build kernel. We're using buildroot to build 3rd parties. 

I didn't say anything about the kernel here. I wanted to see the defconfig you are using to build the Buildroot rootfs. You have attached a binary file. The defconfig should be a text file.
Comment 11 Jinho Yoo 2015-02-03 14:13:12 UTC

Sorry for my late response. 

The kernel version we are using is 3.8.13. 

The attached file is ascii file, not binary. Please try to open it via text editor. 

Well.. Is it enough information? 
========================
MIPS32 Core

- MIPS32 APTIV UP Core
- 32KB instruction and 32KB data L1 cache
- VPE(Virtual Processing Element)
- Hardware TC(Thread Context)
========================
Comment 12 Vicente Olivert Riera 2015-04-02 15:21:39 UTC
I cannot reproduce the bug, sorry. Are you still having this problem?
Comment 13 Jinho Yoo 2015-04-02 15:26:44 UTC
Dear Everybody. 

 I found the reason. The CPU on target board doesn't have floating point calculation unit. I got this information from our H/W partner. I'm very sorry to make you guys confuse. 

 Regards, 
Jinho Yoo
Comment 14 Jinho Yoo 2015-04-02 15:28:00 UTC
It's my mistake. I had to check target board's CPU specification.