[haiku-development] Re: [PATCH] Buildutils on Solaris (was: Buildutils on powerpc)

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 09 Aug 2008 17:44:38 +0200

On 2008-08-09 at 12:54:07 [+0200], Andreas Färber <andreas.faerber@xxxxxx> 
wrote:
[...]
> I've built on this and put together a patch that gets me through to
> the creation of the x86 image (thought I'd try x86 first before I
> start with ppc). I'm not sure about each of my changes... For example,
> the makebootable resource vs. attr change (poking in the dark there,
> how would I know?). Or what was __addr_t_defined needed for? I didn't
> check whether Solaris needs stpcpy, I just got an error for strcasestr
> and took both for simplicity.
> 
> In lack of GNU regex I followed the same approach as on Cygwin,
> copying regex.h from host/cygwin/ but noticed it results in some
> warnings about definitions of malloc etc.
> 
> I really did need gawk (in the configure script awk worked but not for
> PCI from Jam), I got it for Indiana as IPSFWgawk from
> pkg.sunfreeware.com:9000.

I've applied your patch with some changes:

--- build/jam/BuildSetup        (revision 26872)
+++ build/jam/BuildSetup        (working copy)
@@ -466,7 +466,7 @@
        : linux freebsd darwin sunos cygwin ;
 
 if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
-       || $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin {
+       || $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin || 
$(HOST_PLATFORM) = sunos {

Coding style: 80 columns limit (several occurrences).


@@ -839,6 +843,7 @@
        case freebsd    : TARGET_DEFINES        += 
HAIKU_TARGET_PLATFORM_FREEBSD ;
        case darwin             : TARGET_DEFINES        += 
HAIKU_TARGET_PLATFORM_DARWIN ;
        case cygwin     : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_CYGWIN ;
+       case sunos      : TARGET_DEFINES += HAIKU_TARGET_PLATFORM_SUNOS ;
        case libbe_test : TARGET_DEFINES        += 
HAIKU_TARGET_PLATFORM_LIBBE_TEST ;
 }

Indentation. Was already incorrect for cygwin.


--- configure   (revision 26872)
+++ configure   (working copy)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # configure [ <options> ]
 
IIRC this is a no-go, since bash is not located in /bin in FreeBSD. I'd 
recommend replacing Solaris' /bin/sh with an actually POSIX compatible 
shell.


--- src/tools/fs_shell/Jamfile  (revision 26872)
+++ src/tools/fs_shell/Jamfile  (working copy)
@@ -72,4 +72,5 @@
 
 BuildPlatformMain <build>fs_shell_command
        : fs_shell_command.cpp $(fsShellCommandSources)
-       : $(HOST_LIBSTDC++) $(HOST_LIBSUPC++) ;
+       : $(HOST_LIBSTDC++) $(HOST_LIBSUPC++) $(HOST_NETWORK_LIBS) ;
+

--- src/tools/bfs_shell/Jamfile (revision 26872)
+++ src/tools/bfs_shell/Jamfile (working copy)
@@ -43,5 +43,5 @@
        kernel_interface.cpp
 
        : <build>fs_shell.a $(libHaikuCompat) $(HOST_LIBSUPC++) 
$(HOST_LIBSTDC++)
-         $(HOST_LIBROOT)
+         $(HOST_LIBROOT) $(HOST_NETWORK_LIBS)
 ;

I changed both to link against $(HOST_NETWORK_LIBS) only on BeOS 
incompatible systems.


--- src/bin/rc/rc.cpp   (revision 26872)
+++ src/bin/rc/rc.cpp   (working copy)
@@ -29,10 +29,16 @@
 #include "rdef.h"
 
 
+#ifndef HAIKU_HOST_PLATFORM_SUNOS
 extern const char *__progname;
+#endif
 
 static const char *kTitle = "Haiku Resource Compiler 1.1";
+#ifdef HAIKU_HOST_PLATFORM_SUNOS
+static const char *kProgramName = "rc";
+#else
 static const char *kProgramName = __progname;
+#endif

I've applied these changes, but don't particularly like them. #ifdef'ing 
build platform stuff in Haiku code is a bit ugly (makebootable is an 
extreme example). If there is an alternative on Solaris to get the program 
name that would be much preferred (i.e. defining __progname to that 
alternative in BeOSBuildCompatibility.h).


--- headers/build/os/storage/StorageDefs.h      (revision 26872)
+++ headers/build/os/storage/StorageDefs.h      (working copy)
@@ -20,7 +20,11 @@
 
 // Limits
 #define B_DEV_NAME_LENGTH              128
+#ifdef HAIKU_HOST_PLATFORM_SUNOS /* It should actually be determined by 
pathconf()... */
+#define B_FILE_NAME_LENGTH             MAXNAMELEN
+#else
 #define B_FILE_NAME_LENGTH             NAME_MAX
+#endif
 #define B_PATH_NAME_LENGTH             MAXPATHLEN
 #define B_ATTR_NAME_LENGTH             (B_FILE_NAME_LENGTH-1)
 #define B_MIME_TYPE_LENGTH             (B_ATTR_NAME_LENGTH - 15)

I've defined NAME_MAX in BeOSBuildCompatibility.h instead.


> What I get is this:
> 
> BuildHaikuImage1 /export/home/andreas/Haiku/haiku/generated-x86/
> haiku.image
> /export/home/andreas/Haiku/haiku/generated-x86/haiku.image
> 
> Creating image ...
> 100+0 records in
> 100+0 records out
> 104857600 bytes (105 MB) copied, 0,242203 s, 433 MB/s
> Writing boot code to "/export/home/andreas/Haiku/haiku/generated-x86/
> haiku.image" (partition offset: 0 bytes) ...
> Error: Failed to open connection to FS shell: No such file or directory
> 
> export imagePath="/export/home/andreas/Haiku/haiku/generated-x86/
> haiku.image"
> export isImage="1"
> export isVMwareImage=""
> /export/home/andreas/Haiku/haiku/build/scripts/build_haiku_image /
> export/home/andreas/Haiku/haiku/generated-x86/haiku.image-init-vars /
> export/home/andreas/Haiku/haiku/generated-x86/haiku.image-make-dirs /
> export/home/andreas/Haiku/haiku/generated-x86/haiku.image-copy-files /
> export/home/andreas/Haiku/haiku/generated-x86/haiku.image-unzip-files
> 
> ...failed BuildHaikuImage1 /export/home/andreas/Haiku/haiku/generated-
> x86/haiku.image ...
> ...removing /export/home/andreas/Haiku/haiku/generated-x86/haiku.image
> ...failed updating 1 target(s)...
> ...updated 978 target(s)...
> 
> 
> I have verified that dd works okay, creating a my.image file okay. As
> you can see, I am just creating an image file (no UserBuildConfig), so
> no special makebootable sections seemed necessary. Executing jam run
> ":<build>makebootable" my.image does write something to the file. So I
> assume the error is somewhere in fs_shell... The only change I did
> there was to link in Sun's libxnet.so to make it build.

I'd guess that initializing the image with BFS fails for some reason. Since 
no error message is produced, you'll have to add debug output along the 
initialization code path in the FS shell respectively in BFS.

CU, Ingo

Other related posts: