Results 1 to 1 of 1
Hi All,
I am trying to build a executable file with libraries which are
already built with gcc (version 2.95.3-6 ) on cygwin environment.
Cygwin is set up on Windows. ...
- 01-10-2007 #1Just Joined!
- Join Date
- Dec 2006
- Posts
- 2
Undefined references to functions
Hi All,
I am trying to build a executable file with libraries which are
already built with gcc (version 2.95.3-6 ) on cygwin environment.
Cygwin is set up on Windows. Now I need to generate a executable file
on Linux using gcc compiler itself. For this I am using a makefile
which is provided here for clear information.
#----------------------------Start of makefile-----------------------------
#
# VIEW_TAG is an environment variable that must be set in the environment
# passed to the make utility (clearmake for our development).
#
# For a single view that is mapped to a drive, it must be of the form:
#
# set VIEW_TAG = y:
#
# Where,
#
# "y:" is the Windows NT drive that maps to the single view.
#
#------------------------------------------------------------------------------
SHELL = /bin/sh
VIEW_TAG =
#------------------------------------------------------------------------------
# Macros may be overridden on the command line
#------------------------------------------------------------------------------
PLATFORM = a4e4
SECURITY_LEVEL_OVERRIDE_FLAG = 0
SIMPPC_TARGET_APP_FLAG = 0
MAKEFILE = MakefileDYNGNU.mk
ENG_MODEL = Test
# Engine Model is used to build other symbols
NAME_OIL = $(ENG_MODEL)
NAME_SUBSYSTEM = $(ENG_MODEL)_bdm
DLD_SUBSYSTEM = $(ENG_MODEL)
DLD_SUBSYSTEM_LIB = ss_lib_$(PLATFORM)
DLD_SUBSYSTEM_MEMMAP_TARGET = ss_memmap_ram_$(PLATFORM)
DLD_SUBSYSTEM_MEMMAP_SIMPPC = ss_memmap_simppc_$(PLATFORM)
NAME_HCONV_OPT = $(DLD_SUBSYSTEM)
TUNE_DIR = ./
TUNE_DIR_CE = ./
TUNE_DIR_BE = ./
#-------------------------------------------------------------------------------
# Object library macros.
# Note that if PATH_LIB_OBJ isn't a relative path, then it will be required
to
PATH_LIB_OBJ = ../public
# Object Name is replaced by mkmf.pl script based on existing library
object file
NAME_LIB_OBJ = mod_lib_a4
# Define:
# - TARGET_MCU: Target Processor: PPC555
# - TARGET_OBJECT: Target object format: ELF
# - TARGET_FP: Target floating point support: None
# - TARGET_ENV: Target environment libraries: simple
TARGET_MCU = PPC555
TARGET_OBJECT = E
TARGET_FP = N
TARGET_ENV = simple
TARGET_OPTIONS = $(TARGET_MCU)$(TARGET_OBJECT)$(TARGET_FP):$(TARGET _ENV)
#-------------------------------------------------------------------------------
# Suffix rules:
# Remove default suffixes.
# Then, define custom suffixes.
# .o = objects
# .i = preprocessor output only
# .c = C files
# .s = asm files
.SUFFIXES:
.SUFFIXES: .o .c .s .pp .ss
.c.o:
@echo "Compiling $< ..."
$(CC) $(CFLAGS) -c $<
.s.o:
@echo "Assembling $< ..."
$(AS) $(AFLAGS) $<
.c.pp:
@echo "Running preprocessor only..."
$(CC) -P $(CFLAGS) -C -o $@ $<
.c.ss:
@echo "Running assembly only..."
$(CC) -S $(CFLAGS) -Xpass-source -o $@ $<
#-------------------------------------------------------------------------------
# Define compiler, assembler, and linker executable macros.
GCCPATH = "/usr"
CC = $(GCCPATH)/bin/gcc
AS = das
AR = $(GCCPATH)/bin/ar
LD = $(GCCPATH)/bin/ld
DUMPER = ddump
#--------------------------------------------------------------------------------
# CFLAGS_OPTS is for command line switches or -D definitions.
# Pre-porocessor Macro Definition "COMPILE_TOOL_DIAB" in CC_OPT used to
place desired
# variables in specified User Defined Section, locate in targeted Memory
(BBRAM)
CFLAGS_OPTS = -D _DEBUG -D __WIN32__ -D __NUTC__ -D NDEBUG \
-D SECURITY_LEVEL_OVERRIDE_FLAG=$(SECURITY_LEVEL_OVER RIDE_FLAG) \
-D SIMPPC_TARGET_APP_FLAG=$(SIMPPC_TARGET_APP_FLAG)
CFLAGS = \
-B$(GCCPATH)/bin/ -B$(GCCPATH)/lib/gcc-lib/ \
$(CFLAGS_OPTS) \
-g \
-I. \
AFLAGS = \
-g \
-t$(TARGET_OPTIONS) \
-I$(TUNE_DIR)
ARFLAGS = -ru
LDFLAGS =
DEST = .
EXTHDRS =
HDRS =
INSTALL = install
OBJS = bbram_default_config.o \
main.o
SRCS = bbram_default_config.c \
main.c
#-------------------------------------------------------------------------------
# Making executable
prog: $(OBJS) $(MAKEFILE)
$(CC) -o $(DLD_SUBSYSTEM).exe \
$(OBJS) \
/home/syam/public/lib_mode.a \
/home/syam/public/lib_pulse.a \
/home/syam/public/lib_qualify.a \
/home/syam/public/lib_rail_cntl.a \
/home/syam/public/lib_scl_sp.a \
/home/syam/public/lib_soi.a \
/home/syam/public/lib_sub_oel.a \
/home/syam/public/lib_tmr.a \
/home/syam/public/lib_vilf.a \
/home/syam/public/lib_bpu.a \
/home/syam/public/lib_beu.a \
/home/syam/public/lib_mod_ptc.a \
/home/syam/public/_rtw_c.a \
/home/syam/public/lib_cio_legacy.a \
/home/syam/public/lib_acert.a \
/home/syam/public/lib_acert_map.a \
/home/syam/public/lib_analog.a \
/home/syam/public/lib_diap.a \
/home/syam/public/lib_discrete.a \
/home/syam/public/lib_engine_emis_comb.a \
/home/syam/public/lib_fuel_sys.a \
/home/syam/public/lib_power_man.a \
/home/syam/public/libmeal_guage.a \
/home/syam/public/libmeal_bei.a \
#-------------------------------------------------------------------------------
# make Objects only
objects: $(OBJS) $(MAKEFILE)
#-------------------------------------------------------------------------------
# other targets
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# MACRO for preprocessor only.
PPO = $(OBJS:.o=.pp)
ppo: $(PPO) $(MAKEFILE)
#-------------------------------------------------------------------------------
# MACRO for assembly listings only.
SSO = $(OBJS:.o=.ss)
sso: $(SSO) $(MAKEFILE)
touch:; @echo "Touching sources..."
@touch $(SRCS)
clean:; @echo "Removing all targets..."
@rm *.o *.pp *.ss \
*.elf *.mot *.s19
clean_elf:; @echo "Removing *.elf targets..."
@rm *.elf
clean_mot:; @echo "Removing *.mot targets..."
@rm *.mot
clean_s19:; @echo "Removing *.s19 targets..."
@rm *.s19
clean_obj:; @echo "Removing *.o targets..."
@rm *.o
clean_ppo:; @echo "Removing *.pp targets..."
@rm *.pp
clean_sso:; @echo "Removing *.ss targets..."
@rm *.ss
depend:
@echo "Dependencies..." \
@echo $(HDRS) $(SRCS)
index:; @ctags -wx $(HDRS) $(SRCS)
print:; @$(PRINT) $(HDRS) $(SRCS)
tags: $(HDRS) $(SRCS)
@ctags $(HDRS) $(SRCS)
#________________________________END OF MAKEFILE __________________________
While I am trying to generate executable with this , it is giving error
msessage as
/home/syam/main.c:14: Undefined reference to 'package_init'
/home/syam/main.c:14: Undefined reference to 'package_upd'
Thsese two functions exists in the folder where I am trying to build
exectuable file. The above two functions are already existing in one of the
library. I think the problem mainly lies in linking. Could any one of you
please help me out to solve this problem.What changes do i need to do in
this make file. The same makefile works well for Windows. Thanks in
advance.
Thanks,
Syam


Reply With Quote