diff --git a/com.oracle.truffle.r.native/fficall/src/jni/variables.c b/com.oracle.truffle.r.native/fficall/src/jni/variables.c
index 112b772298e98395b33b16a2733a8aa04a2c1a66..328b067bd7ec76b0c201480912bc57097a77b9ae 100644
--- a/com.oracle.truffle.r.native/fficall/src/jni/variables.c
+++ b/com.oracle.truffle.r.native/fficall/src/jni/variables.c
@@ -27,7 +27,7 @@
 
 #include <string.h>
 #include <jni.h>
-#include <Rinternals.h>
+#include <Rinterface.h>
 #include <rffiutils.h>
 #include <variable_defs.h>
 
diff --git a/com.oracle.truffle.r.native/fficall/src/variable_defs/variable_defs.h b/com.oracle.truffle.r.native/fficall/src/variable_defs/variable_defs.h
index fadaf488b875bda88f54b6ff862f164dff53355e..9ab6cb36a2dd04d30fd90242b6955138ab369ccf 100644
--- a/com.oracle.truffle.r.native/fficall/src/variable_defs/variable_defs.h
+++ b/com.oracle.truffle.r.native/fficall/src/variable_defs/variable_defs.h
@@ -77,7 +77,7 @@ double R_NaReal;	/* NA_REAL: IEEE */
 int R_NaInt;	/* NA_INTEGER:= INT_MIN currently */
 
 // from Defn.h
-const char* R_Home;
+char* R_Home;
 const char* R_TempDir;
 
 // Set by a down call based on the setting in the initial context
diff --git a/com.oracle.truffle.r.native/include/ed_Rinterface_gcntx b/com.oracle.truffle.r.native/include/ed_Rinterface_gcntx
index 5f085cd81fa846613522a7038891b4060c9865f7..f9cf0613c24ce9f66f6d1c864deb23a289a24224 100644
--- a/com.oracle.truffle.r.native/include/ed_Rinterface_gcntx
+++ b/com.oracle.truffle.r.native/include/ed_Rinterface_gcntx
@@ -1,6 +1,8 @@
 /R_GlobalContext/
 i
 #ifdef FASTR
+typedef void *CTXT;
+typedef void *SEXP;
 extern CTXT FASTR_GlobalContext();
 #define R_GlobalContext FASTR_GlobalContext()
 extern CTXT R_getGlobalFunctionContext();
diff --git a/com.oracle.truffle.r.native/include/ed_Rinternals b/com.oracle.truffle.r.native/include/ed_Rinternals
index 8e425c20c0d90b1ccf5ce2a71c9919c93309e58a..7aaafb1cd67144dfa7bfab280f75ba96bc8861f8 100644
--- a/com.oracle.truffle.r.native/include/ed_Rinternals
+++ b/com.oracle.truffle.r.native/include/ed_Rinternals
@@ -12,7 +12,6 @@ a
 i
 #ifdef FASTR
 typedef void *SEXP;
-typedef void *CTXT;
 #define DATAPTR(x)		R_DATAPTR(x)
 void *(R_DATAPTR)(SEXP x);
 #else
diff --git a/com.oracle.truffle.r.test.native/Makefile b/com.oracle.truffle.r.test.native/Makefile
index ab913325d1e79f024be5675d78dcbac0e828288b..1ccc6ba32be7eb9125f3d5448e28a13254655ba2 100644
--- a/com.oracle.truffle.r.test.native/Makefile
+++ b/com.oracle.truffle.r.test.native/Makefile
@@ -24,13 +24,19 @@
 .PHONY: all clean
 
 export TOPDIR = $(CURDIR)
+OSNAME := $(shell uname)
 
 all:
 	$(MAKE) -C urand
 	$(MAKE) -C packages
+ifneq ($(OSNAME), SunOS)
 	$(MAKE) -C embedded
+endif
 
 clean:
 	$(MAKE) -C urand clean
 	$(MAKE) -C packages clean
+ifneq ($(OSNAME), SunOS)
 	$(MAKE) -C embedded clean
+endif
+	
\ No newline at end of file
diff --git a/com.oracle.truffle.r.test.native/embedded/Makefile b/com.oracle.truffle.r.test.native/embedded/Makefile
index 40f99dfb2a763205016888453f9d7ac2a1df77e0..6496998f45135262c414513b3faa700580e214a6 100644
--- a/com.oracle.truffle.r.test.native/embedded/Makefile
+++ b/com.oracle.truffle.r.test.native/embedded/Makefile
@@ -25,15 +25,23 @@ ifeq ($(TOPDIR),)
     TOPDIR = $(abspath ..)
 endif
 
+NATIVE_PROJECT = $(subst test.native,native,$(TOPDIR))
+ifneq ($(MAKECMDGOALS),clean)
+include $(NATIVE_PROJECT)/platform.mk
+endif
+
 OSNAME := $(shell uname)
 
 ifeq ($(OSNAME), Linux)
   LD_FLAGS :=  -Wl,--unresolved-symbols=ignore-all
+else 
+  ifeq ($(OSNAME), SunOS)
+    LD_FLAGS := -z lazyload
+  endif
 endif
 
 FASTR_LIB_DIR = $(abspath ../../lib)
 
-NATIVE_PROJECT = $(subst test.native,native,$(TOPDIR))
 
 .PHONY: all clean
 
diff --git a/com.oracle.truffle.r.test.native/embedded/src/main.c b/com.oracle.truffle.r.test.native/embedded/src/main.c
index 5e89d7595d912d11fc3bab1babd3652497ac4112..9a01de741f8bfa562febb21098caafb6918bfad9 100644
--- a/com.oracle.truffle.r.test.native/embedded/src/main.c
+++ b/com.oracle.truffle.r.test.native/embedded/src/main.c
@@ -1,29 +1,3 @@
-/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <Rembedded.h>
-#include <R_ext/RStartup.h>
 /*
  * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -50,6 +24,7 @@
 // A simple test program for FastR embedded mode.
 // compile with "gcc -I include main.c -ldl
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <dlfcn.h>
 #include <sys/utsname.h>
@@ -57,6 +32,7 @@
 #define R_INTERFACE_PTRS 1
 #include <Rinterface.h>
 #include <Rembedded.h>
+#include <R_ext/RStartup.h>
 #include <R_ext/Rdynload.h>