Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 24 Oct 2014, 19:58
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Compiling with musl (an alternate libc)
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 5 of 5 Posts_count   Goto page: Previous 1, 2, 3, 4, 5
Author Message
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Mon 18 Mar 2013, 00:59    Post_subject:  

goingnuts wrote:
I am having problems getting util-linux to build (tried 2.13-pre7 & util-linux-2.22) both with their own problems. I have also tried to search for util-linux-musl-patches but not found something usable...Any hints?
I only need 4 of the aps from it (rev/mount/umount/losetup) but they are quite important as they go in initrd...

Is there a reason you can't use busybox for these?

All the projects I know of so far have used busybox, but...perhaps starch would have that...Ah yes:
https://github.com/StarchLinux/starch-ports/blob/master/core/util-linux/PKGBUILD
Not quite enough info to build here; you need to build PAM or disable su, login, and sulogin. Also it seems you might have better luck with 2.21.5.

OK...just going at it my own way (2.22.2)...
./configure --without-udev --without-slang --without-selinux --without-audit --disable-login --disable-su --disable-sulogin --disable-schedutils --disable-nls
CFLAGS="-D_GNU_SOURCE -Os"
I inserted this in include/cpuset.h below the first include:
Code:
#include <sys/types.h>
#ifndef __cpu_mask
#define __NCPUBITS (8 * sizeof(__cpu_mask))
typedef unsigned long int __cpu_mask;
typedef struct
{
  __cpu_mask __bits[ 1024 / __NCPUBITS ];
} cpu_set_t;
#endif

Now it fails in a few places due to a missing <sys/ttydefaults.h> (CEOL et al.); cfdisk is using __sighandler_t instead of sighandler_t; those are most of the problems...
Back to top
View user's profile Send_private_message 
goingnuts

Joined: 07 Dec 2008
Posts: 781

PostPosted: Mon 18 Mar 2013, 14:33    Post_subject:  

Busybox bins will do in initrd but u/mount-FULL is needed in some scripts later (functions4puppy4, rc.shutdown a.o.) so I include them in initrd and copy before switchroot.

Your hints made me able to compile util-linux-2.22...but the mount-bin segfaults.
Below end of running strace on the mount:
Quote:
stat64("/run", 0xbff4ede8) = -1 ENOENT (No such file or directory)
lstat64("/dev/.mount/utab", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("/dev/.mount/utab", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
close(3) = 0
lstat64("/etc/mtab", {st_mode=S_IFLNK|0777, st_size=12, ...}) = 0
open("/proc/self/mountinfo", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/proc/mounts", O_RDONLY|O_LARGEFILE) = 3
readv(3, [{"", 0}, {"rootfs / rootfs rw 0 0\n/dev/sdc5"..., 1024}], 2) = 876
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

Well - I will see if I can get the old util-linux-2.13-pre7 working...
Back to top
View user's profile Send_private_message Visit_website 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Mon 18 Mar 2013, 20:56    Post_subject:  

goingnuts wrote:
Busybox bins will do in initrd but u/mount-FULL is needed in some scripts later (functions4puppy4, rc.shutdown a.o.) so I include them in initrd and copy before switchroot.

Your hints made me able to compile util-linux-2.22...but the mount-bin segfaults.
Below end of running strace on the mount:
Quote:
stat64("/run", 0xbff4ede8) = -1 ENOENT (No such file or directory)
lstat64("/dev/.mount/utab", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("/dev/.mount/utab", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
close(3) = 0
lstat64("/etc/mtab", {st_mode=S_IFLNK|0777, st_size=12, ...}) = 0
open("/proc/self/mountinfo", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
open("/proc/mounts", O_RDONLY|O_LARGEFILE) = 3
readv(3, [{"", 0}, {"rootfs / rootfs rw 0 0\n/dev/sdc5"..., 1024}], 2) = 876
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

Well - I will see if I can get the old util-linux-2.13-pre7 working...

If you see this issue again, would you mind posting what the output from gdb "where" or "bt full" is?
Back to top
View user's profile Send_private_message 
goingnuts

Joined: 07 Dec 2008
Posts: 781

PostPosted: Tue 19 Mar 2013, 01:43    Post_subject:  

Attached output of both...thx.
I compiled util-linux-2.22 with
Quote:
CFLAGS="-g -D_BSD_SOURCE -D_GNU_SOURCE -D__KERNEL_STRICT_NAMES" LDFLAGS="-static -Xcompiler -static" \
./configure --prefix=/usr --without-udev --without-slang --without-selinux --without-audit --disable-login --disable-su --disable-sulogin --disable-schedutils --disable-nls --disable-shared --disable-fsck --without-ncurses --disable-utmpdump


and had to remove fsck.minix$(EXEEXT) and hexdump$(EXEEXT) from Makefile after configure to get on building - but I do not think that has anything to do with it. Attached applied patch as well...
util-linux-2.22.diff.gz
Description  fake .gz
gz

 Download 
Filename  util-linux-2.22.diff.gz 
Filesize  1.4 KB 
Downloaded  208 Time(s) 
mount_dbg.txt.gz
Description  fake .gz - output of gdb mount
gz

 Download 
Filename  mount_dbg.txt.gz 
Filesize  7.26 KB 
Downloaded  194 Time(s) 
Back to top
View user's profile Send_private_message Visit_website 
jamesbond

Joined: 26 Feb 2007
Posts: 2230
Location: The Blue Marble

PostPosted: Sat 06 Apr 2013, 10:12    Post_subject:  

Ibidem,

I used to be able to cross-compile 32-bit static binaries with my 64-bit compiler - ie, under Fatdog64's 64-bit gcc, I built 32-bit musl static libs and use that to compile a program (documented in the first page of this thread).

I just tried recent version of musl (9 mar 2013) and I can't do that anymore, using exactly the same config.mak. Is this capability removed?

The error was this: it keeps trying to load crtbegin.o. I fixed this by editing musl-gcc specs file, but then it failed to find "__dividi3" symbol. In case you're wondering, the program I tried to build is guess_fstype.

cheers!

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Sat 06 Apr 2013, 13:25    Post_subject:  

jamesbond wrote:
Ibidem,

I used to be able to cross-compile 32-bit static binaries with my 64-bit compiler - ie, under Fatdog64's 64-bit gcc, I built 32-bit musl static libs and use that to compile a program (documented in the first page of this thread).

I just tried recent version of musl (9 mar 2013) and I can't do that anymore, using exactly the same config.mak. Is this capability removed?

The error was this: it keeps trying to load crtbegin.o. I fixed this by editing musl-gcc specs file, but then it failed to find "__dividi3" symbol. In case you're wondering, the program I tried to build is guess_fstype.

cheers!

Hmm...
that should come from your host compiler (a subdirectory of /usr/lib/gcc/i486-linux-gnu/ most likely)
And of course you need your compiler to include that in 32-bit form...which I expected that GCC would do by default.
I wonder if the issue is musl-gcc switching to a _replacement_ spec file...but that might not be the real issue, otoh.
However, I can't test anything to do with this, since I have an i386-only system.

Are you using the same compiler? Does just reverting the musl update leave you with something that works?

If the compiler isn't the issue, could you try a git bisect?
http://effectif.com/git/simple-approach-to-finding-bugs-with-git-bisect
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2230
Location: The Blue Marble

PostPosted: Sat 06 Apr 2013, 14:10    Post_subject:  

EDIT: Original post deleted.
I did change the compiler, it's just that I didn't remember Embarassed
So it's not musl problem at all - it's PEBKAC problem Embarassed

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Sat 06 Apr 2013, 18:24    Post_subject:  

jamesbond wrote:
EDIT: Original post deleted.
I did change the compiler, it's just that I didn't remember Embarassed
So it's not musl problem at all - it's PEBKAC problem Embarassed


That sort of thing has happened to me also...
I presume that the new compiler can't use -m32 with the old musl, either?
(Did you disable multilib or something like that?)
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2230
Location: The Blue Marble

PostPosted: Mon 08 Apr 2013, 07:29    Post_subject:  

Ibidem wrote:
I presume that the new compiler can't use -m32 with the old musl, either?
Yes Embarassed
Quote:
(Did you disable multilib or something like that?)
I don't think so. This is the compiler that got compiled by T2 SDE. The one that worked fast Fatdog 521, with gcc 4.4.3 (also compiled by T2 SDE, earlier version). I saw that is has a "32" directory under the libgcc, that contains all 32-bit startup files. Fatdog 620 which I'm using now uses gcc 4.6.2. I got confused because when I tested musl at that time (version 0.9.0), I was in the middle of intense development for Fatdog 600, but I was still using 521 for daily usage. I had the complete gcc 4.6.2 from T2 package, it has the "32" directory too, but when I extracted it, musl (even the 0.9.0) still doesn't work. I think I probably need to extract the whole package. Anyway, don't worry about this, it isn't musl problem and sorry for being off-topic here, I should probably start another topic to discuss it Embarassed
_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
Ibidem

Joined: 25 May 2010
Posts: 501
Location: State of Jefferson

PostPosted: Sun 30 Jun 2013, 20:25    Post_subject: musl 0.9.11 released...  

FYI,
musl 0.9.11 is released, and there's currently a discussion of the roadmap going on.
Rich Felker wrote:
This release adds the support for the scanf %m allocation
modifier, week-number-related strftime formats, and various legacy
network-related functions. Major improvements have been made to
dynamic linker path handling and pseudo-random number generators.
Major visible bugs/regressions in scanf and mbsrtowcs have been
fixed, as well as several potentially-serious synchronization and
resource-leak bugs and x86_64-specific bugs that resulted in
crashes at startup in some C++ programs or unpredictable signal
behavior.

Download: http://www.etalabs.net/musl/releases/musl-0.9.11.tar.gz
or http://www.musl-libc.org/releases/musl-0.9.11.tar.gz


Includes ether.h (so the official version should be enough to build busybox ether-wake and such), inet_*, the scanf m modifier (malloc() enough memory for the input; needed for util-linux), supports larger dev numbers, and iconv now supports conversion to legacy formats.

The bugfixes may be nice for Fatdog64.
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 2230
Location: The Blue Marble

PostPosted: Mon 24 Mar 2014, 02:00    Post_subject:  

Musl reaches its version 1.0 milestone last week.

That's not the end though, development is still active and on-going: the team already has a roadmap for post-1.0.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 5 of 5 Posts_count   Goto page: Previous 1, 2, 3, 4, 5
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0850s ][ Queries: 13 (0.0064s) ][ GZIP on ]