Alexander Nasonov's shared items

Monday, March 24, 2008

Linix built (mostly) without GCC

Linux built (mostly) without GCC

Disclaimer ========= This is work in progress. Purpose ======= To build the whole LFS 6.3 (http://www.linuxfromscratch.org/lfs/view/stable/) system without installing gcc. Only glibc and the kernel will be built with gcc. All the rest will be built with Sun Studio 12 compiler. Packaging system used is pkgsrc (http://www.pkgsrc.org) because it has a good support for SunPro. Structure ========= Most sections from Chapter 6 (Installing Basic System Software) appear in this document as well. They explain additional steps required to build a package. They also refer to a correspondent pkgsrc package. 6. Installing Basic System Software =================================== Sun Studio installation -----------------------

You need the most recent version because older versions fails to compile gcc inline asm.

export SUNWSPROBASE=/opt/sunstudioceres PATH=$SUNWSPROBASE/bin:$PATH export CC=cc export CPP='cc -E' export CXX=CC export CXXCPP='CC -E' Avoid installing complete Sun Studio distributive as it contains extra software which can be picked up by some configure script. The following command shows all symbolic links referring to the contrib directory. You can remove these links as well as contrib directory. ls -l $SUNWSPROBASE/bin |grep /contrib/ 6.4. Entering the Chroot Environment ------------------------------------ chroot "$LFS" /tools/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ CC=cc CPP='cc -E' CXX=CC CXXCPP='CC -E' \ PATH=$SUNWSPROBASE/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash --login +h Copy rtlibs to /usr/lib ----------------------- You can copy files from $SUNWSPROBASE/rtlibs to /usr/lib or other directory. In the latter case please add this directory to ld.so.conf on the next step. 6.9. Glibc-2.5.1 ---------------- If you placed rtlibs to a non-standard directory, add it to /etc/ld.so.conf. To prevent link error in security/openssh, add a link to /lib/libdl.so.2 to /usr/lib: ln -s ../../lib/libdl.so.2 /usr/lib/libdl.so.2 6.11. Binutils-2.17 -------------------

Configure picks up gcc even though SunPro C is first in the path. Rename /tools/bin/gcc and /tools/bin/cc: mv -v /tools/bin/gcc{,-away} mv -v /tools/bin/cc{,-away} Don't remove these files because they will be used later. SunPro doesn't find /tools/bin/ld. Make a symlink: ln -s /tools/bin/ld /usr/bin/ld Note: .so libraries are not installed. devel/binutils (2.17) has also no .so libraries. PLIST difference: --- LFS +++ deve/binutils - configure.info - libiberty.h - standards.info 6.12. GCC-4.1.2 --------------- Skip this step. TODO: some pkgsrc packages don't like SunPro preprocessor.

lang/gcc3-c (3.3.6). lang/gcc3-c+ (3.3.6) not available. lang/gcc34 (3.4.6nb1) fails under chroot on Knoppix host: *** Configuration i686-pc-linux-gnuaout is obsolete. *** Specify --enable-obsolete to build it anyway. *** Support will be REMOVED in the next major release of GCC, *** unless a maintainer comes forward. 6.13. Berkeley DB-4.5.20 ------------------------ CC may return 255 after a successful compilation. This causes libtool to fail. Don't check return values: --- dist/ltmain.sh.orig 2008-03-24 01:04:06.000000000 +0000 +++ dist/ltmain.sh 2008-03-24 01:05:09.000000000 +0000 @@ -926,11 +926,7 @@ $run $rm "$lobj" "$output_obj" $show "$command" - if $run eval "$command"; then : - else - test -n "$output_obj" && $run $rm $removelist - exit $EXIT_FAILURE - fi + $run eval "$command" if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then @@ -998,11 +994,7 @@ command="$command$suppress_output" $run $rm "$obj" "$output_obj" $show "$command" - if $run eval "$command"; then : - else - $run $rm $removelist - exit $EXIT_FAILURE - fi + $run eval "$command" if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then Note: .so libraries are not installed. databases/db4 (4.5.20) fails. 6.14. Sed-4.1.5 --------------- Apply patch-regcomp, patch-regexec and patch-ae from pkgsrc/textproc/gsed/patches. textproc/gsed (4.1.5). PLIST difference: --- LFS ++++ textproc/gsed - sed.html 6.15. E2fsprogs-1.40.2 ---------------------- TODO: fix it! sysutils/e2fsprogs (1.39nb2) builds fine! 6.16. Coreutils-6.9 ------------------- Some SunPro headers look like this: // File $SUNWSPROBASE/prod/include/cc/time.h: #include_next // extra stuff This causes an indefinite inclusion. It can be fixed by hardcoding paths in a cache file: cat > config.cache < gl_cv_absolute_time_h="/usr/include/time.h" gl_cv_absolute_stdio_h="/usr/include/stdio.h" gl_cv_absolute_stdlib_h="/usr/include/stdlib.h" gl_cv_absolute_string_h="/usr/include/string.h" gl_cv_absolute_unistd_h="/usr/include/unistd.h" gl_cv_absolute_wctype_h="/usr/include/wctype.h" EOF Append --cache-file=config.cache to the configure script: ./configure --prefix=/usr --cache-file config.cache sysutils/coreutils fails as well. This can be fixed in sysutils/coreutils/Makefile: .if ${OPSYS} == "Linux" && ${PKGSRC_COMPILER} == "sunpro" CONFIGURE_ENV += gl_cv_absolute_time_h="/usr/include/time.h" CONFIGURE_ENV += gl_cv_absolute_stdio_h="/usr/include/stdio.h" CONFIGURE_ENV += gl_cv_absolute_stdlib_h"=/usr/include/stdlib.h" CONFIGURE_ENV += gl_cv_absolute_string_h"=/usr/include/string.h" CONFIGURE_ENV += gl_cv_absolute_unistd_h"=/usr/include/unistd.h" CONFIGURE_ENV += gl_cv_absolute_wctype_h"=/usr/include/wctype.h" .endif 6.17. Iana-Etc-2.20 ------------------- no pkgsrc package. 6.18. M4-1.4.10 --------------- devel/m4 (1.4.10nb2). PLIST difference: pkgsrc/m4 installs examples. 6.19. Bison-2.3 --------------- devel/bison (2.3). PLIST differences: --- LFS +++ deve/bison - yacc 6.20. Ncurses-5.6 ----------------- SunPro doesn't support '-Wl,-rpath,somethig'. It should be replaced with '-rpath something' after running the configure script: sed -i 's|-Wl,-rpath,|-rpath |g' c++/Makefile devel/ncurses (5.6nb2) or devel/ncursesw (5.6nb2). 6.21. Procps-3.2.7 ------------------ TODO: explain. sed -i -e 's|$(PKG_CFLAGS)||g' Makefile sed -i -e 's|nr_objs: 0|0|' slabtop.c sed -i -e 's|__GNUC__|4|g' -e 's|__GNUC_MINOR__|1|g' ps/global.c There are gcc extensions in many places. These should be fixed: Patch 1: --- proc/devname.c 2005-01-27 03:44:53.000000000 +0000 +++ ../devname.c 2008-03-19 22:22:51.000000000 +0000 @@ -184,7 +184,7 @@ case 105: sprintf(buf, "/dev/ttyV%d", min); break; case 112: sprintf(buf, "/dev/ttyM%d", min); break; /* conflict */ /* 136 ... 143 are /dev/pts/0, /dev/pts/1, /dev/pts/2 ... */ - case 136 ... 143: sprintf(buf, "/dev/pts/%d", min+(maj-136)*256); break; + case 136: case 137: case 138: case 139: case 140: case 141: case 142: case 143: sprintf(buf, "/dev/pts/%d", min+(maj-136)*256); break; case 148: sprintf(buf, "/dev/ttyT%d", min); break; case 154: sprintf(buf, "/dev/ttySR%d", min); break; case 156: sprintf(buf, "/dev/ttySR%d", min+256); break; Patch 2: --- proc/sysinfo.c 2006-06-25 06:41:48.000000000 +0000 +++ ../sysinfo.c 2008-03-19 22:22:31.000000000 +0000 @@ -144,21 +144,21 @@ h = (unsigned)( (double)jiffies/seconds/smp_num_cpus ); /* actual values used by 2.4 kernels: 32 64 100 128 1000 1024 1200 */ switch(h){ - case 9 ... 11 : Hertz = 10; break; /* S/390 (sometimes) */ - case 18 ... 22 : Hertz = 20; break; /* user-mode Linux */ - case 30 ... 34 : Hertz = 32; break; /* ia64 emulator */ - case 48 ... 52 : Hertz = 50; break; - case 58 ... 61 : Hertz = 60; break; - case 62 ... 65 : Hertz = 64; break; /* StrongARM /Shark */ - case 95 ... 105 : Hertz = 100; break; /* normal Linux */ - case 124 ... 132 : Hertz = 128; break; /* MIPS, ARM */ - case 195 ... 204 : Hertz = 200; break; /* normal << 1 */ - case 253 ... 260 : Hertz = 256; break; - case 393 ... 408 : Hertz = 400; break; /* normal << 2 */ - case 790 ... 808 : Hertz = 800; break; /* normal << 3 */ - case 990 ... 1010 : Hertz = 1000; break; /* ARM */ - case 1015 ... 1035 : Hertz = 1024; break; /* Alpha, ia64 */ - case 1180 ... 1220 : Hertz = 1200; break; /* Alpha */ + case 9:case 10:case 11: Hertz = 10; break; /* S/390 (sometimes) */ + case 18:case 19:case 20:case 21:case 22: Hertz = 20; break; /* user-mode Linux */ + case 30:case 31:case 32:case 33:case 34: Hertz = 32; break; /* ia64 emulator */ + case 48:case 49:case 50:case 51:case 52: Hertz = 50; break; + case 58:case 59:case 60:case 61: Hertz = 60; break; + case 62:case 63:case 64:case 65: Hertz = 64; break; /* StrongARM /Shark */ + case 95:case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105: Hertz = 100; break; /* normal Linux */ + case 124:case 125:case 126:case 127:case 128:case 129:case 130:case 131:case 132: Hertz = 128; break; /* MIPS, ARM */ + case 195:case 196:case 197:case 198:case 199:case 200:case 201:case 202:case 203:case 204: Hertz = 200; break; /* normal << 1 */ + case 253:case 254:case 255:case 256:case 257:case 258:case 259:case 260: Hertz = 256; break; + case 393:case 394:case 395:case 396:case 397:case 398:case 399:case 400:case 401:case 402:case 403:case 404:case 405:case 406:case 407:case 408: Hertz = 400; break; /* normal << 2 */ + case 790:case 791:case 792:case 793:case 794:case 795:case 796:case 797:case 798:case 799:case 800:case 801:case 802:case 803:case 804:case 805:case 806:case 807:case 808: Hertz = 800; break; /* normal << 3 */ + case 990:case 991:case 992:case 993:case 994:case 995:case 996:case 997:case 998:case 999:case 1000:case 1001:case 1002:case 1003:case 1004:case 1005:case 1006:case 1007:case 1008:case 1009:case 1010: Hertz = 1000; break; /* ARM */ + case 1015:case 1016:case 1017:case 1018:case 1019:case 1020:case 1021:case 1022:case 1023:case 1024:case 1025:case 1026:case 1027:case 1028:case 1029:case 1030:case 1031:case 1032:case 1033:case 1034:case 1035: Hertz = 1024; break; /* Alpha, ia64 */ + case 1180:case 1181:case 1182:case 1183:case 1184:case 1185:case 1186:case 1187:case 1188:case 1189:case 1190:case 1191:case 1192:case 1193:case 1194:case 1195:case 1196:case 1197:case 1198:case 1199:case 1200:case 1201:case 1202:case 1203:case 1204:case 1205:case 1206:case 1207:case 1208:case 1209:case 1210:case 1211:case 1212:case 1213:case 1214:case 1215:case 1216:case 1217:case 1218:case 1219:case 1220: Hertz = 1200; break; /* Alpha */ default: #ifdef HZ Hertz = (unsigned long long)HZ; /* */ Patch 3: --- ../top.c 2008-03-19 22:38:03.000000000 +0000 +++ top.c 2008-03-19 22:57:29.000000000 +0000 @@ -664,7 +664,7 @@ switch (*sub_end) { case 0: /* no end delim, captab makes normal */ *(sub_end + 1) = '\0'; /* extend str end, then fall through */ - case 1 ... 8: + case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8: cap = Curwin->captab[(int)*sub_end]; *sub_end = '\0'; snprintf(tmp, sizeof(tmp), "%s%.*s%s", cap, room, sub_beg, Caps_off); @@ -1472,7 +1472,7 @@ switch (c) { case ' ': case '.': - case '0' ... '9': + case '0':case '1':case '2':case '3':case '4':case '5':case '6':case '7':case '8':case '9': return -15; // not supposed to have digits here // case 's': // mostly for global rcfile @@ -1552,14 +1552,8 @@ while (j < 36) { int c = *cp++ & 0xff; - switch (c) { - case '.': - case 1 ... ' ': - case 0x7f ... 0xff: - continue; // throw away junk (some of it) - default: + if(c > ' ' && c < 0x7f || c == '.' || c == 0) buf[j++] = c; // gets the '\0' too - } if (!c) break; } fprintf(fp, "%s\tfieldscur=%s\n", @@ -2295,7 +2289,7 @@ clr = *pclr; tgt = ch; break; - case '0' ... '7': + case '0':case '1':case '2':case '3':case '4':case '5':case '6':case '7': clr = ch - '0'; *pclr = clr; break; Patch 4: --- ../parser.c 2008-03-19 23:10:23.000000000 +0000 +++ ps/parser.c 2008-03-19 23:10:26.000000000 +0000 @@ -520,7 +520,7 @@ while(*++flagptr){ switch(*flagptr){ - case '0' ... '9': /* end */ + case '0':case '1':case '2':case '3':case '4':case '5':case '6':case '7':case '8':case '9': trace("0..9 Old BSD-style select by process ID\n"); arg=flagptr; err=parse_list(arg, parse_pid); No pkgsrc package. See sysutils/tload (2.0.6nb1). The package cannot be build, though: tload.o: In function `main': tload.c:(.text+0x25a): undefined reference to `loadavg' tload.c:(.text+0x5b7): undefined reference to `display_version' 6.22. Libtool-1.5.24 -------------------- Note: shared library libltdl.so is not installed. devel/libtool (1.5.24) and devel/libtool-base (1.5.24nb5). They also come with no libltdl.so and not even with libltdl.a. PLIST difference: --- LFS ++ devel/libtool-base - libltdl.a + shlibtool 6.23. Perl-5.8.8 ---------------- Note: shared library libperl.so is not installed. Other libraries may be missing as well. lang/perl (5.8.8nb6). PLIST difference: --- LFS +++ devel/perl - libperl.a + libperl.so + perllink 6.24. Readline-5.2 ------------------ devel/readline (5.2). 6.25. Zlib-1.2.3 ---------------- devel/zlib (1.2.3) 6.26. Autoconf-2.61 ------------------- devel/autoconf (2.13nb1). PLIST difference: there are some differences. 6.27. Automake-1.10 ------------------- devel/automake (1.10) 6.28. Bash-3.2 -------------- Gcc option -rdynamic should be replaced with -Bdynamic: sed -i -e 's|-rdynamic|-Bdynamic|g' configure then run the configure script as usual. shells/bash (3.2.25). PLIST difference: HTML documentation in LFS if you decided to install it. 6.29. Bzip2-1.0.4 ----------------- Remove gcc-specific options from makefiles before running make: sed -i -e 's|CC=gcc|CC=cc|' -e 's|-Wall||g' -e 's|-Winline||g' Makefile Makefile-libbz2_so archivers/bzip2 (1.0.4). PLIST difference: --- LFS ++ archivers/bzip2 - bzgrep - bzegrep - bzfgrep - bzmore - bzless - bzdiff - bzcmp 6.30. Diffutils-2.8.1 --------------------- devel/diffutils (2.8.1nb2). 6.31. File-4.21 --------------- sysutils/file (4.21). It fails with: /usr/bin/ld: libmagic.so.1: No such file: No such file or directory 6.32. Findutils-4.2.31 ---------------------- Some SunPro headers look like this: // File $SUNWSPROBASE/prod/include/cc/time.h: #include_next // extra stuff This causes an indefinite inclusion. It can be fixed by hardcoding paths in a cache file: cat > config.cache < gl_cv_absolute_time_h="/usr/include/time.h" gl_cv_absolute_stdlib_h="/usr/include/stdlib.h" gl_cv_absolute_string_h="/usr/include/string.h" gl_cv_absolute_unistd_h="/usr/include/unistd.h" gl_cv_absolute_wctype_h="/usr/include/wctype.h" EOF Append --cache-file=config.cache to the configure script: ./configure --prefix=/usr --libexecdir=/usr/lib/findutils \ --localstatedir=/var/lib/locate \ --cache-file=config.cache sysutils/findutils (4.2.31) fails as well. This can be fixed in sysutils/findutils/Makefile: .if ${OPSYS} == "Linux" && ${PKGSRC_COMPILER} == "sunpro" CONFIGURE_ENV += gl_cv_absolute_time_h="/usr/include/time.h" CONFIGURE_ENV += gl_cv_absolute_stdlib_h"=/usr/include/stdlib.h" CONFIGURE_ENV += gl_cv_absolute_string_h"=/usr/include/string.h" CONFIGURE_ENV += gl_cv_absolute_unistd_h"=/usr/include/unistd.h" CONFIGURE_ENV += gl_cv_absolute_wctype_h"=/usr/include/wctype.h" .endif 6.33. Flex-2.5.33 ----------------- SunPro reports a redefinition of alloca. Fix it: --- parse.y.orig 2008-03-23 23:00:52.000000000 +0000 +++ parse.y 2008-03-23 23:01:54.000000000 +0000 @@ -90,7 +90,6 @@ # ifdef __TURBOC__ # include # else -char *alloca (); # endif # endif # endif devel/flex (2.5.33) fails but you can add the patch above to pkgsrc local patches. 6.34. GRUB-0.97 --------------- checking whether objcopy works for absolute addresses... configure: error: cc cannot link at address 2000 TODO: fix. sysutils/grub (0.97nb8) fails as well. 6.35. Gawk-3.1.5 ---------------- lang/gawk (3.1.6). 6.36. Gettext-0.16.1 -------------------- Append two options to the configure script: --disable-openmp - avoid link error in msgmerge --without-emacs - Don't detect emacs that comes with Sun Studio ./configure --prefix=/usr --disable-openmp --without-emacs The way how pthread mutexes are used in the sources generate "too many initializers" error. Manual inspection of preprocessed sources confirmed that. The fix is merely a correction of preprocessed lines: --- ./gettext-runtime/intl/loadmsgcat.c.orig 2008-03-21 17:13:07.000000000 +0000 +++ ./gettext-runtime/intl/loadmsgcat.c 2008-03-21 17:34:48.000000000 +0000 @@ -780,7 +780,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file, struct binding *domainbinding) { - __libc_lock_define_initialized_recursive (static, lock) + static pthread_mutex_t lock = { { 0 , 0 , 0 , PTHREAD_MUTEX_RECURSIVE_NP, {0} } }; int fd = -1; size_t size; #ifdef _LIBC --- ./gettext-runtime/intl/localealias.c.orig 2008-03-21 17:37:51.000000000 +0000 +++ ./gettext-runtime/intl/localealias.c 2008-03-21 17:40:26.000000000 +0000 @@ -122,7 +122,7 @@ #endif -__libc_lock_define_initialized (static, lock) +static pthread_mutex_t lock = {0}; struct alias_map --- ./gettext-runtime/intl/dcigettext.c.orig 2008-03-21 17:42:55.000000000 +0000 +++ ./gettext-runtime/intl/dcigettext.c 2008-03-21 17:43:17.000000000 +0000 @@ -1191,7 +1191,7 @@ /* We use a bit more efficient memory handling. We allocate always larger blocks which get used over time. This is faster than many small allocations. */ - __libc_lock_define_initialized (static, lock) + static pthread_mutex_t lock = {0}; # define INITIAL_BLOCK_SIZE 4080 static unsigned char *freemem; static size_t freemem_size; --- ./gettext-runtime/intl/log.c.orig 2008-03-21 17:44:11.000000000 +0000 +++ ./gettext-runtime/intl/log.c 2008-03-21 17:44:43.000000000 +0000 @@ -57,7 +57,7 @@ static char *last_logfilename = NULL; static FILE *last_logfile = NULL; -__libc_lock_define_initialized (static, lock) +static pthread_mutex_t lock = { 0 }; static inline void _nl_log_untranslated_locked (const char *logfilename, const char *domainname,

Pkgsrc package doesn't have this problem.

devel/gettext (0.14.6) devel/gettext-m4 (0.14.6) devel/gettext-lib (0.14.6) devel/gettext-tools (0.14.6nb1) devel/gettext-asprintf (0.14.6).

6.37. Grep-2.5.1a ----------------- textproc/grep (2.5.1nb4). 6.38. Groff-1.18.1.4 -------------------- textproc/groff (1.19.2). By default, textproc/groff builds with X11 support. To disable it, add PKG_OPTIONS.groff=-x11 to mk.conf. The package can't be build because graphics/netpbm fails: /usr/bin/ld: warning: libjpeg.so.62, needed by /tmp/WRKOBJDIR/graphics/netpbm/work/.buildlink/lib/libjasper.so, not found (try using -rpath or -rpath-link) /tmp/WRKOBJDIR/graphics/netpbm/work/.buildlink/lib/libjasper.so: undefined reference to `jpeg_read_scanlines' ... 6.39. Gzip-1.3.12 ----------------- Some SunPro headers look like this: // File $SUNWSPROBASE/prod/include/cc/time.h: #include_next // extra stuff This causes an indefinite inclusion. It can be fixed by hardcoding paths in a cache file: cat > config.cache < gl_cv_absolute_time_h="/usr/include/time.h" gl_cv_absolute_stdlib_h="/usr/include/stdlib.h" gl_cv_absolute_unistd_h="/usr/include/unistd.h" EOF Append --cache-file=config.cache to the configure script: ./configure --prefix=/usr --bindir=/bin --cache-file=config.cache archivers/gzip (1.3.12nb1) fails as well. This can be fixed in archivers/gzip/Makefile: .if ${OPSYS} == "Linux" && ${PKGSRC_COMPILER} == "sunpro" CONFIGURE_ENV += gl_cv_absolute_time_h="/usr/include/time.h" CONFIGURE_ENV += gl_cv_absolute_stdlib_h="/usr/include/stdlib.h" CONFIGURE_ENV += gl_cv_absolute_unistd_h="/usr/include/unistd.h" .endif 6.40. Inetutils-1.5 ------------------- No pkgsrc package. 6.41. IPRoute2-2.6.20-070313 ---------------------------- TODO: fix. Here are some initial fixes: sed -i -e 's/gcc/cc/g' -e 's/-Wstrict-prototypes//' -e 's/-Wall//g' Makefile grep -rlw __u32 . |xargs sed -i -e 's/__u32/unsigned int/g' grep -rlw __u64 .|xargs sed -i -e 's/__u64/int_fast64_t/g' No pkgsrc package. 6.42. Kbd-1.12 -------------- TODO: fix inline asm. sed -i -e 's/^CC.*$/CC=cc/' \ -e 's/-Wall//g' \ -e 's/-Wmissing-prototypes//g' \ -e 's/-Wstrict-prototypes//g' \ src/Makefile openvt/Makefile No pkgsrc package. 6.43. Less-406 -------------- misc/less (394). 6.44. Make-3.81 --------------- devel/gmake (3.81). 6.45. Man-DB-2.4.4 ------------------ Dependency tracking in gcc is done with -M option. SunPro equivalent is -xM1. The package can't be built single-threaded because libdb is build multi-threaded. The flag -mt must be added to link flags. sed -i -e 's/$(CPP) -M $(CPPFLAGS)/$(CC) -xM1 $(CFLAGS)/' \ -e 's/^LDFLAGS =/LDFLAGS = -mt/' \ include/Defines.in The flag -mt must be added to CFLAGS as well. Unsupported -Wall is a good place: sed -i -e 's/-Wall/-mt/g' configure Append LDFLAGS=-mt to make sure that nothing is built single-threading and --disable-largefile

to fix redefinitions in glob.h when _FILE_OFFSET_BITS == 64 to the configure script: ./configure --prefix=/usr --enable-mb-groff --disable-setuid \ --disable-largefile LDFLAGS=-mt SunPro can't find a static function. Replace it with a non-static function: --- libdb/db_lookup.c.orig 2008-03-24 01:56:42.000000000 +0000 +++ libdb/db_lookup.c 2008-03-24 01:56:45.000000000 +0000 @@ -351,7 +351,7 @@ 3) Many items exist. They are all returned, in a multiple structure set. */ #ifndef FAST_BTREE -static struct mandata *dblookup (const char *page, const char *section, +struct mandata *dblookup_STATIC (const char *page, const char *section, int flags) { struct mandata *info = NULL; @@ -443,11 +443,11 @@ struct mandata *dblookup_all (const char *page, const char *section, int match_case) { - return dblookup (page, section, ALL | (match_case ? MATCH_CASE : 0)); + return dblookup_STATIC (page, section, ALL | (match_case ? MATCH_CASE : 0)); } struct mandata *dblookup_exact (const char *page, const char *section, int match_case) { - return dblookup (page, section, EXACT | (match_case ? MATCH_CASE : 0)); + return dblookup_STATIC (page, section, EXACT | (match_case ? MATCH_CASE : 0)); } No pkgsrc package. TODO: really? 6.46. Mktemp-1.5 ---------------- sysutils/mktemp (1.5). PLIST difference: --- LFS +++ sysutils/mktemp - tempfile 6.47. Module-Init-Tools-3.2.2 ----------------------------- Fix non-supported flags: sed -i -e 's/-Wall//g' tests/runtests sed -i -e 's/-static//g' Makefile.in Then last command is not correct because static insmod could not be built. TODO: build insmod.static statically. Replace gcc extentions with standard C constructs and don't use static objects as they can't be found by a linker: --- ./backwards_compat.c.orig 2008-03-21 23:37:13.000000000 +0000 +++ ./backwards_compat.c 2008-03-21 23:38:38.000000000 +0000 @@ -36,7 +36,7 @@ same. */ pid = getpid(); snprintf(ascii_pid, sizeof(ascii_pid), "%lu", (unsigned long)pid); - if (strcmp(getenv("MODULE_RECURSE") ?: "", ascii_pid) == 0) { + if (strcmp(getenv("MODULE_RECURSE") ? getenv("MODULE_RECURSE") : "", ascii_pid) == 0) { fprintf(stderr, "WARNING: %s: I am not the old version!\n", oldname); return; --- ./modprobe.c.orig 2008-03-21 23:39:57.000000000 +0000 +++ ./modprobe.c 2008-03-21 23:47:35.000000000 +0000 @@ -62,7 +62,7 @@ typedef void (*errfn_t)(const char *fmt, ...); /* Do we use syslog or stderr for messages? */ -static int log; +int log; static void message(const char *prefix, const char *fmt, va_list *arglist) { @@ -843,10 +843,10 @@ /* Don't do ANYTHING if already in kernel. */ if (!ignore_proc - && module_in_kernel(newname ?: mod->modname, NULL) == 1) { + && module_in_kernel(newname ? newname : mod->modname, NULL) == 1) { if (first_time) error("Module %s already in kernel.\n", - newname ?: mod->modname); + newname ? newname : mod->modname); goto out_unlock; } @@ -888,7 +888,7 @@ if (errno == EEXIST) { if (first_time) error("Module %s already in kernel.\n", - newname ?: mod->modname); + newname ? newname : mod->modname); goto out_unlock; } error("Error inserting %s (%s): %s\n", @@ -1223,7 +1223,7 @@ return ret; } -static const char *default_configs[] = +const char* default_configs[] = { "/etc/modprobe.conf", "/etc/modprobe.d", @@ -1363,7 +1363,7 @@ strip_modversion, cmdline_opts); } -static struct option options[] = { { "verbose", 0, NULL, 'v' }, +struct option options[] = { { "verbose", 0, NULL, 'v' }, { "version", 0, NULL, 'V' }, { "config", 1, NULL, 'C' }, { "name", 1, NULL, 'o' }, @@ -1566,7 +1566,7 @@ if (optind+1 < argc) fatal("Can't have multiple wildcards\n"); /* fprintf(stderr, "man find\n"); return 1; */ - return do_wildcard(dirname, type, argv[optind]?:"*"); + return do_wildcard(dirname, type, argv[optind]? argv[optind]:"*"); } if (type) fatal("-t only supported with -l"); --- ./depmod.c.orig 2008-03-22 00:18:16.000000000 +0000 +++ ./depmod.c 2008-03-22 00:21:15.000000000 +0000 @@ -29,8 +29,8 @@ #define MODULE_DIR "/lib/modules/" #endif -static int verbose; -static unsigned int skipchars; +int verbose; +unsigned int skipchars; void fatal(const char *fmt, ...) { @@ -73,7 +73,7 @@ char name[0]; }; -static struct symbol *symbolhash[SYMBOL_HASH_SIZE]; +struct symbol *symbolhash[SYMBOL_HASH_SIZE]; /* This is based on the hash agorithm from gdbm, via tdb */ static inline unsigned int tdb_hash(const char *name) @@ -101,7 +101,7 @@ symbolhash[hash] = new; } -static int print_unknown; +int print_unknown; struct module *find_symbol(const char *name, const char *modname, int weak) { @@ -166,7 +166,7 @@ add_symbol("_GLOBAL_OFFSET_TABLE_", NULL); } -static struct option options[] = { { "all", 0, NULL, 'a' }, +struct option options[] = { { "all", 0, NULL, 'a' }, { "quick", 0, NULL, 'A' }, { "basedir", 1, NULL, 'b' }, { "errsyms", 0, NULL, 'e' }, @@ -295,7 +295,7 @@ struct module *new; new = NOFAIL(malloc(sizeof(*new) - + strlen(dirname?:"") + 1 + strlen(filename) + 1)); + + strlen(dirname?dirname:"") + 1 + strlen(filename) + 1)); if (dirname) sprintf(new->pathname, "%s/%s", dirname, filename); else @@ -689,7 +689,7 @@ void (*func)(struct module *, FILE *); }; -static struct depfile depfiles[] = { +struct depfile depfiles[] = { { "modules.dep", output_deps }, /* This is what we check for '-A'. */ { "modules.pcimap", output_pci_table }, { "modules.usbmap", output_usb_table }, --- ./tables.c.orig 2008-03-22 00:19:30.000000000 +0000 +++ ./tables.c 2008-03-22 00:20:17.000000000 +0000 @@ -11,7 +11,8 @@ char *ext; const char *slash; - slash = strrchr(src, '/') ?: src-1; + slash = strrchr(src, '/'); + slash = slash ? slash : src-1; strcpy(dest, slash + 1); ext = strchr(dest, '.'); if (ext) --- ./modinfo.c.orig 2008-03-22 00:22:31.000000000 +0000 +++ ./modinfo.c 2008-03-22 00:23:10.000000000 +0000 @@ -22,8 +22,8 @@ #define MODULE_DIR "/lib/modules" #endif -static int elf_endian; -static int my_endian; +int elf_endian; +int my_endian; static inline void __endian(const void *src, void *dest, unsigned int size) { @@ -210,7 +210,7 @@ } } -static struct option options[] = +struct option options[] = { {"author", 0, 0, 'a'}, {"description", 0, 0, 'd'}, No pkgsrc package. 6.48. Patch-2.5.4 ----------------- devel/patch (2.5.4nb2). 6.49. Psmisc-22.5 ----------------- SunPro C doesn't understand -Wall and -dM. For the latter, use gcc-away (TODO: this is bad as it prints predefined macros for a different compiler): sed -i -e 's|cc -E -dM|/tools/bin/gcc-away -E -dM|' \ -e 's/-Wall//g' src/Makefile.in sysutils/psmisc (20.1nb1). PLIST difference: --- LFS +++ sysutils/psmisc - fuser - oldfuser - peekfd 6.50. Shadow-4.0.18.1 --------------------- Replace gcc extentions with standard C constructs: --- src/useradd.c.orig 2008-03-22 01:02:36.000000000 +0000 +++ src/useradd.c 2008-03-22 01:03:49.000000000 +0000 @@ -1572,7 +1572,8 @@ mode_t mode; if (strcasecmp (create_mail_spool, "yes") == 0) { - spool = getdef_str ("MAIL_DIR") ? : "/var/mail"; + spool = getdef_str ("MAIL_DIR"); + spool = spool ? spool : "/var/mail"; file = alloca (strlen (spool) + strlen (user_name) + 2); sprintf (file, "%s/%s", spool, user_name); fd = open (file, O_CREAT | O_WRONLY | O_TRUNC | O_EXCL, 0); Note: shared library libshadow.so.0 is not installed. No pkgsrc package. See security/libcrack (2.7nb1). 6.51. Sysklogd-1.4.1 -------------------- sed -i -e 's/gcc/cc/g' -e 's/-Wall//g' Makefile No pkgsrc package. 6.52. Sysvinit-2.86 ------------------- sed -i -e 's/gcc/cc/g' -e 's/-Wall//g' src/Makefile Replace gcc extentions with standard C constructs: --- src/bootlogd.c.orig 2008-03-22 01:27:09.000000000 +0000 +++ src/bootlogd.c 2008-03-22 01:30:09.000000000 +0000 @@ -344,13 +344,14 @@ if (line.pos >= sizeof(line.buf)) line.pos = sizeof(line.buf) - 1; break; - case 32 ... 127: - case 161 ... 255: - tmp[0] = *ptr; - tmp[1] = 0; - break; default: - sprintf(tmp, "\\%03o", *ptr); + if(*ptr >=32 && *ptr <= 127 || *ptr >= 161 && *ptr <= 255) + { + tmp[0] = *ptr; + tmp[1] = 0; + } + else + sprintf(tmp, "\\%03o", *ptr); break; } ptr++; No pkgsrc package. 6.53. Tar-1.18 -------------- archivers/gtar (1.15.1nb1). 6.54. Texinfo-4.9 ----------------- No pkgsrc package. See mk/tools/texinfo.mk. 6.55. Udev-113 -------------- No pkgsrc package. 6.56. Util-linux-2.12r ----------------------

Get rid of unrecognized flags: sed -i -e 's/-Wno-unused//g' mount/Makefile sed -i -e 's/-pipe//g' -e 's/-Wall//g' \ -e 's/-Wmissing-prototypes//g' \ -e 's/-Wstrict-prototypes//g' \ -e 's/-fomit-frame-pointer//g' \ -e 's/$(CPUHEAD)$(CPUTAIL)/-xtarget=generic/g' \ MCONFIG SunPro supports gcc inline asm: --- ./disk-utils/mkfs.minix.c.orig 2008-03-25 22:43:42.000000000 +0000 +++ ./disk-utils/mkfs.minix.c 2008-03-25 22:43:50.000000000 +0000 @@ -79,10 +79,6 @@ #define BLKGETSIZE _IO(0x12,96) /* return device size */ #endif -#ifndef __GNUC__ -#error "needs gcc for the bitop-__asm__'s" -#endif - #define MINIX_ROOT_INO 1 #define MINIX_BAD_INO 2 The functions outb and inb are defined in only for gcc because they use gcc line asm. Since SunPro supports it, these functions can be copied from : --- ./hwclock/cmos.c.orig 2008-03-25 22:48:14.000000000 +0000 +++ ./hwclock/cmos.c 2008-03-25 22:49:27.000000000 +0000 @@ -56,6 +56,22 @@ #else #include /* for inb, outb */ #endif + +static __inline void +outb (unsigned char value, unsigned short int port) +{ + __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port)); +} + +static __inline unsigned char +inb (unsigned short int port) +{ + unsigned char _v; + + __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (port)); + return _v; +}+ #elif defined(__alpha__) /* fails to compile, probably because of u8 etc */ extern unsigned int inb(unsigned long port); TODO: consider patching file. No pkgsrc package. 6.57. Vim-7.1 ------------- TODO: it's not known whether the package builds because the step has been skipped. editors/vim (7.1.175). PKGSR 2007Q4 ============ Bootstrap --------- $SUNWSPROBASE, $CC, $CPP, $CXX and $CXXCPP must be properly set. Also, you would need export NOGCCERROR=1 export PKGSRC_COMPILER=sunpro otherwise, bootstrap would pass unrecognized -Wall to SunPro or would try to download and build gcc-2.95. Configuration ------------- Add to mk.conf:

PKGSRC_COMPILER=sunpro

SUNWSPROBASE=/opt/sunstudio12

X11_TYPE=modular TOOLS_PLATFORM.find=/bin/find Fixes ----- security/openssl: Make sure that /usr/lib/libdl.so.2 exits and refers to /lib/libdl.so.2. Add this patch to local patches: --- Configure.pkgsrc 2008-01-28 23:51:17.000000000 +0000 +++ Configure 2008-01-29 00:11:10.000000000 +0000 @@ -394,6 +394,7 @@ # The intel boxes :-), It would be worth seeing if bsdi-gcc can use the # bn86-elf.o file file since it is hand tweaked assembler. "linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"linux-elf-cc","cc:-xO5 -Xa::-D_REENTRANT::-lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR::::::::::dlfcn:linux-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-pentium", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-ppro", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mcpu=pentiumpro -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "linux-k6", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -mcpu=k6 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", x11/libX11: x11/libXt: x11/libXext: configure: error: cc -E defines unix with or without -undef. I don't know what to do. As a temporary workaround, make /tools/bin/cpp available to these packages: PATH=$PATH:/tools/bin bmake To be continued ...

No comments:

Post a Comment

Post a Comment