Dear,
I successfully build GALPROP v50p on a Mac intel running under Mac OsX 10.5 (well known as Leopard) and on a Mac PowerPc running Mac OsX 10.4 (Tigger).
I still have some problem when building some .cc files. Then, I made some minor changes in the GALPROP code.
1- I must add
#include"constante.h" at the begenning of some of the .cc files.
2- To solve the problem related to
not declared functions such as the one listed by oneal
Quote:
g++ -O3 -Wno-deprecated -I/usr/local/include -c -o Galprop.o Galprop.cc
Galprop.cc: In member function 'int Galprop::run(int, char**)':
Galprop.cc:24: error: 'read_nucdata' was not declared in this scope
Galprop.cc:27: error: 'sigtap_cc' was not declared in this scope
Galprop.cc:30: error: 'set_sigma_cc' was not declared in this scope
Galprop.cc:39: error: 'cleanup_nucdata' was not declared in this scope
make: *** [Galprop.o] Error 1
I created a .h file (which I called
galprop_def.h) and add line #include"galprop_def.h" at the beginning of each .cc file which could not be build. The
galprop_def.h is as following:
Code:
//**.****|****.****|****.****|****.****|****.****|****.****|****.****|****.****|
// * galprop_def.h * galprop package * 8/7/2008
//**"****!****"****!****"****!****"****!****"****!****"****!****"****!****"****|
//••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
// CREATED BY WILLIAM GILLARD TO SOLVE PROBLEM OF GALPROP COMPILATION ON
// MAC INTEL - OSX LEOPARD 10.5
//••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
#ifndef galprop_def_h
#define galprop_def_h
double aic_cc(int,int,double,double,double,double,double,double,double,double,double);
double B_field_model(double,double,int);
double B_field_model(double,double,double,int);
double blattnig_gamma(double, double, int, int, int);
void cleanup_nucdata();
double electron_loss(double, double, double, double,double, double,
double*, double*, double*, double*, double*,double*);
double fjones_cc(double, double, double);
int He_to_H_CS(double, int, int, int, int, double*, double*);
double isotope_cs(double,int,int,int,int,int,int*);
double ionization_bethe(int, double);
void Kcapture_cs(double,int,int,double*,double*);
int kinematic (int,int,char*,double&,double&,double&,double&,double&,double&,int);
double nHI_av (double,double,double,double,double);
double nHII_av(double,double,double,double,double);
double nH2_av (double,double,double,double,double);
double nucdata(int,int,int,int,int,int,int*,int*,double*);
float nucdata(int,int,int,int,int,int *,int *,double *);
void nucleon_cs (int,double,int,int,int,double*,double*,double*,double*,double*,double*);
double nucleon_loss(int,int,double,double,double,double,double*, double*);
void read_nucdata();
double sigma_boron_dec_heinbach_simon(int,int,int,int,double);
double sim(double,double,double,double,double,double(*)(double));
int test_kinematic();
int tridag( float*, float*, float*, float*, float*,int);
int tridag(double*,double*,double*,double*,double*,int);
int tridag_sym_ext( float*, float*, float*, float*, float*,int,int);
int tridag_sym_ext( float*, float*, float*, float*, float*,int,int);
int tridag_sym(float*, float*, float*, float*, float*, int);
int tridag_sym(double*, double*, double*, double*, double*, int);
int test_He_to_H_CS();
int test_nH();
int test_float_accuracy();
int test_sigma_boron_dec_heinbach_simon();
#endif
3 - Because gcc was not able to found the
main function, (it gave me the errore message "_main", referenced from: start in crt1.10.5.o when linking, with crt1.10.5.o a library of the Leopard System) I created a
main.cc and
main.h files as following.
main.cc
Code:
#include"main.h"
int main(int argc, char*argv[])
{
galprop.run(argc,argv);
return 1;
}
main.h
Code:
#ifndef main_h
#define main_h
#include"galprop_classes.h"
#include"Galprop.h"
Galprop galprop;
#endif
3 - With all these changes, each file can be build individually. But, I still had some problem to make the executable under
Leopard. The problem was due to the fortran functions. To build fortran I used gfortran, from the gnu project, and did not have any problem to build the .f files individually. But, when linking, I get error messages which indicate that the fortran library were not located. Therefore, I add some options to my Makefile. See bellow:
Code:
CXX = g++
FC =gfortran-gnu-4.3.1
CFITSIO = PATH OF MY CFITSIO LIBRARY
FFLAGS = -O3 -fno-second-underscore -fbounds-check
CPPFLAGS = -O3 -Wno-deprecated -I${CFITSIO}/include -fast -floop-optimize2 -fforce-addr
LIBS = -lm -Wl -lcfitsio -lgcc -lg2c -lgfortran
LDFLAGS = $(LIBS) -L${CFITSIO}/lib -L(PATH OF FILE libgfortran.a)
FOBJS := $(patsubst %.f,%.o,$(wildcard *.f))
CCOBJS := $(patsubst %.cc,%.o,$(wildcard *.cc))
galprop: ${FOBJS} ${CCOBJS}
$(CXX) *.o -o Galprop.exe ${LDFLAGS}
Now, GALPROP v50p can be build on my Mac Intel and run perfectly (produce fits files and did not crash during the run). I tried to build the v50.1 package of GALPROP, but I get the following error messages when linking.
Code:
"_set_sigma_", referenced from:
set_sigma_cc() in fort_interface1.o
"_wsigma_", referenced from:
wsigma_cc(int, int, int, int, double)in fort_interface2.o
The functions set_sigma_ and wsigma_ are called in some .cc files but it seems that these functions are not defined or the file which contains this functions is missed. I done a
grep set_sigma *.cc *.f *.h. I can not found these functions (it only found the function set_sigma_cc and wsigma_cc). I also check for the 50p package and still not able to locate these functions. Actually, I have not found the difference between the v50.1 and the v50p which can explain why I can not build the v50.1 package. So, if anyone have any idea to solve this problem, please, let me know.