Gentoo Archives: gentoo-alt

From: Michael Haubenwallner <michael.haubenwallner@×××××××.at>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] Interix issues
Date: Tue, 05 Jun 2007 07:37:36
Message-Id: 1181029245.8326.37.camel@localhost
In Reply to: [gentoo-alt] Interix issues by Ben Peddell
1 Hi Ben,
2
3 you really want to look at prefix-launcher, specifically svn-trunk[1]
4 and the wiki[2].
5 [1] http://prefix-launcher.svn.sourceforge.net/svnroot/prefix-launcher/prefix-launcher/trunk/
6 [2] http://prefix-launcher.wiki.sourceforge.net/
7
8 The released prefix-launcher-1.0 does not work for Interix, but with
9 svn-trunk, you should get more far. Within prefix-launcher, I already
10 have working coreutils, findutils, python, bash, sed and others,
11 inclusive prefix-portage-2.1.23.6381 used to bootstrap an eprefix.
12
13 For findutils, currently I completely ignore the mountlist on Interix,
14 it is not required to bootstrap an eprefix. But once, we could have that
15 patch in the tree eventually.
16
17 Using this portage, I was already able to emerge these packages:
18
19 sys-apps/sed-4.1.5
20 sys-libs/ncurses-5.5-r03.2 (with attached patch)
21 app-shells/bash-3.2_p17
22 sys-devel/m4-1.4.9
23 sys-apps/baselayout-prefix-1.12.5-r4
24 sys-apps/portage-2.1.27.6600
25
26 Currently I'm creating an external toolchain-prefix-wrapper[1] package,
27 because the source-files are too large (by definition) to be put into
28 binutils-config/files/ in the tree directly, and recent GNU-ld does not
29 work, although /opt/gcc.3.3/bin/ld is some patched "GNU ld version
30 2.13.90 20021111".
31
32 Some notes on the wiki for usage of eprefix-bootstrap on not-yet-working
33 platforms:
34 *) Use the argument '--onestage', eventually in combination with
35 '--stage=...' to have some more control over things going on.
36 *) Check out the portage-tree instead of using the snapshot, manually
37 after --stage=tree, and put it in usr/portage
38
39 And yes (although not tried myself yet), there's an interix-patch
40 available for gcc-4.2.0 (c,c++, others unknown):
41 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15212
42
43 /haubi/
44
45
46 On Tue, 2007-06-05 at 01:08 +1000, Ben Peddell wrote:
47 > I've been trying to build a gentoo installation on Interix.
48 > I've been following the instructions at
49 > http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml
50 >
51 > First issue I ran into was the bug that I mailed to grobian.
52 > ===================================================================
53 > --- bootstrap-prefix.sh.orig Mon Jun 4 00:53:50 2007
54 > +++ bootstrap-prefix.sh Mon Jun 4 01:38:15 2007
55 > @@ -523,6 +523,7 @@
56 > exit 1
57 > ;;
58 > esac
59 > + MAKE=make
60 > ;;
61 > *)
62 > eerror "Nothing known about platform `uname -s`."
63 > ===================================================================
64 >
65 > Next issue was with findutils. It couldn't determine how to get the list
66 > of mounted filesystems.
67 > I found a patch for gnulib (included in findutils) at
68 > <http://www.mail-archive.com/bug-coreutils@×××.org/msg05403.html>.
69 > I don't know whether or not it is GPL clean, as it has not been included
70 > in gnulib CVS.
71 > Even so, I have made a correction to it, and added a check in
72 > "gnulib/m4/ls-mntd-fs.m4".
73 > See "gnulib-interix.patch".
74 > I reckon that it would be good if one could enumerate all of the mounts,
75 > rather than having only one directory to scan.
76 >
77 > I am now up to trying to `emerge --oneshot sed`, but am getting "masked
78 > by: corruption". This could be due to the lacking md5sum, sha1sum, etc.
79 > On trying to build coreutils to attempt to fix this, I came upon the
80 > same problem as with findutils.
81 >
82 > I'll probably ask bug-gnulib@×××.org what happened to the patch for
83 > Interix - whether it is clean or not.
84 >
85 > I'll also get back on the progress of the install. I'll most likely have
86 > to bring Interix back to a clean slate, as I had attempted to install a
87 > non-prefix gentoo on it.
88 >
89 > Keep up the good work.
90 > plain text document attachment (gnulib-interix.patch)
91 > --- findutils-4.2.27/findutils-4.2.27/gnulib/m4/ls-mntd-fs.m4~ Mon Jun 4 21:05:21 2007
92 > +++ findutils-4.2.27/findutils-4.2.27/gnulib/m4/ls-mntd-fs.m4 Mon Jun 4 22:35:09 2007
93 > @@ -278,6 +278,32 @@
94 > fi
95 >
96 > if test -z "$ac_list_mounted_fs"; then
97 > + # INTERIX
98 > + AC_CHECK_HEADERS(dirent.h)
99 > + AC_CHECK_HEADERS(sys/statvfs.h)
100 > + AC_MSG_CHECKING([whether the system is Interix])
101 > + AC_CACHE_VAL(fu_cv_sys_mounted_interix,
102 > + [
103 > + if test $ac_cv_header_dirent_h = yes \
104 > + && test $ac_cv_header_sys_statvfs_h = yes; then
105 > + AC_TRY_CPP([#include <interix/interix.h>],
106 > + fu_cv_sys_mounted_interix=yes,
107 > + fu_cv_sys_mounted_interix=no)
108 > + else
109 > + fu_cv_sys_mounted_interix=no
110 > + fi
111 > + ])
112 > + AC_MSG_RESULT($fu_cv_sys_mounted_interix)
113 > + if test $fu_cv_sys_mounted_interix = yes; then
114 > + ac_list_mounted_fs=found
115 > + AC_DEFINE(MOUNTED_INTERIX, 1,
116 > + [Define if the system is Interix. This system has all of
117 > + the mounted filesystems, other than /, /net and /proc, under
118 > + /dev/fs. (Interix) ])
119 > + fi
120 > +fi
121 > +
122 > +if test -z "$ac_list_mounted_fs"; then
123 > # SVR2
124 > AC_MSG_CHECKING([whether it is possible to resort to fread on /etc/mnttab])
125 > AC_CACHE_VAL(fu_cv_sys_mounted_fread,
126 > --- findutils-4.2.27/findutils-4.2.27/gnulib/lib/mountlist.c~ Mon Jun 4 21:05:35 2007
127 > +++ findutils-4.2.27/findutils-4.2.27/gnulib/lib/mountlist.c Mon Jun 4 22:34:58 2007
128 > @@ -35,7 +35,9 @@
129 >
130 > #include <errno.h>
131 >
132 > -#include <fcntl.h>
133 > +#ifdef HAVE_FCNTL_H
134 > +# include <fcntl.h>
135 > +#endif
136 >
137 > #ifdef HAVE_UNISTD_H
138 > # include <unistd.h>
139 > @@ -93,6 +95,11 @@
140 > # include <dirent.h>
141 > #endif
142 >
143 > +#ifdef MOUNTED_INTERIX /* Interix */
144 > +# include <dirent.h>
145 > +# include <sys/statvfs.h>
146 > +#endif
147 > +
148 > #ifdef MOUNTED_FREAD /* SVR2. */
149 > # include <mnttab.h>
150 > #endif
151 > @@ -418,6 +425,95 @@
152 > goto free_then_fail;
153 > }
154 > #endif /* MOUNTED_GETMNT. */
155 > +
156 > +#if defined MOUNTED_INTERIX
157 > + /* Windows with Interix / Microsoft Services For UNIX */
158 > + {
159 > + /* Unlike Cygwin which attempts to implement as many of the UNIX
160 > + API's as possible Interix implements a great deal and then depends
161 > + on developers to port the rest. On Interix, the POSIX implementation
162 > + prefers to deny that UNIX style file systems exist and therefore
163 > + does not implement the mount tables for the system.
164 > +
165 > + This implementation simply scans the mounted file system directory
166 > + and then reads the statvfs data for each entry to construct the
167 > + mount list.
168 > +
169 > + The implementation also chooses to use the reentrant implementation
170 > + of readdir_r in order to favor a threading friendly system. */
171 > +
172 > + int statvfs_errno = 0;
173 > + int fail;
174 > +
175 > + DIR *dirp = opendir ("/dev/fs");
176 > + if (dirp == NULL)
177 > + {
178 > + fail = 1;
179 > + }
180 > + else
181 > + {
182 > + char file_name[9 + NAME_MAX]; /* 8 for /dev/fs/ + 1 for NUL */
183 > + int saved_errno;
184 > +
185 > + while (1)
186 > + {
187 > + struct statvfs stat_buf;
188 > + struct dirent entry;
189 > + struct dirent *result;
190 > +
191 > + fail = readdir_r (dirp, &entry, &result);
192 > +
193 > + if (fail || result == NULL)
194 > + break;
195 > +
196 > + strcpy (file_name, "/dev/fs/");
197 > + strcat (file_name, entry.d_name);
198 > +
199 > + fail = statvfs (file_name, &stat_buf);
200 > + if (fail == 0)
201 > + {
202 > + char const *Magic_mount_from_name
203 > + = "/Device/LanmanRedirector/";
204 > + me = xmalloc (sizeof *me);
205 > + me->me_devname = xstrdup (stat_buf.f_mntfromname);
206 > + me->me_mountdir = xstrdup (stat_buf.f_mntonname);
207 > + me->me_type = xstrdup (stat_buf.f_fstypename);
208 > + me->me_type_malloced = 1;
209 > + me->me_dummy = 0;
210 > + me->me_dev = stat_buf.f_fsid;
211 > + me->me_remote
212 > + = strncmp (stat_buf.f_mntfromname, Magic_mount_from_name,
213 > + strlen (Magic_mount_from_name)) == 0;
214 > +
215 > + /* Add to the linked list. */
216 > + *mtail = me;
217 > + mtail = &me->me_next;
218 > + }
219 > + else
220 > + {
221 > + statvfs_errno = errno;
222 > + }
223 > + }
224 > +
225 > + saved_errno = errno;
226 > + closedir (dirp);
227 > + errno = saved_errno;
228 > + }
229 > +
230 > + if (!fail && statvfs_errno)
231 > + {
232 > + /* In the unlikely event that opendir and each readdir
233 > + succeed, but all statvfs calls fail, ensure that we
234 > + fail with a valid errno value. */
235 > + fail = 1;
236 > + errno = statvfs_errno;
237 > + }
238 > +
239 > + if (fail)
240 > + goto free_then_fail;
241 > +
242 > + }
243 > +#endif
244 >
245 > #if defined MOUNTED_FS_STAT_DEV /* BeOS */
246 > {

Attachments

File name MIME type
ncurses-interix.patch text/x-patch