Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On 3 March 2012 04:59, Matthew Farkas-Dyck wrote: > Tried it; same trouble. Anyhow, it's moot, since I just applied it > with the human patch algorithm and made a new patch (find attached). Thanks applied. Anselm
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On 02/03/2012, Paul Onyschuk wrote: > It is no surprise that patching failed. I used tip version from > repository to generate diffs. Try this: > > $ hg clone http://hg.suckless.org/9base > $ cd 9base > $ patch -p0 < uclibc_dirread.patch > $ patch -p1 < fix_conflicting_declarations.patch > $ make > Tried it; same trouble. Anyhow, it's moot, since I just applied it with the human patch algorithm and made a new patch (find attached). With Paul Onyschuk's join patch, I can now build glitchlessly! Many thanks to Paul Onyschuk and Anthony Martin for all their work. Thanks to everyone else who took the time to read this, too (^_^) Cheers, strake dirread.patch Description: Binary data
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On Thu, 1 Mar 2012 20:08:52 -0500 Matthew Farkas-Dyck wrote: > > Patch failed! Please fix 9base-6-dirread.getdents.patch! > > I have two tests to write and a lab report to give in tomorrow, but > after that I shall try again. > It is no surprise that patching failed. I used tip version from repository to generate diffs. Try this: $ hg clone http://hg.suckless.org/9base $ cd 9base $ patch -p0 < uclibc_dirread.patch $ patch -p1 < fix_conflicting_declarations.patch $ make
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On 01/03/2012, Paul Onyschuk wrote: > I would like to hear from Matthew Farkas-Dyck, if with those patches he > can compile working 9base in his setup. > I cannot: $ make ... >>> 9base 6 Extracting gzip -d -c /home/strake/buildroot-2011.11/dl/9base-6.tar.gz | tar --strip-components=1 -C /home/strake/buildroot-2011.11/output/build/9base-6 -xf - >>> 9base 6 Patching package//9base Applying 9base-6-dirfwstat.patch using plaintext: patching file lib9/dirfwstat.c Applying 9base-6-dirread.getdents.patch using plaintext: patching file lib9/dirread.c patch: malformed patch at line 27: @@ -18,6 +34,7 @@ Patch failed! Please fix 9base-6-dirread.getdents.patch! make: *** [/home/strake/buildroot-2011.11/output/build/9base-6/.stamp_patched] Error 1 $ This is Paul Onyschuk's patch. I tried to hack it a bit to make it work, alas, in vain, so far. Find latest patches, as I have them, attached. I had the same trouble with the original patch. I have two tests to write and a lab report to give in tomorrow, but after that I shall try again. Cheers, strake 9base-6-dirfwstat.patch Description: Binary data 9base-6-dirread.getdents.patch Description: Binary data 9base-6-rc,sam.mk.link_order.patch Description: Binary data 9base-6-yacc.mk.link_order.patch Description: Binary data
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On Wed, 29 Feb 2012 20:52:50 +0100 Anselm R Garbe wrote: > > Thanks, applied. > Great, so only issues left are conflicting declarations in join case and missing getdirentries. In first case, the problem is that time.h is included in longer chain: stdio.h -> bits/uClibc_stdio.h -> bits/uClibc_mutex.h -> pthread.h -> time.h. You can find fix_conflicting_declarations.patch in attachments. I avoided using ifdef soup and opted for simplest solution. I moved "#include libc.h" behind "#include stdio.h" in join.c and added some "undefs" to libc.h. As for getdirentries I cleaned up my previous patch, check uclibc_dirread.patch in attachments. Still it isn't my call if this patch should be applied or not. I provided some "#warning" for this case, informing that direct syscall is used. I would like to hear from Matthew Farkas-Dyck, if with those patches he can compile working 9base in his setup. fix_conflicting_declarations.patch Description: Binary data uclibc_dirread.patch Description: Binary data
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On 29 February 2012 02:09, Paul Onyschuk wrote: > Same goes for rc/Makefile and sam/Makefile (move -lm flag to the end). > > Also uClibc doesn't provide futimes, so we need to use futimesat() in > lib9/dirfwstat.c (patch is attached). Thanks, applied. Cheers, Anselm
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On Tue, 28 Feb 2012 18:51:39 +0100 Anselm R Garbe wrote: > > > The link order in yacc.mk is wrong. > > Try building with this patch. > Same goes for rc/Makefile and sam/Makefile (move -lm flag to the end). Also uClibc doesn't provide futimes, so we need to use futimesat() in lib9/dirfwstat.c (patch is attached). After that (and earlier fixes) everything builds nicely, whole 9base linked against uClibc is ~5.5MB. dirfwstat.patch Description: Binary data
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
One line was wrapped in my patch from previous message. Just fix this by hand - this should be single line: > + > extern int _p9dir(struct stat*, struct stat*, char*, Dir*, char**, > char*); As for join command, problem was related to conflicting declarations - system time.h (which was included in longer chain by stdio.h) vs 9base libc.h. I fixed that by moving stdio.h inclusion in join.c to the top of the file and undefining some things like this: #include #undef gmtime #undef localtime #undef asctime #undef ctime Maybe it would be better to fix that in libc.h and move inclusion of libc.h after stdio.h in join.c? Something like this in libc.h: #ifndef NOPLAN9DEFINES # ifdef gmtime # undef gmtime # endif #define gmtime p9gmtime
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On 28/02/2012, Anselm R Garbe wrote: > On 27 February 2012 02:30, Anthony Martin wrote: >> The link order in yacc.mk is wrong. >> Try building with this patch. > > Thanks, applied. > > As for the getdirentries() function, I would suggest adding ifdef's > for the BSDs if needed (see the old Matthias Teege thread on 9fans). ...and Linux, on which my trouble was had, which I forgot to tell. > Cheers, > Anselm > > Cheers, strake
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
uClibc doesn't provide wrappers for getdents() syscall either. The proper solution would be to use readdir()/scandir() instead I guess. Till then people interested can use this ad-hoc patch, which uses getdents() syscall directly. It shouldn't be applied to main repository I think. Also join has some issues, I removed its entry from Makefile just to check if ls/du commands works. --- lib9/dirread.c.orig 2012-02-28 23:09:24.0 +0100 +++ lib9/dirread.c 2012-02-28 23:22:48.0 +0100 @@ -4,9 +4,25 @@ #include #include +#if defined(__UCLIBC__) +# include +# if defined(__USE_LARGEFILE64) +# define getdents SYS_getdents64 +# else +# define getdents SYS_getdents +# endif +#endif + extern int _p9dir(struct stat*, struct stat*, char*, Dir*, char**, char*); #if defined(__linux__) +# if defined(__UCLIBC__) +static int +mygetdents(int fd, struct dirent *buf, int n) +{ + return syscall(getdents, fd, (void*)buf, n); +} +# else static int mygetdents(int fd, struct dirent *buf, int n) { @@ -18,6 +34,7 @@ mygetdents(int fd, struct dirent *buf, i nn = getdirentries(fd, (void*)buf, n, &off); return nn; } +# endif #elif defined(__APPLE__) || defined(__FreeBSD__) static int mygetdents(int fd, struct dirent *buf, int n)
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On 27 February 2012 02:30, Anthony Martin wrote: > The link order in yacc.mk is wrong. > Try building with this patch. Thanks, applied. As for the getdirentries() function, I would suggest adding ifdef's for the BSDs if needed (see the old Matthias Teege thread on 9fans). Cheers, Anselm
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
2012/2/28 Matthew Farkas-Dyck : > I agree. A quick search yielded this: http://9fans.net/archive/2006/06/463 > Not sure where the patch is, though. > http://groups.google.com/group/comp.os.plan9/browse_thread/thread/f0db71974854590f/ac36ad084329a733#ac36ad084329a733 It won't solve your problem, though. -- - yiyus || JGL .
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On 27/02/2012, Paul Onyschuk wrote: > I didn't drink my coffee yet, so my head isn't straight yet. I tried > to build 9base/plan9port/9vx with uClibc year or two ago (without > success). Those errors looks familiar, but my memory isn't fresh. I hope that the coffee is. > AFAIK uClibc doesn't provide getdirentries(), which is used by lib9/dirread.c. Ah, true. $ nm uClibc-0.9.32/lib/* | grep getdir getdirname.os: $ > As for error with getdirentries64, just look at /usr/include/dirent.h: > > # define getdirentries getdirentries64 > > I think I fixed that by providing own version of getdirentries(), but > hit later other issues. > > Still it would be nice to fix this once and for all, because plan9port > and 9vx has same issues (I don't think that this got fixed). I agree. A quick search yielded this: http://9fans.net/archive/2006/06/463 Not sure where the patch is, though. Cheers, strake
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On Sun, 26 Feb 2012 23:24:57 -0500 Matthew Farkas-Dyck wrote: > > Unfortunately, now linkage fails later. Solution might be quite plain; > I shall try to further diagnose when I have the time. > I didn't drink my coffee yet, so my head isn't straight yet. I tried to build 9base/plan9port/9vx with uClibc year or two ago (without success). Those errors looks familiar, but my memory isn't fresh. AFAIK uClibc doesn't provide getdirentries(), which is used by lib9/dirread.c. As for error with getdirentries64, just look at /usr/include/dirent.h: # define getdirentries getdirentries64 I think I fixed that by providing own version of getdirentries(), but hit later other issues. Still it would be nice to fix this once and for all, because plan9port and 9vx has same issues (I don't think that this got fixed).
Re: [dev] Re: [9base] Failure to link against uClibc: undefined references
On 26/02/2012, Anthony Martin wrote: > The link order in yacc.mk is wrong. > Try building with this patch. Problem solved. Many thanks. Unfortunately, now linkage fails later. Solution might be quite plain; I shall try to further diagnose when I have the time. Failure mode: make[2]: Entering directory `/home/strake/buildroot-2011.11/output/build/9base-6/du' CC du.c LD du ../lib9/lib9.a(dirread.o): In function `mygetdents': dirread.c:(.text+0x3a): undefined reference to `getdirentries64' collect2: ld returned 1 exit status make[2]: *** [du] Error 1 make[2]: Leaving directory `/home/strake/buildroot-2011.11/output/build/9base-6/du' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/strake/buildroot-2011.11/output/build/9base-6' make: *** [/home/strake/buildroot-2011.11/output/build/9base-6/.stamp_built] Error 2 Thanks again. Cheers, strake