Click here to Skip to main content
15,888,113 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OT Just curious... Pin
jeron126-Sep-12 12:15
jeron126-Sep-12 12:15 
Questionproblem deploying application Pin
appollosputnik25-Sep-12 8:40
appollosputnik25-Sep-12 8:40 
AnswerRe: problem deploying application Pin
Chris Meech25-Sep-12 9:00
Chris Meech25-Sep-12 9:00 
GeneralRe: problem deploying application Pin
appollosputnik25-Sep-12 21:28
appollosputnik25-Sep-12 21:28 
GeneralRe: problem deploying application Pin
Richard MacCutchan25-Sep-12 22:00
mveRichard MacCutchan25-Sep-12 22:00 
GeneralRe: problem deploying application Pin
appollosputnik26-Sep-12 21:02
appollosputnik26-Sep-12 21:02 
GeneralRe: problem deploying application Pin
Richard MacCutchan26-Sep-12 21:29
mveRichard MacCutchan26-Sep-12 21:29 
Questionexceptions always SIGABRT in linux shared object Pin
MichaelRoop25-Sep-12 1:28
MichaelRoop25-Sep-12 1:28 
I have built a unit tester in C++. Compiles and runs under VS and linux (Ubuntu 10). (I know, there are others out there. Spare time project of mine over the years)

I just finished the port to Linux. However, if I throw an exception anywhere, within the shared object that contains the test case it will signal SIGABRT. All my searching has not revealed an answer. I figure there is something messed up in the compile switches.

I reduced it to a very simple occurence
void UTL_STR_RTRIM_1() {  
   try {
      int x = 99;
      throw x;
   }
   catch (int i) {
       mr_cout << L("Caught int within test case ") << i << std::endl;

    }
    catch (...) {
        mr_cout << L("Caught ... within test case ") << std::endl;
       }
    TEST_EQUAL(this, mr_utils::mr_string(L("This is a str")), mr_utils::TrimRight(L("This is a str  \t\n\r\0")));
}


So even, throwing and catching and int (tried it with other types and exceptions) will cause SIGABRT

Here is my make file for the shared object that is loaded (with above code) followed by makefile of executable that loads the shared object of test cases. Any ideas?
#
# 'make depend' uses makedepend to automatically generate dependencies 
#               (dependencies are added to end of Makefile)
# 'make'        build static lib 'libutils.a'
# 'make clean'  removes all .o and static lib files
#

# define the C compiler to use
CC = gcc

# define any compile-time flags
CFLAGS = -c
CFLAGS = -g
CFLAGS += -fPIC
CFLAGS += -fno-stack-protector

# define any directories containing header files other than /usr/include
INCLUDES =-Iinclude
INCLUDES +=-ICppTestCaseTests
INCLUDES +=-I../CppTestUtils/include
INCLUDES +=-I../CppTest/include

#INCLUDES +=-ICore/include
#INCLUDES +=-IDlls/include

#INCLUDES +=-IExceptions/include
#INCLUDES +=-IFactories/include
#INCLUDES +=-ILogging/include
#INCLUDES +=-IOutputs/include
#INCLUDES +=-IScriptReader/include



# define library paths in addition to /usr/lib
#   specify path using -Lpath, something like:
#LFLAGS = -L/home/newhall/lib  -L../lib

# define the CPP source files
SRCS = \
	source/dllmain.cpp							\



# define the CPP object files 
#
# This uses Suffix Replacement within a macro:
#   $(name:string1=string2)
#         For each word in 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .cpp of all words in the macro SRCS
# with the .o suffix
OBJS = $(SRCS:.cpp=.o)

# folder for lib file.
LIBDIR = lib

# define the shared object file
UTILLIB = $(LIBDIR)/libmr_testTestCases.so


DEFINES+=-DMR_USE_WIDE_STR
DEFINES+=-DDEBUG

# User defined function for compile to make for each compact. 
do-compile=$(CC) $(DEFINES) $(CFLAGS) $(INCLUDES) -c $1.cpp -o $1.o > stderr

#do-compile=$(CC) $(DEFINES) $(CFLAGS) $(INCLUDES) -c $1.cpp -o $1.o > stderr



# The following part of the makefile is generic; it can be used to 
# build any static lib just by changing the definitions above and by
# deleting dependencies appended to the file from 'make depend'
.PHONY: depend clean

all: $(UTILLIB)
	@echo  Simple compiler named libmrtest.so has been compiled


# rule to archive all of the object files into the static lib
# chains to the OBJS macro which calls the .cpp.o to do the compilation first.
# For some reason gcc does not send out text to stdout of stderr.  Must echo
# it
$(UTILLIB): $(SRCS) 
	
	mkdir -p $(LIBDIR)

	@echo ------------------------------------------------------------
	@echo Compiling object files.
	$(foreach i,$(SRCS:.cpp=),$(shell $(call do-compile,$i) ))
	@echo ------------------------------------------------------------
	
	
	#@echo ------------------------------------------------------------
	#@echo Creating lib
	#$(AR) $(ARFLAGS) $@ $(OBJS)
	#@echo ------------------------------------------------------------

	@echo ------------------------------------------------------------
	@echo Creating Shared Object
	ld -shared -soname $@ -o $@ $(OBJS)

#	$(CC) -shared -W1,-soname $@ -o $@ -fPIC $(SRCS)

#	ld -shared -init __nonWinCutTestCaseRegistrationMethod__ -soname $@ -o $@ $(OBJS)

#	$(CC) -Wall -shared -fPIC -W1,soname $@ -o $@ $(INCLUDES) $(SRCS)

#	$(CC) -shared -W1,-soname,$@ -o $@ $(OBJS)
#	$(CC) -Wall -shared -fPIC -W1,-soname,$@ -o $@ $(OBJS)

#this one may actually call the attr constructor on dll. but undefined symbols found
#	$(CC) -Wall -shared -fPIC -o $@ $(INCLUDES) $(SRCS)


	@echo ------------------------------------------------------------


#	ld -shared -soname $@ -o $@ /usr/lib/gcc/i686-linux-gnu/4.6.3/libgcc_s.so -lc -fno-stack-protector $(OBJS)
#	ld -shared -fno-stack-protector -soname $@ -o $@  $(OBJS)
#ld -shared -lc -fno-stack-protector -soname $@ -o $@  $(OBJS)


# TODO - lookup what the no-stack-protector might be doing

# this is a suffix replacement rule for building .o's from .cpp's
# it uses automatic variables $<: the name of the prerequisite of
# the rule(a .cpp file) and $@: the name of the target of the rule (a .o file) 
# (see the gnu make manual section about automatic variables)
#.cpp.o:
#	$(CC) $(CFLAGS) $(INCLUDES) -c $<  -o $@

clean:
	@echo ------------------------------------------------------------
	@echo Cleaning House
	@echo ------------------------------------------------------------
	$(RM) $(UTILLIB)
	$(RM) $(OBJS)


depend: $(SRCS)
	makedepend $(INCLUDES) $^

# DO NOT DELETE THIS LINE -- make depend needs it


Executable make file
#
# 'make depend' uses makedepend to automatically generate dependencies 
#               (dependencies are added to end of Makefile)
# 'make'        build static lib 'libutils.a'
# 'make clean'  removes all .o and static lib files
#

# define the C compiler to use
CC = gcc

# define any compile-time flags
CFLAGS = -c
CFLAGS = -g
CFLAGS += -fPIC
CFLAGS += -fno-stack-protector

# define any directories containing header files other than /usr/include
INCLUDES +=-I../CppTestUtils/include
INCLUDES +=-I../CppTest/include
INCLUDES +=-I../CppTest/Core/include


# define library paths in addition to /usr/lib
#   specify path using -Lpath, something like:
#LFLAGS = -L/home/newhall/lib  -L../lib

# define the CPP source files
SRCS = \
	source/CppTestDevConsole.cpp							\



# define the CPP object files 
#
# This uses Suffix Replacement within a macro:
#   $(name:string1=string2)
#         For each word in 'name' replace 'string1' with 'string2'
# Below we are replacing the suffix .cpp of all words in the macro SRCS
# with the .o suffix
OBJS = $(SRCS:.cpp=.o)

# folder for lib file.
LIBDIR = lib

# define the shared object file
UTILLIB = $(LIBDIR)/cutConsoleRunner

# the libs from the other Cut so
#LIBS+=-lstdc++
#LIBS+=-lcut_utils
#LIBS+=-ldl
#LIBS+=-lcut_test


LIBS+=-lcut_test
LIBS+=-lcut_utils
LIBS+=-ldl
LIBS+=-lstdc++




#until I can get groups and rights setup
#LIBDIRS+=-L/home/michael/opt/cut_test/lib
#LIBDIRS+=-L/usr/lib/gcc/i686-linux-gnu/4.6.3
LIBDIRS+=-L/usr/lib/gcc/i686-linux-gnu/4.6.3/
LIBDIRS+=-L/opt/cut_test/lib/




DEFINES+=-DMR_USE_WIDE_STR
DEFINES+=-DDEBUG

# User defined function for compile to make for each compact. 
do-compile=$(CC) $(DEFINES) $(CFLAGS) $(INCLUDES) -c $1.cpp -o $1.o > stderr

#do-compile=$(CC) $(DEFINES) $(CFLAGS) $(INCLUDES) -c $1.cpp -o $1.o > stderr


# The following part of the makefile is generic; it can be used to 
# build any static lib just by changing the definitions above and by
# deleting dependencies appended to the file from 'make depend'
.PHONY: depend clean

all: $(UTILLIB)
	@echo  Simple compiler named ConsoleRunner has been compiled


# rule to archive all of the object files into the static lib
# chains to the OBJS macro which calls the .cpp.o to do the compilation first.
# For some reason gcc does not send out text to stdout of stderr.  Must echo
# it
$(UTILLIB): $(SRCS) 
	
	mkdir -p $(LIBDIR)

	@echo ------------------------------------------------------------
	@echo Compiling object files.
	$(foreach i,$(SRCS:.cpp=),$(shell $(call do-compile,$i) ))
	@echo ------------------------------------------------------------

	@echo ------------------------------------------------------------
	@echo Objects $(OBJS)
	@echo Libs $(LIBS)
	@echo ------------------------------------------------------------

	@echo ------------------------------------------------------------
	@echo Linking into executable
#	ld -o $@ $(OBJS) $(LIBDIRS) $(LIBS)

#	ld -export-dynamic  $(OBJS) $(LIBDIRS) $(LIBS) -o $@

#	$(CC) -o $@ $(OBJS) $(LIBDIRS) $(LIBS)
#	$(CC) $(OBJS) $(LIBDIRS) $(LIBS) -o $@
	$(CC) -export-dynamic  $(OBJS) $(LIBDIRS) $(LIBS) -o $@



	@echo ------------------------------------------------------------


#$(LDFLAGS) $(CUT_LIBS)


#	@echo ------------------------------------------------------------
#	@echo Creating Shared Object
#	ld -shared -soname $@ -o $@ $(OBJS)
#	@echo ------------------------------------------------------------


#	ld -shared -soname $@ -o $@ /usr/lib/gcc/i686-linux-gnu/4.6.3/libgcc_s.so -lc -fno-stack-protector $(OBJS)
#	ld -shared -fno-stack-protector -soname $@ -o $@  $(OBJS)
#ld -shared -lc -fno-stack-protector -soname $@ -o $@  $(OBJS)


# TODO - lookup what the no-stack-protector might be doing

# this is a suffix replacement rule for building .o's from .cpp's
# it uses automatic variables $<: the name of the prerequisite of
# the rule(a .cpp file) and $@: the name of the target of the rule (a .o file) 
# (see the gnu make manual section about automatic variables)
#.cpp.o:
#	$(CC) $(CFLAGS) $(INCLUDES) -c $<  -o $@

clean:
	@echo ------------------------------------------------------------
	@echo Cleaning House
	@echo ------------------------------------------------------------
	$(RM) $(UTILLIB)
	$(RM) $(OBJS)


depend: $(SRCS)
	makedepend $(INCLUDES) $^

# DO NOT DELETE THIS LINE -- make depend needs it

AnswerRe: exceptions always SIGABRT in linux shared object Pin
Richard MacCutchan25-Sep-12 6:04
mveRichard MacCutchan25-Sep-12 6:04 
GeneralRe: exceptions always SIGABRT in linux shared object Pin
MichaelRoop25-Sep-12 11:02
MichaelRoop25-Sep-12 11:02 
GeneralRe: exceptions always SIGABRT in linux shared object Pin
MichaelRoop25-Sep-12 13:45
MichaelRoop25-Sep-12 13:45 
QuestionCppunit in Visual studio 2010 Pin
Rahul from Poona24-Sep-12 4:44
Rahul from Poona24-Sep-12 4:44 
AnswerRe: Cppunit in Visual studio 2010 Pin
Chris Meech24-Sep-12 5:56
Chris Meech24-Sep-12 5:56 
AnswerRe: Cppunit in Visual studio 2010 Pin
Albert Holguin24-Sep-12 6:43
professionalAlbert Holguin24-Sep-12 6:43 
AnswerRe: Cppunit in Visual studio 2010 Pin
jschell24-Sep-12 12:39
jschell24-Sep-12 12:39 
QuestionLate Binding Concept Pin
AmbiguousName23-Sep-12 20:30
AmbiguousName23-Sep-12 20:30 
AnswerRe: Late Binding Concept Pin
CPallini23-Sep-12 22:27
mveCPallini23-Sep-12 22:27 
AnswerRe: Late Binding Concept Pin
Richard MacCutchan23-Sep-12 23:05
mveRichard MacCutchan23-Sep-12 23:05 
QuestionRe: Late Binding Concept Pin
CPallini23-Sep-12 23:58
mveCPallini23-Sep-12 23:58 
AnswerRe: Late Binding Concept Pin
Richard MacCutchan24-Sep-12 0:11
mveRichard MacCutchan24-Sep-12 0:11 
AnswerRe: Late Binding Concept Pin
Richard MacCutchan23-Sep-12 23:09
mveRichard MacCutchan23-Sep-12 23:09 
AnswerRe: Late Binding Concept PinPopular
pasztorpisti24-Sep-12 1:09
pasztorpisti24-Sep-12 1:09 
GeneralRe: Late Binding Concept Pin
CPallini24-Sep-12 1:41
mveCPallini24-Sep-12 1:41 
GeneralRe: Late Binding Concept Pin
pasztorpisti24-Sep-12 1:46
pasztorpisti24-Sep-12 1:46 
GeneralRe: Late Binding Concept Pin
Chris Meech24-Sep-12 2:19
Chris Meech24-Sep-12 2:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.