I have attached an updated set of patches I used to build MoarVM. These worked on both Solaris11/x64 and on OpenBSD 5.3. They also seemed to cause no harm under Linux.
The patches were made with git format-patch, but to avoid possible corruption through the mail, I am attaching them. The subjects are: [PATCH 1/5] Remove nonportable conditional commands from Makefile.in [PATCH 2/5] Make the endianness tests more robust. [PATCH 3/5] Fix mismatched types in sprintf in src/core/exceptions.c [PATCH 4/5] Add build/setup.pm section for Solaris with Solaris cc. [PATCH 5/5] Avoid 'make -C'. Use a simple cd instead. Additional details are in the commit messages. I have not gotten nqp to build yet, but hope to get to that next time. Thanks,
>From ba949b5c8c943147b173ca8f9b324187460f1840 Mon Sep 17 00:00:00 2001 From: Andy Dougherty <dough...@lafayette.edu> Date: Thu, 22 Aug 2013 12:33:16 -0400 Subject: [PATCH 1/5] Remove nonportable conditional commands from Makefile.in Not all makes support conditional IF/ELSE/ENDIF statements. Specifically, the /usr/bin/make supplied with Solaris 11 does not. There is probably some more portable way to do what was intended, but for now I'll just get rid of the problematic lines and move on to other issues. --- build/Makefile.in | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build/Makefile.in b/build/Makefile.in index 8d0eccf..887ad67 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -10,15 +10,9 @@ NOERR = 2> @nul@ TRACING = 0 NOISY = 0 -@mkifnoisy@ MSG = @: CMD = CMDOUT = -@mkelse@ -MSG = @echo -CMD = @ -CMDOUT = > @nul@ -@mkendif@ CFLAGS = @cflags@ @ccdef@MVM_TRACING=$(TRACING) CINCLUDES = @ccinc@3rdparty/apr/include \ -- 1.7.9.2
>From 2f7c44bd565807b093fcc29dffbe0239e4aa92ea Mon Sep 17 00:00:00 2001 From: Andy Dougherty <dough...@lafayette.edu> Date: Thu, 22 Aug 2013 12:34:10 -0400 Subject: [PATCH 2/5] Make the endianness tests more robust. It should be sufficient to test whether the LITTLE_ENDIAN or BIG_ENDIAN symbols are defined. They might not necessarily be defined to a value that evaluates to true. --- build/config.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/config.h.in b/build/config.h.in index bf98d9b..d06ccaa 100644 --- a/build/config.h.in +++ b/build/config.h.in @@ -37,9 +37,9 @@ # elif __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ # error "Unsupported endianness" # endif -# elif _BIG_ENDIAN || __BIG_ENDIAN__ +# elif defined(_BIG_ENDIAN) || defined(__BIG_ENDIAN__) # define MVM_BIGENDIAN 1 -# elif !(_LITTLE_ENDIAN || __LITTLE_ENDIAN__) +# elif !(defined(_LITTLE_ENDIAN) || defined(__LITTLE_ENDIAN__)) # error "Failed to detect endianness" # endif #endif -- 1.7.9.2
>From 39a108930964237b9f19c9fd993ec47ed71f5ec7 Mon Sep 17 00:00:00 2001 From: Andy Dougherty <dough...@lafayette.edu> Date: Thu, 22 Aug 2013 12:39:12 -0400 Subject: [PATCH 3/5] Fix mismatched types in sprintf in src/core/exceptions.c MVM_string_utf8_encode returns an unsigned char pointer, but the expression is expecting a signed char pointer. gcc complains, but continues anyway. The Solaris compiler aborts. This patch casts the MVM_string_utf8_encode return to (char *), but somebody who understands the function might be better positioned to understand whether the MVM function definition itself ought to be changed instead. --- src/core/exceptions.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/exceptions.c b/src/core/exceptions.c index f5da820..98063df 100644 --- a/src/core/exceptions.c +++ b/src/core/exceptions.c @@ -206,8 +206,8 @@ char * MVM_exception_backtrace_line(MVMThreadContext *tc, MVMFrame *cur_frame, M op_name, instr, instr ? "" : "<unknown>", - name ? MVM_string_utf8_encode(tc, name, NULL) : "<anonymous frame>", - filename ? MVM_string_utf8_encode(tc, filename, NULL) : "<ephemeral file>" + name ? (char *) MVM_string_utf8_encode(tc, name, NULL) : "<anonymous frame>", + filename ? (char *) MVM_string_utf8_encode(tc, filename, NULL) : "<ephemeral file>" ); if (tmp1) @@ -421,4 +421,4 @@ void MVM_exception_throw_apr_error(MVMThreadContext *tc, apr_status_t code, cons void MVM_crash_on_error() { crash_on_error = 1; -} \ No newline at end of file +} -- 1.7.9.2
>From fb802b073bed06ab9bec2b300b7692170d74fcd8 Mon Sep 17 00:00:00 2001 From: Andy Dougherty <dough...@lafayette.edu> Date: Thu, 22 Aug 2013 12:46:00 -0400 Subject: [PATCH 4/5] Add build/setup.pm section for Solaris with Solaris cc. This adds a generic 'cc' compiler type, intended as a workable default if the user does not have gcc installed. It also adds Solaris-11 specific flags suitable for use with Solaris cc. I have not tested other Solaris versions, nor have I tested this with Solaris with gcc installed instead. --- build/setup.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/build/setup.pm b/build/setup.pm index 50eb625..61fd6fc 100755 --- a/build/setup.pm +++ b/build/setup.pm @@ -250,6 +250,26 @@ our %COMPILERS = ( noreturnspecifier => '__declspec(noreturn)', noreturnattribute => '', }, + cc => { + -toolchain => 'bsd', + + cc => 'cc', + ld => undef, + + ccmiscflags => '-D_REENTRANT -D_LARGEFILE64_SOURCE', + ccwarnflags => '', + ccoptiflags => '-O', + ccdebugflags => '-g', + ccinstflags => '', + + ldmiscflags => '', + ldoptiflags => undef, + lddebugflags => undef, + ldinstflags => undef, + + noreturnspecifier => '', + noreturnattribute => '', + }, ); # OS configuration @@ -299,6 +319,14 @@ our %FREEBSD = ( }, ); +our %SOLARIS = ( + libs => [ qw( socket sendfile nsl uuid pthread m rt ) ], + + -thirdparty => { +# uv => { %UV, objects => '$(UV_SOLARIS)' }, + }, +); + our %DARWIN = ( ldarg => '-framework %s', defs => [ '_DARWIN_USE_64_BIT_INODE=1' ], @@ -316,6 +344,7 @@ our %SYSTEMS = ( openbsd => [ qw( posix gnu gcc ), { %OPENBSD} ], netbsd => [ qw( posix gnu gcc ), { %NETBSD } ], freebsd => [ qw( posix gnu clang ), { %FREEBSD } ], + solaris => [ qw( posix bsd cc ), { %SOLARIS } ], cygwin => [ qw( posix gnu gcc ), { exe => '.exe' } ], win32 => [ qw( win32 msvc cl ), { %WIN32 } ], mingw32 => [ qw( win32 gnu gcc ), { %WIN32 } ], -- 1.7.9.2
>From 5942f269d5fd93f1ff35f4576cd66acf04fe3581 Mon Sep 17 00:00:00 2001 From: Andy Dougherty <dough...@lafayette.edu> Date: Thu, 22 Aug 2013 13:24:29 -0400 Subject: [PATCH 5/5] Avoid 'make -C'. Use a simple cd instead. Not all 'make' variants support 'make -C dir' to change directory. GNU make, FreeBSD and NetBSD make do, but Solaris make and OpenBSD make do not. This commit simply changes directory manually (and then changes back at the end for Windows, where the cd is persistent). A more portable version might do something like parrot's make_c command. --- build/setup.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/setup.pm b/build/setup.pm index 61fd6fc..5348ef6 100755 --- a/build/setup.pm +++ b/build/setup.pm @@ -14,7 +14,7 @@ our %APR = ( our %LAO = ( name => 'atomic_ops', path => '3rdparty/libatomic_ops/src', - rule => 'cd 3rdparty/libatomic_ops && CC=\'$(CC)\' CFLAGS=\'$(CFLAGS)\' ./configure @crossconf@ && $(MAKE) -C src', + rule => 'cd 3rdparty/libatomic_ops && CC=\'$(CC)\' CFLAGS=\'$(CFLAGS)\' ./configure @crossconf@ && cd src && $(MAKE) && cd ..', clean => 'cd 3rdparty/libatomic_ops/src && $(MAKE) distclean', ); -- 1.7.9.2