Compiling 2.2.2 in Fedora 12

For developers writing C++, Fortran, Java, code who have questions or comments to make.

Moderators: silvia, selimgunay, Moderators

sb1966
Posts: 151
Joined: Wed Jul 23, 2008 8:08 am
Location: NERIST, INDIA
Contact:

Compiling 2.2.2 in Fedora 12

Post by sb1966 »

Dear All,
I was trying to compile OpenSees 2.2.2 in Fedora 12. I have installed Tcl 8.5.9, Tk 8.5.9, blitz from Fedora repository and g++ with compatibility with c++ 2.96. The version of gcc is 4.4.4. I got the following error messeage:
===============================
tkMain.cpp:112: error: new declaration ‘char* strrchr(const char*, int)’
/usr/include/string.h:253: error: ambiguates old declaration ‘const char* strrchr(const char*, int)’
tkMain.cpp: In function ‘void Tk_MainOpenSees(int, char**, int (*)(Tcl_Interp*), Tcl_Interp*)’:
tkMain.cpp:308: warning: deprecated conversion from string constant to ‘char*’
tkMain.cpp:325: warning: deprecated conversion from string constant to ‘char*’
make[2]: *** [tkMain.o] Error 1
make[2]: Leaving directory `/usr/local/OpenSees/SRC/tcl'
==================================
I am pasting my Makefile.def below
===================================
#######################################################################
#####
#
# Program: OpenSees
#
# Purpose: A Top-level Makefile to create the libraries needed
# to use the OpenSees framework. Works on Linux version 6.1
# and below.
#
# Written: fmk
# Modified:sukumar
# Date: 17/11/2010 for Fedora 12
#
# Send bug reports, comments or suggestions to fmckenna@ce.berkeley.edu
#
#######################################################################
#####
# %---------------------------------%
# | SECTION 1: PROGRAM |
# %---------------------------------%
#
# Specify the location and name of the OpenSees interpreter program
# that will be created (if this all works!)
OpenSees_PROGRAM = $(HOME)/bin/OpenSees
OPERATING_SYSTEM = LINUX
GRAPHICS = UsingOpenGL
PROGRAMMING_MODE = SEQUENTIAL
DEBUG_MODE = NO_DEBUG
RELIABILITY = NO_RELIABILITY
# %---------------------------------%
# | SECTION 2: PATHS |
# %---------------------------------%
#
# Note: if vendor supplied BLAS and LAPACK libraries or if you have
# any of the libraries already leave the directory location blank AND
# remove the directory from DIRS.
#BASE = /usr/local
BASE = /usr/bin
#HOME = /home/sukumar
HOME = /usr/local
#LIB = /usr/lib
FE = $(HOME)/OpenSees/SRC
BLASdir = $(HOME)/OpenSees/OTHER/BLAS
CBLASdir = $(HOME)/OpenSees/OTHER/CBLAS
LAPACKdir = $(HOME)/OpenSees/OTHER/LAPACK
SUPERLUdir = $(HOME)/OpenSees/OTHER/SuperLU_3.0/SRC
ARPACKdir = $(HOME)/OpenSees/OTHER/ARPACK
UMFPACKdir = $(HOME)/OpenSees/OTHER/UMFPACK
METISdir = $(HOME)/OpenSees/OTHER/METIS
SRCdir = $(HOME)/OpenSees/SRC
DIRS = $(BLASdir) $(CBLASdir) $(LAPACKdir) \
$(SUPERLUdir) $(ARPACKdir) $(UMFPACKdir) $(SRCdir) $(METISdir)
# %-------------------------------------------------------%
# | SECTION 3: LIBRARIES |
# | |
# | The following section defines the libraries that will |
# | be created and/or linked with when the libraries are |
# | being created or linked with. |
# %-------------------------------------------------------%
#
# Note: if vendor supplied BLAS and LAPACK libraries leave the
# libraries blank. You have to get your own copy of the tcl/tk
# library!!
#
# Note: For libraries that will be created (any in DIRS above)
# make sure the directory exsists where you want the library to go!
FE_LIBRARY = $(HOME)/lib/libOpenSees.a
NDARRAY_LIBRARY = $(HOME)/lib/libndarray.a # BJ_UCD jeremic@ucdavis.edu
MATMOD_LIBRARY = $(HOME)/lib/libmatmod.a # BJ_UCD jeremic@ucdavis.edu
BJMISC_LIBRARY = $(HOME)/lib/libBJmisc.a # BJ_UCD jeremic@ucdavis.edu
LAPACK_LIBRARY = $(HOME)/lib/libLapack.a
BLAS_LIBRARY = $(HOME)/lib/libBlas.a
SUPERLU_LIBRARY = $(HOME)/lib/libSuperLU.a
CBLAS_LIBRARY = $(HOME)/lib/libCBlas.a
ARPACK_LIBRARY = $(HOME)/lib/libArpack.a
UMFPACK_LIBRARY = $(HOME)/lib/libUmfpack.a
METIS_LIBRARY = $(HOME)/lib/libMetis.a
TCL_LIBRARY = /usr/local/lib/libtcl8.5.so /usr/local/lib/libtclstub8.5.a /usr/local/lib/libtk8.5.so /usr/local/lib/libtkstub8.5.a \
/usr/lib/openmotif/libXm.so
BLITZ_LIBRARY = /usr/lib/libblitz.so.0
GRAPHIC_LIBRARY = /usr/lib/libGL.so /usr/lib/libGL.so.1 /usr/lib/libGLU.so /usr/lib/libGLU.so.1
#GRAPHIC_LIBRARY = /usr/lib/libX11.so
# WATCH OUT .. These libraries are removed when 'make wipe' is invoked.
WIPE_LIBS = $(FE_LIBRARY) \
$(LAPACK_LIBRARY) \
$(BLAS_LIBRARY) \
$(CBLAS_LIBRARY) \
$(SUPERLU_LIBRARY) \
$(ARPACK_LIBRARY) \
$(UMFPACK_LIBRARY) \
$(METIS_LIBRARY)
# %---------------------------------------------------------%
# | SECTION 4: COMPILERS |
# | |
# | The following macros specify compilers, linker/loaders, |
# | the archiver, and their options. You need to make sure |
# | these are correct for your system. |
# %---------------------------------------------------------%
# Compilers
CC++ = /usr/bin/g++
CC = /usr/bin/gcc
#FC = /usr/bin/gfortran
FC = /usr/bin/g77
AR = ar
ARFLAGS = cqls
RANLIB = ranlib
RANLIBFLAGS =
# Compiler Flags
#
# NOTES:
# C++ FLAGS TAKE need _UNIX or _WIN32 for preprocessor dircetives
# - the _WIN32 for the Windows95/98 or NT operating system.
# C FLAGS used -DUSE_VENDOR_BLAS (needed in SuperLU) if UNIX in C++ FLAGS
#
# modified as optimizaton currently causing problems with Steeln01 code
ifeq ($(DEBUG_MODE), DEBUG)
C++FLAGS = -Wall -D_LINUX -D_UNIX -D_TCL85 \
$(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) $
(PROGRAMMING_FLAG) \
-g -pg
CFLAGS = -Wall -pg $(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $
(DEBUG_FLAG) $(PROGRAMMING_FLAG)
FFLAGS = -Wall
# Linker
LINKER = $(CC++)
LINKFLAGS = -g -pg
else
C++FLAGS = -Wall -D_LINUX -D_UNIX -D_TCL85 \
$(GRAPHIC_FLAG) $(RELIABILITY_FLAG) $(DEBUG_FLAG) \
$(PROGRAMMING_FLAG) -O3 -ffloat-store
CFLAGS = -Wall -O2
FFLAGS = -Wall -O
# Linker
LINKER = $(CC++)
LINKFLAGS = -rdynamic -Wl
endif
GRAPHIC_FLAG = -D_X11
# Misc
MAKE = make
CD = cd
ECHO = echo
RM = rm
RMFLAGS = -f
SHELL = /bin/sh
# %---------------------------------------------------------%
# | SECTION 5: COMPILATION |
# | |
# | The following macros specify the macros used in |
# | to compile the source code into object code. |
# %---------------------------------------------------------%
.SUFFIXES:
.SUFFIXES: .C .c .f .f90 .cpp .o .cpp
#
# %------------------%
# | Default command. |
# %------------------%
#
.DEFAULT:
@$(ECHO) "Unknown target $@, try: make help"
#
# %-------------------------------------------%
# | Command to build .o files from .f files. |
# %-------------------------------------------%
#
.cpp.o:
@$(ECHO) Making $@ from $<
$(CC++) $(C++FLAGS) $(INCLUDES) -c $< -o $@

.C.o:
@$(ECHO) Making $@ from $<
$(CC++) $(C++FLAGS) $(INCLUDES) -c $< -o $@
.c.o:
@$(ECHO) Making $@ from $<
$(CC) $(CFLAGS) -c $< -o $@
.f.o:
@$(ECHO) Making $@ from $<
$(FC) $(FFLAGS) -c $< -o $@

# %---------------------------------------------------------%
# | SECTION 6: OTHER LIBRARIES |
# | |
# | The following macros specify other libraries that must |
# | be linked with when creating executables. These are |
# | platform specific and typically order does matter!! |
# %---------------------------------------------------------%
MACHINE_LINKLIBS = -L$(BASE)/lib \
-L$(HOME)/lib
MACHINE_NUMERICAL_LIBS = -lm \
$(ARPACK_LIBRARY) \
$(SUPERLU_LIBRARY) \
$(UMFPACK_LIBRARY) \
$(LAPACK_LIBRARY) $(BLAS_LIBRARY) $(CBLAS_LIBRARY) \
$(GRAPHIC_LIBRARY)\
-ldl -lgfortran -lpng
MACHINE_SPECIFIC_LIBS =
# %---------------------------------------------------------%
# | SECTION 7: INCLUDE FILES |
# | |
# | The following macros specify include files needed for |
# | compilation. |
# %---------------------------------------------------------%
# MACHINE_INCLUDES = -I/usr/include \
# -I$(BASE)/include \
# -I/usr/include/cxx \
# -I$(HOME)/include -I$(HOME)/blitz
MACHINE_INCLUDES = -I/usr/include \
-I$(BASE)/include \
-I/usr/include/X11 \
-I$(HOME)/include/blitz -I$(HOME)/blitz
# this file contains all the OpenSees/SRC includes
include $(FE)/Makefile.incl
TCL_INCLUDES = -I/usr/include
#TCL_INCLUDES =
INCLUDES = $(TCL_INCLUDES) $(FE_INCLUDES) $(MACHINE_INCLUDES)
================================
Would any one tell me how to remove these errors. Note that I have earlier compiled OpenSees 2.1.0 in Fedora 8.
Thanks in advance
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

the line defining strrchr in tkMain.cpp should be commented out .. if it is not comment it out, if it is try deleting it.
sb1966
Posts: 151
Joined: Wed Jul 23, 2008 8:08 am
Location: NERIST, INDIA
Contact:

Post by sb1966 »

Dear fmk,
Thanks for your reply. I did as you instructed (Commented out line no 112 and 117 of tkMain.cpp containing "strrchr") and got the following error:
=========================
tkAppInit.cpp -o tkAppInit.o
make[2]: Leaving directory `/usr/local/OpenSees/SRC/tcl'
g++: /usr/local/lib/libOpenSees.a: No such file or directory
g++: /usr/local/lib/libArpack.a: No such file or directory
g++: /usr/local/lib/libSuperLU.a: No such file or directory
g++: /usr/local/lib/libUmfpack.a: No such file or directory
g++: /usr/local/lib/libLapack.a: No such file or directory
g++: /usr/local/lib/libBlas.a: No such file or directory
g++: /usr/local/lib/libCBlas.a: No such file or directory
g++: /usr/lib/libXm.so: No such file or directory
make[1]: *** [tk] Error 1
make[1]: Leaving directory `/usr/local/OpenSees/SRC/modelbuilder/tcl'
make: *** [tcl] Error 2
===================================
Meanwhile I installed gcc 4.1.0 also tried to do "make OpenSees", but got similar error.

BTW, another information may be helpful. I could not compile blitz library from source with gcc 4.4.4, but succeeded getting the libblitz.la lib by using gcc 4.1.0.

Your help will be highly appreciated. Thanks in advance. With Regards
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

do you have permissions to write to /usr/local/lib

if you do, OpenSees is still failing to compile. cd to SRC and type make to see what the error is.
sb1966
Posts: 151
Joined: Wed Jul 23, 2008 8:08 am
Location: NERIST, INDIA
Contact:

Post by sb1966 »

Dear fmk
Yes, I have permission to write in /usr/local/lib as I am compiling as root.

Then following your instruction I got the error as follows:
===================
[root@localhost SRC]# pwd
/usr/local/OpenSees/SRC
[root@localhost SRC]# make all
make[1]: Entering directory `/usr/local/OpenSees/SRC/matrix'
make[1]: *** No rule to make target `make', needed by `@echo'. Stop.
make[1]: Leaving directory `/usr/local/OpenSees/SRC/matrix'
make: *** [all] Error 2
======================
Looking forward for your instructions

Thanks and Regards
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

not quite sure how you get the original error and then this one .. anyway the problem appears to be in your Makefile.def .. the simplest solution would be too remove lines like the following in the rules for making the .o files form .cpp, .c and .f:

@$(ECHO) Making $@ from $<
sb1966
Posts: 151
Joined: Wed Jul 23, 2008 8:08 am
Location: NERIST, INDIA
Contact:

Post by sb1966 »

Dear fmk,

Thank you very much for your support. I have been trying to fix my Makefile.def. The locations of different libraries seems to be OK in the Makefile.def. However, I am getting the same error saying no libraries have been created for OpenSees. Would you pl permit me to post my Makefile.def for your comments?

I also tried version 2.2.1 with the same Makefile.def but got similar error, at a previous step than compilation of tkAppInit.cpp; (some where in TclSectionTester.cpp )

BTW, my compilation works only if I type "make OpenSees" or "make all". simply typing "make" says no rule to make. Does it mean some problem in my OS installation or there is really no rule to make with simple make?

Looking forward for your reply and Thanking you with Regards
sb1966
Posts: 151
Joined: Wed Jul 23, 2008 8:08 am
Location: NERIST, INDIA
Contact:

Post by sb1966 »

Dear fmk,

Now I have fixed my Makefile.def and able to get the libraries built. However, still getting some errors. The relevant outputs i am appending for your comments:
=======================
...

LIBRARIES BUILT ... NOW LINKING OpenSees PROGRAM

...

Making tkAppInit.o from tkAppInit.cpp
....
make[2]: Leaving directory `/usr/local/OpenSees/SRC/tcl'
/usr/local/lib/libOpenSees.a(AMDNumberer.o): In function `AMD::number(Graph&, int)':
AMDNumberer.cpp:(.text+0x191): undefined reference to `amd_order'
collect2: ld returned 1 exit status
make[1]: *** [tk] Error 1
make[1]: Leaving directory `/usr/local/OpenSees/SRC/modelbuilder/tcl'
make: *** [all] Error 2
[root@localhost OpenSees]#

===============================
Thanks and Regards. Eagerly waiting for your comments
sb1966
Posts: 151
Joined: Wed Jul 23, 2008 8:08 am
Location: NERIST, INDIA
Contact:

Post by sb1966 »

PS:-- Forgot to mention that all libraries listed in the Makefile, are built except libBJmisc.a.
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

you need to add:

AMDdir = $(HOME)/OpenSees/OTHER/AMD

AMD_LIBRARY = $(HOME)/lib/libAMD.a

add then AMDdir to DIRS and the AMD_LIBRARY to MACHINE_NUMERICAL_LIBS
sb1966
Posts: 151
Joined: Wed Jul 23, 2008 8:08 am
Location: NERIST, INDIA
Contact:

Post by sb1966 »

Dear fmk,

Thanks a lot for ur instructions. I am now able to get the OpenSees and OpenSeesTk binary. However, I still got the following error message.
======================
kAppInit.o
c++: /usr/include: linker input file unused because linking not done
make[2]: Leaving directory `/usr/local/OpenSees/SRC/tcl'
make[2]: Entering directory `/usr/local/OpenSees/SRC/tcl'
make[2]: Nothing to be done for `tcl'.
make[2]: Leaving directory `/usr/local/OpenSees/SRC/tcl'
/usr/local/OpenSees/SRC/tcl/tclMain.o: In function `g3TclMain(int, char**, int (*)(Tcl_Interp*), int, int)':
tclMain.cpp:(.text+0x1ce): undefined reference to `TclFormatInt'
collect2: ld returned 1 exit status
make[1]: *** [tcl] Error 1
make[1]: Leaving directory `/usr/local/OpenSees/SRC/modelbuilder/tcl'
make: *** [all] Error 2
========================
However, I have run OpenSees with Ex1.tcl obtained from OpenSees Days 2010 and got screen output. Now I am not sure what this above error msg means. Should I use my OpenSees and OpenSeesTk binaries?
Pl advise. Thanks and regards
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

move the current .exe somewhere else and see if you still get them when you run make .. if you get a .exe then the linking worked and you can use the .exe .. something is however not linking and i am not sure what it is based on the message.
sb1966
Posts: 151
Joined: Wed Jul 23, 2008 8:08 am
Location: NERIST, INDIA
Contact:

Post by sb1966 »

Dear fmk,

I followed your instructions. After removal of the binaries, I have run make and again got the bin files, [b]this time without any error msg[/b]. :-). So hope I can use them now.
BTW, I did not get any BiludingTclViewer file in the binary. For this should i run "make OpenSeesTk " ?

Thanks for all your support helps. With warm regards
fmk
Site Admin
Posts: 5884
Joined: Fri Jun 11, 2004 2:33 pm
Location: UC Berkeley
Contact:

Post by fmk »

BuildingTcl uses OpenSeesTk .. you need to download BuildingTcl using the svn instructions on the buildingTcl page .. in the bin directory of BuildingTcl there is a script that you source using OpenSeesTK to start BuildingTcl.
sb1966
Posts: 151
Joined: Wed Jul 23, 2008 8:08 am
Location: NERIST, INDIA
Contact:

Post by sb1966 »

Dear fmk,
Thanks a lot for your instructions. I have now understood and downloaded the svn source which contains the required file. The BuildingTcl viewer has started with my OpenSeesTk.

With regards
Post Reply