* program doesn't work with -O2
@ 2005-01-25 20:17 Antonio Coralles
0 siblings, 0 replies; only message in thread
From: Antonio Coralles @ 2005-01-25 20:17 UTC (permalink / raw)
To: gcc-help
I'm writing on a c++ program which I recently switched from hand written
makefiles to the gnu autotools. This was not that easy as I had
expected, as the program is about 25 000 lines. Finally it works, but
only when compiled completly without optimazation. When I try for example
make clean; make CXXFLAGS="-O2" I get hundreds of messages like this one
from the linker:
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/../../../../i686-pc-linux-gnu/bin/ld:
`.gnu.linkonce.t._ZN5boost9date_time23gregorian_calendar_baseINS0_19year_month_day_baseINS_9gregorian9greg_yearENS3_10greg_monthENS3_8greg_dayEEEmE16end_of_month_dayES4_S5_'
referenced in section `.rodata' of
interface/shiftTable/lib_shifttable.a(lib_shifttable_a-dateFields.o):
defined in discarded section
`.gnu.linkonce.t._ZN5boost9date_time23gregorian_calendar_baseINS0_19year_month_day_baseINS_9gregorian9greg_yearENS3_10greg_monthENS3_8greg_dayEEEmE16end_of_month_dayES4_S5_'
of interface/shiftTable/lib_shifttable.a(lib_shifttable_a-dateFields.o)
This messages don't appear when I compile without optimisation. Besides
the resulting exectutable is more or less useless because it contains
the strange bugs - bugs which are not there when compiled for example
with CXXFLAGS="".
Maybe someone can give me a hint what I'm doing wrong.
Here is some additional information, which may or may not be usefull:
I'm using gcc-3.3.5.
I'm using the following libraries:
1.)boost::smart_ptr - from boost-1.32.0
2.)boost::spirit - from boost-1.32.0
3.)boost::date_time - from boost-1.32.0
4.)sqlite-2.8.15
5.)gtkmm-2.4.8
My program is organized into subdirectories. A typical Makefile.am for a
sub-dir looks like this:
#################################################################################
noinst_LIBRARIES = lib_shifttable.a
lib_shifttable_a_SOURCES = \
tableField.hpp tableField.cc \
textField.hpp textField.cc \
coloredTextField.hpp coloredTextField.cc \
workerScheduleField.hpp workerScheduleField.cc \
poolScheduleField.hpp poolScheduleField.cc \
statFields.hpp statFields.cc \
dateFields.hpp dateFields.cc \
shiftTable.hpp shiftTable.cc \
shiftTableBox.hpp shiftTableBox.cc \
monthBox.hpp monthBox.cc
lib_shifttable_a_CXXFLAGS = $(GTKMM_CFLAGS)
################################################################################
Linkage is done through the following command:
*g++ -O2 -o dpm dpm-main.o dataStorage/lib_datastorage.a
utility/lib_utils.a organizer/lib_organizer.a manpower/lib_manpower.a
labourLaw/lib_labourlaw.a schedule/lib_schedule.a
helperFunctions/lib_helperfunctions.a shared/lib_shared.a
interface/mainWindow/lib_mainwindow.a interface/listView/lib_listview.a
interface/attributeWindow/lib_attributewindow.a
interface/shiftTable/lib_shifttable.a interface/misc/lib_misc.a
htmlExport/lib_htmlexport.a messageMem/lib_messagemem.a -lsqlite
-L/usr/lib -lboost_date_time -Wl,--export-dynamic -lgtkmm-2.4
-lgdkmm-2.4 -latkmm-1.6 -lgtk-x11-2.0 -lpangomm-1.4 -lglibmm-2.4
-lsigc-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0
-lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
thanks,
antonio
*
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-01-25 20:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-25 20:17 program doesn't work with -O2 Antonio Coralles
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).