Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Compiling error for android platform
Replies: 1   Last Post: Mar 13, 2013 12:33 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Frank Engels

Posts: 6
Registered: 10/6/10
Compiling error for android platform
Posted: Oct 6, 2010 2:57 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

When I try to compile a simple simulink model with the ndk-build script
I get the following error:
grt_main.c:113: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token

the code where I get the error:
extern RT_MODEL *MODEL(void);
witch parsed as :
extern RT_MODEL_hellosimulink *hellosimulink(void);

RT_MODEL_hellosimulink is defined in hellosimulink.h
as:
/* Real-time Model Data Structure */
struct RT_MODEL_hellosimulink {
const char_T *path;
const char_T *modelName;
struct SimStruct_tag * *childSfunctions;
const char_T *errorStatus;
SS_SimMode simMode;
RTWLogInfo *rtwLogInfo;
RTWExtModeInfo *extModeInfo;
RTWSolverInfo solverInfo;
RTWSolverInfo *solverInfoPtr;
void *sfcnInfo;
...
...

from witch is made a type def in hellosimulink_types.h:
/* Forward declaration for rtModel */
typedef struct RT_MODEL_hellosimulink RT_MODEL_hellosimulink;

Does any one know why I get this error, when I compile it directly for android it does not give the error but when I compile it via the ndk-build script from android it wil give the error.
perhaps I am missing some compile options:

this this is the android.mk which is used with the ndk-build script:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

MY_MODEL = hellosimulink
MY_MODULES = hellosimulink_data.c rtGetInf.c rtGetNaN.c rt_logging.c rt_nonfinite.c
MY_MAKEFILE = hellosimulink.mk
MY_MATLAB_ROOT = /media/EXTRASPACE/R2009bNamedUser
MY_ALT_MATLAB_ROOT = /media/EXTRASPACE/R2009bNamedUser
MY_MATLAB_BIN = /media/EXTRASPACE/R2009bNamedUser/bin
MY_MASTER_ANCHOR_DIR =
MY_START_DIR = /media/BIGDISK/workspace/HelloAndroid/jni
MY_S_FUNCTIONS =
MY_S_FUNCTIONS_LIB =
MY_SOLVER =
MY_NUMST = 1
MY_TID01EQ = 0
MY_NCSTATES = 0
MY_COMPUTER = GLNX86
MY_BUILDARGS = GENERATE_REPORT=0
MY_MULTITASKING = 0
MY_EXT_MODE = 0
MY_TMW_EXTMODE_TESTING = 0
MY_EXTMODE_TRANSPORT = 0
MY_EXTMODE_STATIC = 0
MY_EXTMODE_STATIC_SIZE = 1000000
MY_MEXEXT = mexglx
MY_TGT_FCN_LIB = GNU
MY_MODELREFS =
MY_SHARED_SRC =
MY_SHARED_SRC_DIR =
MY_SHARED_BIN_DIR =
MY_SHARED_LIB =
MY_TARGET_LANG_EXT = c
MY_OPTIMIZATION_FLAGS =
MY_ADDITIONAL_LDFLAGS =

#--------------------------- Model and reference models -----------------------
MY_MODELLIB = libhellosimulink.a
MY_MODELREF_LINK_LIBS =
MY_MODELREF_INC_PATH =
MY_RELATIVE_PATH_TO_ANCHOR = ..
# NONE: standalone, SIM: modelref sim, RTW: modelref rtw
MY_MODELREF_TARGET_TYPE = NONE

#-- In the case when directory name contains space ---
ifneq ($(MY_MATLAB_ROOT),$(MY_ALT_MATLAB_ROOT))
MY_MATLAB_ROOT := $(MY_ALT_MATLAB_ROOT)
endif

#--------------------------- Tool Specifications -------------------------------

include $(MY_MATLAB_ROOT)/rtw/c/tools/androidtools.mk

#------------------------------ Include Path -----------------------------------
MY_MATLAB_INCLUDES = \
$(MY_MATLAB_ROOT)/simulink/include \
$(MY_MATLAB_ROOT)/extern/include \
$(MY_MATLAB_ROOT)/rtw/c/src \
$(MY_MATLAB_ROOT)/rtw/c/src/ext_mode/common

# Additional file include paths
MY_ADD_INCLUDES = \
$(MY_START_DIR) \
#$(MY_START_DIR)/hellosimulink_rtw \


MY_SHARED_INCLUDES =
ifneq ($(MY_SHARED_SRC_DIR),)
MY_SHARED_INCLUDES = $(MY_SHARED_SRC_DIR)
endif

MY_INCLUDES = $(MY_MATLAB_INCLUDES) $(MY_ADD_INCLUDES) \
$(MY_MODELREF_INC_PATH) $(MY_SHARED_INCLUDES)
#$(MY_RELATIVE_PATH_TO_ANCHOR) $(MY_USER_INCLUDES $(MY_INSTRUMENT_INCLUDES)

#----------------------------- External mode -----------------------------------
# Uncomment -DVERBOSE to have information printed to stdout
# To add a new transport layer, see the comments in
# <matlabroot>/toolbox/simulink/simulink/extmode_transports.m
#ifeq ($(EXT_MODE),1)
# EXT_CC_OPTS = -DEXT_MODE -D$(COMPUTER) #-DVERBOSE
# EXT_LIB =
# EXT_SRC =
# LINT_EXT_COMMON_SRC =
# LINT_EXT_TCPIP_SRC =
# ifeq ($(EXTMODE_TRANSPORT),0) #tcpip
# EXT_SRC = ext_svr.c updown.c ext_work.c rtiostream_interface.c \
# rtiostream_tcpip.c
# LINT_EXT_COMMON_SRC = ext_svr.c updown.c ext_work.c \
# rtiostream_interface.c
# LINT_EXT_TCPIP_SRC = rtiostream_tcpip.c
# endif
# ifeq ($(EXTMODE_TRANSPORT),1) #serial_win32
# err:
# @echo
# @echo "### ERROR: External mode serial transport only available on win32"
# @echo
# endif
# ifeq ($(TMW_EXTMODE_TESTING),1)
# EXT_SRC += ext_test.c
# EXT_CC_OPTS += -DTMW_EXTMODE_TESTING
# endif
# ifeq ($(EXTMODE_STATIC),1)
# EXT_SRC += mem_mgr.c
# LINT_EXT_COMMON_SRC += mem_mgr.c
# EXT_CC_OPTS += -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=$(EXTMODE_STATIC_SIZE)
# endif
# ifeq ($(COMPUTER),SOL64)
# EXT_LIB = -lsocket -lnsl
# endif
#endif

#----------------------------- Real-Time Model ---------------------------------
MY_RTM_CC_OPTS = -DUSE_RTMODEL

#-------------------------------- C Flags --------------------------------------

# Optimization Options
ifndef MY_OPT_OPTS
MY_OPT_OPTS = $(MY_DEFAULT_OPT_OPTS)
endif

# General User Options
MY_OPTS =

# Compiler options, etc:
ifneq ($(MY_OPTIMIZATION_FLAGS),)
MY_CC_OPTS = $(MY_OPTS) $(MY_EXT_CC_OPTS) $(MY_RTM_CC_OPTS) $(MY_OPTIMIZATION_FLAGS)
else
MY_CC_OPTS = $(MY_OPT_OPTS) $(MY_OPTS) $(MY_EXT_CC_OPTS) $(MY_RTM_CC_OPTS)
endif


MY_CPP_REQ_DEFINES = -DMODEL=$(MY_MODEL) -DRT -DNUMST=$(MY_NUMST) \
-DTID01EQ=$(MY_TID01EQ) -DNCSTATES=$(MY_NCSTATES) -DUNIX \
-DMT=$(MY_MULTITASKING) -DHAVESTDIO

MY_CFLAGS = -std=gnu99 -pedantic $(MY_CC_OPTS) $(MY_CPP_REQ_DEFINES)
# $(ANSI_OPTS)
#$(MY_INCLUDES)
MY_CPPFLAGS = $(MY_CPP_ANSI_OPTS) $(MY_CPP_OPTS) $(MY_CC_OPTS) $(MY_CPP_REQ_DEFINES)
# $(MY_INCLUDES)

#------------------------------LIBC flags -------------------------------------

#MY_LIBCFLAGS=$(MY_CFLAGS) -DRENETRANT -fPIC
#MY_CFLAGS=$(MY_LIBCFLAGS)
#-------------------------- Additional Libraries ------------------------------

MY_SYSLIBS = $(MY_EXT_LIB) -lpthread

MY_LIBS =

MY_LIBS += $(MY_S_FUNCTIONS_LIB) $(MY_INSTRUMENT_LIBS)

#----------------------------- Source Files ------------------------------------

MY_USER_SRCS =

MY_USER_OBJS = $(addsuffix .o, $(basename $(MY_USER_SRCS)))
MY_LOCAL_USER_OBJS = $(notdir $(MY_USER_OBJS))


MY_SRCS = $(MY_MODULES) $(MY_S_FUNCTIONS)


#ifeq ($(MY_MY_MODELREF_TARGET_TYPE), NONE)
# PRODUCT = $(RELATIVE_PATH_TO_ANCHOR)/$(MODEL)
# MY_PRODUCT = $(MODEL)
# BIN_SETTING = $(LD) -shared $(LDFLAGS) $(ADDITIONAL_LDFLAGS) -o lib$(PRODUCT).so $(SYSLIBS)
# BUILD_PRODUCT_TYPE = "executable"
MY_SRCS += $(MY_MODEL).$(MY_TARGET_LANG_EXT) grt_main.c ../../../../EXTRASPACE/R2009bNamedUser/rtw/c/src/rt_sim.c $(MY_EXT_SRC) $(MY_SOLVER)
#else
# Model reference rtw target
# PRODUCT = $(MODELLIB)
# BUILD_PRODUCT_TYPE = "library"
#endif





#===================================================================

LOCAL_MODULE := hellosimulink

LOCAL_CFLAGS := -DANDROID_NDK \
-DDISABLE_IMPORTGL \
$(MY_CFLAGS)

LOCAL_SRC_FILES := $(MY_SRCS)

LOCAL_C_INCLUDES := $(MY_INCLUDES)

LOCAL_LDLIBS := -lGLESv1_CM -ldl -llog
LOCAL_STATIC_LIBRARIES := $(MY_LINK_OBJS) $(MY_SHARED_LIB) $(MY_LIBS)

include $(BUILD_SHARED_LIBRARY)




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.