It is currently Mon Jun 16, 2025 1:29 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Mac Intel
PostPosted: Wed Feb 14, 2007 3:28 pm 
Offline

Joined: Tue Nov 29, 2005 5:07 pm
Posts: 6
Location: Stanford
Signe Riemer-Sørensen appeared with a new Intel Macintosh. We got Galprop to run on it.

1. There was no Fortran compiler. We could have joined the Apple Developer Connection and downloaded the Xcode package, or we could have bought the Intel compiler. Instead we downloaded a pre-compiled copy of g77 from http://hpc.sourceforge.net

2. The g77 compiler installs in /usr/local/bin. For some reason that is not in the default PATH variable. After tweaking .cshrc and .tcshr we still couldn't get it to work. We gave up and modified the Makefile to set the variable
FC = /usr/local/bin/g77

3. There was an obscure error message when linking, something about two different libraries with the same symbols. We cured that by adding the option -bind_at_load to the link options. It's magic; I don't understand it.

4. The mac loader has no rpath option. We removed that from the link options.

5. Once the program was linked, it couldn't find the cfitsio dynamic library. Without rpath, that's not surprising. It is necessary to set the environmental variable DYLD_LIBRARY_PATH to point to the proper directory. On any other form of linux/unix, that job would be done by LD_LIBRARY_PATH.

6. To keep from cluttering up our namespaces, we wrapped the program with a script. We changed the makefile so it creates a program called galprop.exe. Then we made a little executable script called galprop. It looks like this:

#!/bin/csh
setenv DYLD_LIBRARY_PATH /local/opt/CFITSIO/lib
exec galprop.exe $*


Top
 Profile  
 
 Post subject: mac installation
PostPosted: Fri Feb 16, 2007 1:01 am 
Offline

Joined: Wed May 17, 2006 7:02 am
Posts: 285
Location: MPE Garching
that's very encouraging, possibly the first time on a mac (at least that I've heard of ) !
it shows the importance of elminating the fortran routines
which seem to have been the main holdup
(a long-standing action).

_________________
Andy Strong, MPE


Top
 Profile  
 
 Post subject: Re: mac installation
PostPosted: Sun Feb 25, 2007 11:29 pm 
Offline

Joined: Tue Nov 29, 2005 5:07 pm
Posts: 6
Location: Stanford
strong wrote:
that's very encouraging, possibly the first time on a mac (at least that I've heard of ) !
it shows the importance of elminating the fortran routines
which seem to have been the main holdup
(a long-standing action).


A while ago I looked at some of the Fortran stuff. I think I could replace much of it, or at least clean it up. Would this sort of thing be welcome? I think it might be accomplished best in the context of subversion or cvs.


Top
 Profile  
 
 Post subject: fortran replacement
PostPosted: Mon Feb 26, 2007 12:15 am 
Offline

Joined: Wed May 17, 2006 7:02 am
Posts: 285
Location: MPE Garching
I have tried the gnu f2c converter but with limited success.
They all converted except one (YIELDX) but then the linking complained
of many things, probably the conversion was not great.
Probably we have to go through them on a case-by-case basis.
Would be interesting to know if anyone tried and of their results

_________________
Andy Strong, MPE


Top
 Profile  
 
 Post subject: GALPROP on an intel Mac
PostPosted: Thu Jan 17, 2008 4:42 am 
Offline

Joined: Wed Jan 09, 2008 7:57 pm
Posts: 3
Location: Adelaide, Australia
I have an Intel Mac, with Leopard, and am trying to instal GALPROP v50.

Having installed g77 and changing the makefile as suggested in the Mac installation notes (which are very good!), I get the following errors, which to me seem like compilation errors, and not software errors - but I could be, and probably am, wrong!

david-joness-macbook-pro-15:GALPROP David$ make
gcc -O3 -Wno-deprecated -I/opt/local/cfitsio/include -c -o D_xx.o D_xx.cc
galprop.h:2: error: redefinition of ‘class Galprop’
Galprop.h:3: error: previous definition of ‘class Galprop’
D_xx.cc: In member function ‘int Galprop::D_xx(Particle&, int, int, int, int, int, int)’:
D_xx.cc:59: error: ‘C’ was not declared in this scope
D_xx.cc:64: error: ‘C’ was not declared in this scope
D_xx.cc:89: error: ‘sim’ was not declared in this scope
D_xx.cc:92: error: ‘sim’ was not declared in this scope
make: *** [D_xx.o] Error 1
david-joness-macbook-pro-15:GALPROP David$


I assume that 'C' and 'sim' aren't cfitsio things... Does anyone know the solution?

David Jones


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 17, 2008 6:23 pm 
Offline

Joined: Tue Nov 29, 2005 6:07 pm
Posts: 34
Location: Stanford
It may have something to do with the header files, not with the routine itself.
I suggest you to add
#ifndef Galprop_h
#define Galprop_h

in the beginning of Galprop.h file and
#endif
at the end.

If it does not help, we may ask Signe.
We've never experienced such an error on our machines.

_________________
Igor Moskalenko
Stanford University


Top
 Profile  
 
 Post subject: GALPROP on an intel Mac
PostPosted: Thu Jan 17, 2008 8:33 pm 
Offline

Joined: Wed Jan 09, 2008 7:57 pm
Posts: 3
Location: Adelaide, Australia
Thanks for that - it has helped the class re-declaration error, but hasn't solved the other two, non-declaration errors:

david-joness-macbook-pro-15:GALPROP David$ make
gcc -O3 -Wno-deprecated -I/opt/local/cfitsio/include -c -o D_xx.o D_xx.cc
D_xx.cc: In member function ‘int Galprop::D_xx(Particle&, int, int, int, int, int, int)’:
D_xx.cc:59: error: ‘C’ was not declared in this scope
D_xx.cc:64: error: ‘C’ was not declared in this scope
D_xx.cc:89: error: ‘sim’ was not declared in this scope
D_xx.cc:92: error: ‘sim’ was not declared in this scope
make: *** [D_xx.o] Error 1
david-joness-macbook-pro-15:GALPROP David$

Has anyone else had these errors? I have re-downloaded v50.tar, and still get the errors shown above...


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 17, 2008 9:24 pm 
Offline

Joined: Tue Nov 29, 2005 6:07 pm
Posts: 34
Location: Stanford
"C" is the speed of light defined in constants.h (note there is also "c", also speed of light, but less accurate)
sim is a routine which prototype is defined in galprop.h

The compiler somehow misses their definitions though the D_xx.cc routine has the appropriate header files included.

_________________
Igor Moskalenko
Stanford University


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 17, 2008 9:45 pm 
Offline

Joined: Wed Jan 09, 2008 7:57 pm
Posts: 3
Location: Adelaide, Australia
I couldn't find #include "constants.h" in any of the header files included in D_xx.cc, but placed it in galprop.h and the error went away.

The routine 'sim' doesn't actually appear in my version of the galprop.h file, although it is in quite a few .cc files:

david-joness-macbook-pro-15:GALPROP David$ make
gcc -O3 -Wno-deprecated -I/opt/local/cfitsio/include -c -o D_xx.o D_xx.cc
D_xx.cc: In member function ‘int Galprop::D_xx(Particle&, int, int, int, int, int, int)’:
D_xx.cc:90: error: ‘sim’ was not declared in this scope
D_xx.cc:93: error: ‘sim’ was not declared in this scope
make: *** [D_xx.o] Error 1
david-joness-macbook-pro-15:GALPROP David$ grep 'sim' *.h
david-joness-macbook-pro-15:GALPROP David$ grep 'sim' *.cc

D_xx.cc: if(a<damping_p0) ai=sim(damping_p0,a,a/100.,0.01,1.e-30,&Galprop::fu); //IMOS20060330
D_xx.cc: if(a<damping_p0) ai=sim(damping_p0,a,a/100.,0.01,1.e-10,&Galprop::fu); //IMOS20060330
D_xx.cc:// if(a<damping_p0) ai=sim(damping_p0,a,h,reps,aeps,&fu);


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 17, 2008 9:53 pm 
Offline

Joined: Tue Nov 29, 2005 6:07 pm
Posts: 34
Location: Stanford
Looks strange that constants.h is not there...
Anyway, try to add the following prototype to galprop.h:
double sim(double,double,double,double,double,double(*)(double));

If it is not there, this line will do the job.

_________________
Igor Moskalenko
Stanford University


Top
 Profile  
 
 Post subject: Re: Mac Intel
PostPosted: Wed Apr 30, 2008 11:28 pm 
Offline

Joined: Fri Sep 28, 2007 8:00 am
Posts: 2
Location: FLORIDA
after changing makefile according to README in v50.1p I get following after invoking make

f77 -fno-second-underscore -c -o WNEWTR_FUNC_aws.o WNEWTR_FUNC_aws.f
make: f77: Command not found
make: *** [WNEWTR_FUNC_aws.o] Error 127

HELP!

_________________
Ray H. O'Neal, Jr., Ph.D.
Associate Professor
Department of Physics
FLORIDA A&M UNIVERSITY
Tallahassee, FL 32307


Top
 Profile  
 
 Post subject: Re: Mac Intel
PostPosted: Thu May 01, 2008 2:12 pm 
Offline

Joined: Fri Sep 28, 2007 8:00 am
Posts: 2
Location: FLORIDA
igured out first error. However now I get

I am attempting to build galprop v50.1.p on Macbook (intel) running Mac OS X 10.4.11. I get the following errors upon invoking make:

apcrdrdlmacbook1s-computer:~/Desktop/v50.1p macbook1$ make
g++ -O3 -Wno-deprecated -I/usr/local/include -c -o D_xx.o D_xx.cc
g++ -O3 -Wno-deprecated -I/usr/local/include -c -o Distribution.o Distribution.cc
g++ -O3 -Wno-deprecated -I/usr/local/include -c -o Galaxy.o Galaxy.cc
g++ -O3 -Wno-deprecated -I/usr/local/include -c -o Galdef.o Galdef.cc
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 have done all the suggestions of the posts in Mac Intel galprop compilation forum. Anything else anyone can think might be the problem here? Thanks.

_________________
Ray H. O'Neal, Jr., Ph.D.
Associate Professor
Department of Physics
FLORIDA A&M UNIVERSITY
Tallahassee, FL 32307


Top
 Profile  
 
 Post subject: Re: Mac Intel
PostPosted: Thu May 01, 2008 11:56 pm 
Offline

Joined: Wed May 17, 2006 7:02 am
Posts: 285
Location: MPE Garching
I don't have a solution but just some remarks.
I think Signe is the only one we know of to have successfully installed on a Mac, see above, maybe she can help.
This issue is important since Mac's are becoming more and more popular especially
for notebooks, so we have to find a standard solution. GALPROP is not actually a complicated program in terms of building.

Igor pointed out an issue that there is a problem distinguishing e.g. Galprop.h from galprop.h due to Macs not distinguishing lower/upper case:
is this indeed a problem? (hard to believe since Mac OS is Unix-based and case is fundamental to Unix). Case sensitivity is fundamental to c++ programming.


Most of the problems seem to arise from the fortran remnants, which we want to replace by c++ in the future.

_________________
Andy Strong, MPE


Top
 Profile  
 
 Post subject: Re: Mac Intel
PostPosted: Tue Jul 08, 2008 8:54 am 
Offline

Joined: Wed Dec 20, 2006 1:54 am
Posts: 2
Location: Department of Physics - KTH - AlbaNova University Centre [Stockholm]
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.


Top
 Profile  
 
 Post subject: Re: Mac Intel
PostPosted: Wed Jul 09, 2008 1:09 pm 
Offline

Joined: Tue Nov 29, 2005 6:07 pm
Posts: 34
Location: Stanford
v50.1p is not much different from v50p. There is a bug in n_spatial_dimentions = 3 case, which I though I fixed (v50.1p) by copying a routine from v53 (where this problem is solved), but it seems it creates another problem. Since we are going to publish a significantly new version soon, it has no sense to fix it in the current version. Just use v50p if you do not need 3D (see also this topic: viewtopic.php?f=20&t=52 )

_________________
Igor Moskalenko
Stanford University


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group