mailing list of musl libc
 help / color / mirror / code / Atom feed
* A few issues on MIPS
@ 2012-11-05 14:34 Paul Schutte
  2012-11-05 15:28 ` Szabolcs Nagy
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Schutte @ 2012-11-05 14:34 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 12551 bytes --]

Hi Everyone,

I am struggling to get sqlite3 and mongoose-3.3 to work on MIPS.
I started out with a chroot environment based on aboriginal linux for MIPS
where I replaced the default C-library from uclibc to musl as per the
INSTALL instructions in the musl sources. I am using static linking.

I can compile most things just fine and it is working ok, but I am having
trouble with sqlite3 and mongoose.
I am using http://sqlite.org/sqlite-autoconf-3071000.tar.gz
It compiles without a problem, but when I run it, I get disk io errors (On
both physical and virtual machines):

root@tomato:/root# ./sqlite3 file
SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .schema
Error: disk I/O error
sqlite>

This is the strace that I get:

execve("./sqlite3", ["./sqlite3", "file"], [/* 28 vars */]) = 0
ioctl(0, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 16) = 0
set_thread_area(0x4c9b14)               = 0
set_tid_address(0x4c2a84)               = 16812
rt_sigaction(SIGINT, {0x14000000, [RT_68 RT_69 RT_70 RT_72 RT_78 RT_82
RT_84 RT_87], 0x407190 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_70 RT_72
RT_78 RT_82 RT_84 RT_87], 0}, 16) = 0
access("file", F_OK)                    = 0
brk(0)                                  = 0x4c3000
brk(0x4c4000)                           = 0x4c4000
getcwd("/root", 512)                    = 6
stat64("/root/file", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("/root/file", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
fcntl64(3, F_GETFD)                     = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
_llseek(3, 0, [0], SEEK_SET)            = 0
read(3, "", 100)                        = 0
brk(0x4c5000)                           = 0x4c5000
brk(0x4d5000)                           = 0x4d5000
getuid()                                = 0
open("/etc/passwd", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
readv(4, [{"", 0}, {"root::0:0:root:/home/root:/bin/s"..., 1024}], 2) = 76
_llseek(4, -42, [34], SEEK_CUR)         = 0
close(4)                                = 0
open("/home/root/.sqliterc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such
file or directory)
ioctl(1, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
writev(1, [{"SQLite version 3.7.10 2012-01-16"..., 41}, {"\nEnter \".help\"
for instructions\n"..., 75}], 2SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
) = 116
getuid()                                = 0
open("/etc/passwd", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
readv(4, [{"", 0}, {"root::0:0:root:/home/root:/bin/s"..., 1024}], 2) = 76
_llseek(4, -42, [34], SEEK_CUR)         = 0
close(4)                                = 0
writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
readv(0, [{"", 0},
{".schema\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024}], 2)
= 8
brk(0x4d6000)                           = 0x4d6000
fcntl64(3, 0xd /* F_??? */, 0x7fc84210) = -1 EINVAL (Invalid argument)
writev(2, [{"Error: disk I/O error\n", 22}, {NULL, 0}], 2Error: disk I/O
error
) = 22
writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8


When using uclibc I do not get the error:

-- snip --
write(1, "SQLite version 3.7.10 2012-01-16"..., 116SQLite version 3.7.10
2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
) = 116
getuid()                                = 0
open("/etc/passwd", O_RDONLY)           = 4
ioctl(4, TIOCNXCL, 0x7ff2aee0)          = -1 ENOTTY (Inappropriate ioctl
for device)
read(4, "root::0:0:root:/home/root:/bin/s"..., 4096) = 76
close(4)                                = 0
write(1, "sqlite> ", 8sqlite> )                 = 8
read(0,".schema\n", 4096)              = 8
brk(0x6d1000)                           = 0x6d1000
fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741824,
len=1}, 0x7ff28fd0) = 0
fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741826,
len=510}, 0x7ff28fd0) = 0
fcntl64(3, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=1073741824,
len=1}, 0x7ff28fd0) = 0
access("/home/sqlite-autoconf-3071000/file-journal", F_OK) = -1 ENOENT (No
such file or directory)
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
unlink("/home/sqlite-autoconf-3071000/file-wal") = -1 ENOENT (No such file
or directory)
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
brk(0x6d2000)                           = 0x6d2000
fcntl64(3, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0},
0x7ff28aa0) = 0
brk(0x6d3000)                           = 0x6d3000
fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741824,
len=1}, 0x7ff29250) = 0
fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741826,
len=510}, 0x7ff29250) = 0
fcntl64(3, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=1073741824,
len=1}, 0x7ff29250) = 0
access("/home/sqlite-autoconf-3071000/file-journal", F_OK) = -1 ENOENT (No
such file or directory)
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
unlink("/home/sqlite-autoconf-3071000/file-wal") = -1 ENOENT (No such file
or directory)
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
brk(0x6d4000)                           = 0x6d4000
fcntl64(3, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0},
0x7ff29250) = 0
write(1, "sqlite> ", 8sqlite> )                 = 8

If I compile it on amd64/i386 using musl and the same procedure, I also do
not get the problem.

-- snip --
writev(1, [{"SQLite version 3.7.10 2012-01-16"..., 41}, {"\nEnter \".help\"
for instructions\n"..., 75}], 2SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
) = 116
getuid()                                = 1000
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 4
brk(0x1d40000)                          = 0x1d40000
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
readv(4, [{"", 0}, {"root:x:0:0:root:/root:/bin/bash\n"..., 1024}], 2) =
1024
readv(4, [{"", 0}, {"/lib/avahi-autoipd:/bin/false\nav"..., 1024}], 2) = 891
lseek(4, -187, SEEK_CUR)                = 1728
close(4)                                = 0
writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
readv(0, [{"", 0},
{".schema\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024}], 2)
= 8
brk(0x1d41000)                          = 0x1d41000
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1})
= 0
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741826,
len=510}) = 0
fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=1073741824, len=1})
= 0
access("/home/paul/Downloads/sqlite-autoconf-3071000/file-journal", F_OK) =
-1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
unlink("/home/paul/Downloads/sqlite-autoconf-3071000/file-wal") = -1 ENOENT
(No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
brk(0x1d42000)                          = 0x1d42000
brk(0x1d43000)                          = 0x1d43000
fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
brk(0x1d44000)                          = 0x1d44000
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1})
= 0
fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741826,
len=510}) = 0
fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=1073741824, len=1})
= 0
access("/home/paul/Downloads/sqlite-autoconf-3071000/file-journal", F_OK) =
-1 ENOENT (No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
unlink("/home/paul/Downloads/sqlite-autoconf-3071000/file-wal") = -1 ENOENT
(No such file or directory)
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
brk(0x1d45000)                          = 0x1d45000
fcntl(3, F_SETLK, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8


I have setup a cross compile environment according to
http://cmer.uoguelph.ca/apklinux/, which work very well, but give the same
result. I also tried this in the MIPS aboriginal image virtual machine,
instead of the physical hardware. I still get the same issue.


I also statically compiled mongoose-3.3 and get a different problem there.
(Port 8080 is available):


execve("./mongoose", ["./mongoose"], [/* 28 vars */]) = 0
open("./mongoose.conf", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
directory)
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 16) = 0
set_thread_area(0x448974)               = 0
set_tid_address(0x4418e4)               = 16807
rt_sigaction(SIGTERM, {0x14000000, [RT_68 RT_69 RT_71 RT_72 RT_80 RT_82
RT_87], 0x4002f0 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_71 RT_72 RT_80
RT_82 RT_87], 0}, 16) = 0
rt_sigaction(SIGINT, {0x14000000, [RT_68 RT_69 RT_71 RT_72 RT_80 RT_82
RT_87], 0x4002f0 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_71 RT_72 RT_80
RT_82 RT_87], 0}, 16) = 0
brk(0)                                  = 0x442000
brk(0x443000)                           = 0x443000
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
setsockopt(3, SO_DEBUG, 2, [1], 4)      = -1 ENOPROTOOPT (Protocol not
available)
close(3)                                = 0
ioctl(1, TIOCNXCL, {B38400 opost isig icanon echo ...}) = 0
writev(1, [{"set_ports_option: cannot bind to"..., 70}, {"\n", 1}],
2set_ports_option: cannot bind to 8080: Cannot assign requested address
) = 71
writev(2, [{"Failed to start Mongoose.\n", 26}, {NULL, 0}], 2Failed to
start Mongoose.
) = 26
exit_group(1)                           = ?
+++ exited with 1 +++

On a different architecture (amd64) it works:

execve("./mongoose", ["./mongoose"], [/* 39 vars */]) = 0
rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
arch_prctl(ARCH_SET_FS, 0x621960)       = 0
set_tid_address(0x621990)               = 9789
open("./mongoose.conf", O_RDONLY)       = -1 ENOENT (No such file or
directory)
rt_sigaction(SIGTERM, {0x4001f4, [], SA_RESTORER|SA_RESTART, 0x418ea8},
{SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x4001f4, [], SA_RESTORER|SA_RESTART, 0x418ea8},
{SIG_DFL, [], 0}, 8) = 0
brk(0)                                  = 0x1aab000
brk(0x1aac000)                          = 0x1aac000
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
bind(3, {sa_family=AF_INET, sin_port=htons(8080),
sin_addr=inet_addr("0.0.0.0")}, 16) = 0
listen(3, 128)                          = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0


Just for completeness this is the MIPS hardware:
root@tomato:/root# cat /proc/version
Linux version 2.6.22.19 (root@tomato) (gcc version 4.2.4) #21 Sat Sep 1
04:19:40 CEST 2012

root@tomato:/root# cat /proc/cpuinfo
system type             : Broadcom BCM4716 chip rev 1 pkg 10
processor               : 0
cpu model               : MIPS 74K V4.0
BogoMIPS                : 239.20
cpu MHz                 : 480
wait instruction        : no
microsecond timers      : yes
tlb_entries             : 64
extra interrupt vector  : no
hardware watchpoint     : yes
ASEs implemented        : mips16 dsp
shadow register sets    : 1
VCED exceptions         : not available
VCEI exceptions         : not available

unaligned_instructions  : 12
root@tomato:/root#


This is the qemu aboriginal linux image info:
(mipsel:1) /home # cat /proc/version
Linux version 3.5.0 (landley@brillig)
(libc/sysdeps/linux/mips/crt1.S:(.text+0x1c): undefined reference to
`main') #1 Thu Aug 23 02:33:15 CDT 2012

(mipsel:1) /home # cat /proc/cpuinfo
system type        : MIPS Malta
processor        : 0
cpu model        : MIPS 24Kc V0.0  FPU V0.0
BogoMIPS        : 1179.64
wait instruction    : yes
microsecond timers    : yes
tlb_entries        : 16
extra interrupt vector    : yes
hardware watchpoint    : yes, count: 1, address/irw mask: [0x0ff8]
ASEs implemented    : mips16
shadow register sets    : 1
kscratch registers    : 0
core            : 0
VCED exceptions        : not available
VCEI exceptions        : not available


It is quite likely that I messed up, but if have tried several different
ways on both physical and virtual machines, with native and cross
compiling. I get the same result every time. BTW I have compiled LuaJit
statically using the same method and it works fine. (I can run scimark.lua).

Regards
Paul

[-- Attachment #2: Type: text/html, Size: 14216 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A few issues on MIPS
  2012-11-05 14:34 A few issues on MIPS Paul Schutte
@ 2012-11-05 15:28 ` Szabolcs Nagy
  2012-11-05 17:27   ` Paul Schutte
  0 siblings, 1 reply; 9+ messages in thread
From: Szabolcs Nagy @ 2012-11-05 15:28 UTC (permalink / raw)
  To: musl

* Paul Schutte <sjpschutte@gmail.com> [2012-11-05 16:34:47 +0200]:
> open("/root/file", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
> fcntl64(3, F_GETFD)                     = 0
> fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
> fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
> _llseek(3, 0, [0], SEEK_SET)            = 0
> read(3, "", 100)                        = 0
...
> writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
> readv(0, [{"", 0},
> {".schema\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024}], 2)
> = 8
> brk(0x4d6000)                           = 0x4d6000
> fcntl64(3, 0xd /* F_??? */, 0x7fc84210) = -1 EINVAL (Invalid argument)
> writev(2, [{"Error: disk I/O error\n", 22}, {NULL, 0}], 2Error: disk I/O
> error
> ) = 22
> writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
> 

i guess the fcntl arguments are broken on mips

> When using uclibc I do not get the error:
> 
> write(1, "sqlite> ", 8sqlite> )                 = 8
> read(0,".schema\n", 4096)              = 8
> brk(0x6d1000)                           = 0x6d1000
> fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741824,
> len=1}, 0x7ff28fd0) = 0

one should check the kernel vs musl definition of F_SETLK64

> If I compile it on amd64/i386 using musl and the same procedure, I also do
> not get the problem.
> 
> writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
> readv(0, [{"", 0},
> {".schema\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024}], 2)
> = 8
> brk(0x1d41000)                          = 0x1d41000
> fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824, len=1})
> = 0


> I also statically compiled mongoose-3.3 and get a different problem there.
> (Port 8080 is available):
> 
> 
> execve("./mongoose", ["./mongoose"], [/* 28 vars */]) = 0
> open("./mongoose.conf", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or
> directory)
> rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 16) = 0
> set_thread_area(0x448974)               = 0
> set_tid_address(0x4418e4)               = 16807
> rt_sigaction(SIGTERM, {0x14000000, [RT_68 RT_69 RT_71 RT_72 RT_80 RT_82
> RT_87], 0x4002f0 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_71 RT_72 RT_80
> RT_82 RT_87], 0}, 16) = 0
> rt_sigaction(SIGINT, {0x14000000, [RT_68 RT_69 RT_71 RT_72 RT_80 RT_82
> RT_87], 0x4002f0 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_71 RT_72 RT_80
> RT_82 RT_87], 0}, 16) = 0
> brk(0)                                  = 0x442000
> brk(0x443000)                           = 0x443000
> socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
> setsockopt(3, SO_DEBUG, 2, [1], 4)      = -1 ENOPROTOOPT (Protocol not
> available)

seems to be similar issue: SO_DEBUG is probably bogus

> On a different architecture (amd64) it works:
> 
> execve("./mongoose", ["./mongoose"], [/* 39 vars */]) = 0
> rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
> arch_prctl(ARCH_SET_FS, 0x621960)       = 0
> set_tid_address(0x621990)               = 9789
> open("./mongoose.conf", O_RDONLY)       = -1 ENOENT (No such file or
> directory)
> rt_sigaction(SIGTERM, {0x4001f4, [], SA_RESTORER|SA_RESTART, 0x418ea8},
> {SIG_DFL, [], 0}, 8) = 0
> rt_sigaction(SIGINT, {0x4001f4, [], SA_RESTORER|SA_RESTART, 0x418ea8},
> {SIG_DFL, [], 0}, 8) = 0
> brk(0)                                  = 0x1aab000
> brk(0x1aac000)                          = 0x1aac000
> socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
> setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0


SOL_SOCKET is probably wrongly defined for mips



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A few issues on MIPS
  2012-11-05 15:28 ` Szabolcs Nagy
@ 2012-11-05 17:27   ` Paul Schutte
  2012-11-05 17:31     ` Rich Felker
  0 siblings, 1 reply; 9+ messages in thread
From: Paul Schutte @ 2012-11-05 17:27 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 3983 bytes --]

Thanks for the reply.

I suspected something like you mention and therefore I made sure that I
installed the correct kernel headers before I compiled musl or any of the
other software.

It did not seem to make any difference.

 Regards
Paul

On Mon, Nov 5, 2012 at 5:28 PM, Szabolcs Nagy <nsz@port70.net> wrote:

> * Paul Schutte <sjpschutte@gmail.com> [2012-11-05 16:34:47 +0200]:
> > open("/root/file", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
> > fcntl64(3, F_GETFD)                     = 0
> > fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
> > fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
> > _llseek(3, 0, [0], SEEK_SET)            = 0
> > read(3, "", 100)                        = 0
> ...
> > writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
> > readv(0, [{"", 0},
> > {".schema\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024}],
> 2)
> > = 8
> > brk(0x4d6000)                           = 0x4d6000
> > fcntl64(3, 0xd /* F_??? */, 0x7fc84210) = -1 EINVAL (Invalid argument)
> > writev(2, [{"Error: disk I/O error\n", 22}, {NULL, 0}], 2Error: disk I/O
> > error
> > ) = 22
> > writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
> >
>
> i guess the fcntl arguments are broken on mips
>
> > When using uclibc I do not get the error:
> >
> > write(1, "sqlite> ", 8sqlite> )                 = 8
> > read(0,".schema\n", 4096)              = 8
> > brk(0x6d1000)                           = 0x6d1000
> > fcntl64(3, F_SETLK64, {type=F_RDLCK, whence=SEEK_SET, start=1073741824,
> > len=1}, 0x7ff28fd0) = 0
>
> one should check the kernel vs musl definition of F_SETLK64
>
> > If I compile it on amd64/i386 using musl and the same procedure, I also
> do
> > not get the problem.
> >
> > writev(1, [{"sqlite> ", 8}, {NULL, 0}], 2sqlite> ) = 8
> > readv(0, [{"", 0},
> > {".schema\n\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1024}],
> 2)
> > = 8
> > brk(0x1d41000)                          = 0x1d41000
> > fcntl(3, F_SETLK, {type=F_RDLCK, whence=SEEK_SET, start=1073741824,
> len=1})
> > = 0
>
>
> > I also statically compiled mongoose-3.3 and get a different problem
> there.
> > (Port 8080 is available):
> >
> >
> > execve("./mongoose", ["./mongoose"], [/* 28 vars */]) = 0
> > open("./mongoose.conf", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file
> or
> > directory)
> > rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 16) = 0
> > set_thread_area(0x448974)               = 0
> > set_tid_address(0x4418e4)               = 16807
> > rt_sigaction(SIGTERM, {0x14000000, [RT_68 RT_69 RT_71 RT_72 RT_80 RT_82
> > RT_87], 0x4002f0 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_71 RT_72 RT_80
> > RT_82 RT_87], 0}, 16) = 0
> > rt_sigaction(SIGINT, {0x14000000, [RT_68 RT_69 RT_71 RT_72 RT_80 RT_82
> > RT_87], 0x4002f0 /* SA_??? */}, {SIG_DFL, [RT_68 RT_69 RT_71 RT_72 RT_80
> > RT_82 RT_87], 0}, 16) = 0
> > brk(0)                                  = 0x442000
> > brk(0x443000)                           = 0x443000
> > socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
> > setsockopt(3, SO_DEBUG, 2, [1], 4)      = -1 ENOPROTOOPT (Protocol not
> > available)
>
> seems to be similar issue: SO_DEBUG is probably bogus
>
> > On a different architecture (amd64) it works:
> >
> > execve("./mongoose", ["./mongoose"], [/* 39 vars */]) = 0
> > rt_sigprocmask(SIG_UNBLOCK, [RT_1 RT_2], NULL, 8) = 0
> > arch_prctl(ARCH_SET_FS, 0x621960)       = 0
> > set_tid_address(0x621990)               = 9789
> > open("./mongoose.conf", O_RDONLY)       = -1 ENOENT (No such file or
> > directory)
> > rt_sigaction(SIGTERM, {0x4001f4, [], SA_RESTORER|SA_RESTART, 0x418ea8},
> > {SIG_DFL, [], 0}, 8) = 0
> > rt_sigaction(SIGINT, {0x4001f4, [], SA_RESTORER|SA_RESTART, 0x418ea8},
> > {SIG_DFL, [], 0}, 8) = 0
> > brk(0)                                  = 0x1aab000
> > brk(0x1aac000)                          = 0x1aac000
> > socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
> > setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
>
>
> SOL_SOCKET is probably wrongly defined for mips
>
>

[-- Attachment #2: Type: text/html, Size: 5036 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A few issues on MIPS
  2012-11-05 17:27   ` Paul Schutte
@ 2012-11-05 17:31     ` Rich Felker
  2012-11-05 18:11       ` Paul Schutte
  2012-11-05 18:46       ` sjpschutte
  0 siblings, 2 replies; 9+ messages in thread
From: Rich Felker @ 2012-11-05 17:31 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 815 bytes --]

On Mon, Nov 05, 2012 at 07:27:44PM +0200, Paul Schutte wrote:
> Thanks for the reply.
> 
> I suspected something like you mention and therefore I made sure that I
> installed the correct kernel headers before I compiled musl or any of the
> other software.

Kernel headers are completely irrelevant; they're not used anywhere.
nsz's analysis is right. I have a patch I'm about to commit. In case
you'd like to try it directly without using git, I'm attaching it
here.

There may be more fixes still needed. MIPS has A LOT of gratuitous
differences in constant definitions and I thought I'd caught all of
them before, but apparently some slipped through. The fcntl part of
the patch has been tested and seems correct. The socket parts should
be right, but they're untested; I'm working on a test for them now.

Rich

[-- Attachment #2: mips.diff --]
[-- Type: text/plain, Size: 2472 bytes --]

diff --git a/arch/mips/bits/fcntl.h b/arch/mips/bits/fcntl.h
index ad847f0..116852e 100644
--- a/arch/mips/bits/fcntl.h
+++ b/arch/mips/bits/fcntl.h
@@ -26,14 +26,14 @@
 #define F_GETFL  3
 #define F_SETFL  4
 
-#define F_SETOWN 8
-#define F_GETOWN 9
+#define F_SETOWN 24
+#define F_GETOWN 23
 #define F_SETSIG 10
 #define F_GETSIG 11
 
-#define F_GETLK 12
-#define F_SETLK 13
-#define F_SETLKW 14
+#define F_GETLK 33
+#define F_SETLK 34
+#define F_SETLKW 35
 
 #define F_SETOWN_EX 15
 #define F_GETOWN_EX 16
diff --git a/arch/mips/bits/socket.h b/arch/mips/bits/socket.h
index 3715ddd..ba79045 100644
--- a/arch/mips/bits/socket.h
+++ b/arch/mips/bits/socket.h
@@ -18,3 +18,31 @@ struct cmsghdr
 
 #define SOCK_STREAM    2
 #define SOCK_DGRAM     1
+
+#define SOL_SOCKET     65535
+
+#define SO_DEBUG        1
+#define SO_REUSEADDR    4
+#define SO_TYPE         0x1008
+#define SO_ERROR        0x1007
+#define SO_DONTROUTE    16
+#define SO_BROADCAST    32
+#define SO_SNDBUF       0x1001
+#define SO_RCVBUF       0x1002
+#define SO_KEEPALIVE    8
+#define SO_OOBINLINE    256
+
+#define SO_NO_CHECK     11
+#define SO_PRIORITY     12
+#define SO_LINGER       128
+#define SO_BSDCOMPAT    14
+#define SO_REUSEPORT    512
+#define SO_PASSCRED     17
+#define SO_PEERCRED     18
+#define SO_RCVLOWAT     0x1004
+#define SO_SNDLOWAT     0x1003
+#define SO_RCVTIMEO     0x1006
+#define SO_SNDTIMEO     0x1005
+
+#define SOCK_NONBLOCK     0200
+#define SOCK_CLOEXEC  02000000
diff --git a/include/sys/socket.h b/include/sys/socket.h
index b138653..0a2f11d 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -47,8 +47,10 @@ struct linger
 #define SOCK_DCCP      6
 #define SOCK_PACKET    10
 
+#ifndef SOCK_CLOEXEC
 #define SOCK_CLOEXEC   02000000
 #define SOCK_NONBLOCK  04000
+#endif
 
 #define PF_UNSPEC       0
 #define PF_LOCAL        1
@@ -126,6 +128,7 @@ struct linger
 #define AF_ALG          PF_ALG
 #define AF_MAX          PF_MAX
 
+#ifndef SO_DEBUG
 #define SO_DEBUG        1
 #define SO_REUSEADDR    2
 #define SO_TYPE         3
@@ -147,6 +150,8 @@ struct linger
 #define SO_SNDLOWAT     19
 #define SO_RCVTIMEO     20
 #define SO_SNDTIMEO     21
+#endif
+
 
 #define SO_SECURITY_AUTHENTICATION              22
 #define SO_SECURITY_ENCRYPTION_TRANSPORT        23
@@ -163,7 +168,9 @@ struct linger
 
 #define SO_ACCEPTCONN           30
 
+#ifndef SOL_SOCKET
 #define SOL_SOCKET      1
+#endif
 
 #define SOL_RAW         255
 #define SOL_DECNET      261

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A few issues on MIPS
  2012-11-05 17:31     ` Rich Felker
@ 2012-11-05 18:11       ` Paul Schutte
  2012-11-05 18:46       ` sjpschutte
  1 sibling, 0 replies; 9+ messages in thread
From: Paul Schutte @ 2012-11-05 18:11 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 978 bytes --]

Thanks !

I will apply and report back.

Regards
Paul

On Mon, Nov 5, 2012 at 7:31 PM, Rich Felker <dalias@aerifal.cx> wrote:

> On Mon, Nov 05, 2012 at 07:27:44PM +0200, Paul Schutte wrote:
> > Thanks for the reply.
> >
> > I suspected something like you mention and therefore I made sure that I
> > installed the correct kernel headers before I compiled musl or any of the
> > other software.
>
> Kernel headers are completely irrelevant; they're not used anywhere.
> nsz's analysis is right. I have a patch I'm about to commit. In case
> you'd like to try it directly without using git, I'm attaching it
> here.
>
> There may be more fixes still needed. MIPS has A LOT of gratuitous
> differences in constant definitions and I thought I'd caught all of
> them before, but apparently some slipped through. The fcntl part of
> the patch has been tested and seems correct. The socket parts should
> be right, but they're untested; I'm working on a test for them now.
>
> Rich
>

[-- Attachment #2: Type: text/html, Size: 1444 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A few issues on MIPS
  2012-11-05 17:31     ` Rich Felker
  2012-11-05 18:11       ` Paul Schutte
@ 2012-11-05 18:46       ` sjpschutte
  2012-11-05 18:50         ` Szabolcs Nagy
  2012-11-05 19:39         ` Rich Felker
  1 sibling, 2 replies; 9+ messages in thread
From: sjpschutte @ 2012-11-05 18:46 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]

Hi Rich,

I have recompiled musl with the patch and mongoose is working now.

I will report back on sqlite after a few hours.

Thanks
Paul


On 2012/11/05 19:31 Rich Felker wrote:

On Mon, Nov 05, 2012 at 07:27:44PM +0200, Paul Schutte wrote:
> Thanks for the reply.
>
> I suspected something like you mention and therefore I made sure that I
> installed the correct kernel headers before I compiled musl or any of the
> other software.


Kernel headers are completely irrelevant; they're not used anywhere.
nsz's analysis is right. I have a patch I'm about to commit. In case
you'd like to try it directly without using git, I'm attaching it
here.


There may be more fixes still needed. MIPS has A LOT of gratuitous
differences in constant definitions and I thought I'd caught all of
them before, but apparently some slipped through. The fcntl part of
the patch has been tested and seems correct. The socket parts should
be right, but they're untested; I'm working on a test for them now.


Rich




[-- Attachment #2: Type: text/html, Size: 2488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A few issues on MIPS
  2012-11-05 18:46       ` sjpschutte
@ 2012-11-05 18:50         ` Szabolcs Nagy
  2012-11-05 19:39         ` Rich Felker
  1 sibling, 0 replies; 9+ messages in thread
From: Szabolcs Nagy @ 2012-11-05 18:50 UTC (permalink / raw)
  To: musl

> I have recompiled musl with the patch and mongoose is working now.
> 
> I will report back on sqlite after a few hours.
> 

that was fast :)

> On 2012/11/05 19:31 Rich Felker wrote:
> Kernel headers are completely irrelevant; they're not used anywhere.

kd.h, vt.h, soundcard.h include the corresponding linux header

but i guess this is for broken code including them with the wrong path
(foo.h vs linux/foo.h)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A few issues on MIPS
  2012-11-05 18:46       ` sjpschutte
  2012-11-05 18:50         ` Szabolcs Nagy
@ 2012-11-05 19:39         ` Rich Felker
  2012-11-05 22:56           ` Paul Schutte
  1 sibling, 1 reply; 9+ messages in thread
From: Rich Felker @ 2012-11-05 19:39 UTC (permalink / raw)
  To: musl

On Mon, Nov 05, 2012 at 06:46:12PM +0000, sjpschutte@gmail.com wrote:
> Hi Rich,
> 
> I have recompiled musl with the patch and mongoose is working now.
> 
> I will report back on sqlite after a few hours.

My tests (committed to libc-testsuite) seem to indicate that these
interfaces are working right now. Note that I also committed further
header fixes (errno values); apparently these were copied from the
"generic" errno definitions after checking that the first page or so
of definitions match, without noticing mismatches further down.

Note that after applying the changes to update these headers, you
should run "make clean" before recompiling musl. The Makefile
dependency rules do not cause rebuild on changes to these files, on
the principle that changes to them _should_ just be adding new things;
not changing the existing ABI stuff. Of course, in this case the
existing stuff was wrong..

Rich


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: A few issues on MIPS
  2012-11-05 19:39         ` Rich Felker
@ 2012-11-05 22:56           ` Paul Schutte
  0 siblings, 0 replies; 9+ messages in thread
From: Paul Schutte @ 2012-11-05 22:56 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 799 bytes --]

Thanks Guys.

My home network is behind a 3G router which seems to have gone down. I will
only be able to see the sqlite result on Friday when I am back, but I am
pretty sure it will work now.


Note that after applying the changes to update these headers, you
> should run "make clean" before recompiling musl. The Makefile
> dependency rules do not cause rebuild on changes to these files, on
> the principle that changes to them _should_ just be adding new things;
> not changing the existing ABI stuff. Of course, in this case the
> existing stuff was wrong..
>

Thanks. I "rm -rf"ed the whole directory and started from scratch, just to
be sure ...

I appreciate it very much. It really gives me a kick to see how much
resources I am saving by statically compiling against musl.


Regards
Paul

[-- Attachment #2: Type: text/html, Size: 1147 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-11-05 22:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05 14:34 A few issues on MIPS Paul Schutte
2012-11-05 15:28 ` Szabolcs Nagy
2012-11-05 17:27   ` Paul Schutte
2012-11-05 17:31     ` Rich Felker
2012-11-05 18:11       ` Paul Schutte
2012-11-05 18:46       ` sjpschutte
2012-11-05 18:50         ` Szabolcs Nagy
2012-11-05 19:39         ` Rich Felker
2012-11-05 22:56           ` Paul Schutte

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).