Compile Giac on Mac OS X

Librairie C++ de calcul formel/ C++ symbolic computation library

Modérateur : xcasadmin

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Compile Giac on Mac OS X

Message par parisse » sam. déc. 11, 2010 8:53 pm

You should not remove Cfg.o and so on. Could you copy/paste what you get from sh mkaout?

pemitsig
Messages : 17
Inscription : lun. nov. 29, 2010 3:26 pm

Re: Compile Giac on Mac OS X

Message par pemitsig » sam. déc. 11, 2010 9:56 pm

When we run sudo sh mkaout, at first it says this:

Code : Tout sélectionner

mkaout: line 1: g++-3.4: command not found
So at the first line of mkaout we change g++-3.4 to g++-4.0 which we have installed on our system.

Then after running sudo sh mkaout again it returns this error:

Code : Tout sélectionner

i686-apple-darwin9-g++-4.0.1: /usr/lib/libgmpxx.a: No such file or directory
Filio and Petros

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Compile Giac on Mac OS X

Message par parisse » dim. déc. 12, 2010 7:44 am

Then remove libgmpxx.a. Try again and remove libraries which are not on your system, but not object files.

pemitsig
Messages : 17
Inscription : lun. nov. 29, 2010 3:26 pm

Re: Compile Giac on Mac OS X

Message par pemitsig » dim. déc. 12, 2010 7:46 pm

Ok we did as you said and ran sudo sh mkaout again. We didn't remove any .o files and it returns errors about Undefined symbols in the files:

Fl.o
gl2ps.o
Graph3d.o
Editeur.o
Flv_List.o
Flv_Table.o
Graph.o

and some other object files and not libraries...

What do you believe we are doing wrong?

Filio and Petros

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Compile Giac on Mac OS X

Message par parisse » lun. déc. 13, 2010 8:01 am

Can you send at least a part of the output, I need to know the names of the symbols which are not found to give you some hints.

pemitsig
Messages : 17
Inscription : lun. nov. 29, 2010 3:26 pm

Re: Compile Giac on Mac OS X

Message par pemitsig » lun. déc. 13, 2010 4:23 pm

Check the attached .txt file please!

Filio and Petros
Pièces jointes
errors.txt.zip
(25.66 Kio) Téléchargé 254 fois

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Compile Giac on Mac OS X

Message par parisse » lun. déc. 13, 2010 4:39 pm

It seems you did not link against the fltk* libraries. If you compile xcas without graphic user interface (that is without FLTK), could you check that FLTK support is indeed disabled in config.h (both in the src directory and the upper directory)? Otherwise, you must keep the libfltk*.a in the mkstat shell-script, but you will perhaps have to modify the path if you did not install FLTK in the /usr/local subdirectories.

pemitsig
Messages : 17
Inscription : lun. nov. 29, 2010 3:26 pm

Re: Compile Giac on Mac OS X

Message par pemitsig » lun. déc. 13, 2010 6:39 pm

We tried to disable fltk by setting to 0 in all the config.h and config.h.osx the flags below:

Code : Tout sélectionner

/* Define to 1 if you have the `fltk' library (-lfltk). */
#define HAVE_LIBFLTK 0

/* Define to 1 if you have the `fltk_gl' library (-lfltk_gl). */
#define HAVE_LIBFLTK_GL 0

/* Define to 1 if you have the `fltk_images' library (-lfltk_images). */
#define HAVE_LIBFLTK_IMAGES 0

/* Now defined if fltk is available */
#define HAVE_LIBFLVW 0
Since we changed the configure.h files we ran ./configure again with all the necessary exports and when we ran sudo sh mkaout It returned the errors shown in the attached file.

How do we continue?
Pièces jointes
errors.txt.zip
(25.79 Kio) Téléchargé 246 fois

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Compile Giac on Mac OS X

Message par parisse » lun. déc. 13, 2010 7:07 pm

You should not define them as 0, but comment the line, like this:
/* #define HAVE_LIBFLTK 0 */
Then make clean and make. Then sh mkstat (with libfltk* removed). Then you should have an icas application that works only from the terminal.
After that, you can try to compile FLTK...

pemitsig
Messages : 17
Inscription : lun. nov. 29, 2010 3:26 pm

Re: Compile Giac on Mac OS X

Message par pemitsig » lun. déc. 13, 2010 7:44 pm

We did as you said. When we execute sudo make it returns:

Code : Tout sélectionner

Undefined symbols:
  "_libintl_gettext", referenced from:
      giac::check_local_assign(giac::gen const&, giac::context const*)in libgiac.a(prog.o)
      giac::check_local_assign(giac::gen const&, giac::context const*)in libgiac.a(prog.o)
      giac::check_local_assign(giac::gen const&, giac::context const*)in libgiac.a(prog.o)
      giac::check_local_assign(giac::gen const&, giac::context const*)in libgiac.a(prog.o)
      giac::check_local_assign(giac::gen const&, giac::context const*)in libgiac.a(prog.o)
      giac::check_local_assign(giac::gen const&, giac::context const*)in libgiac.a(prog.o)
      giac::symb_program_sto(giac::gen const&, giac::gen const&, giac::gen const&, giac::gen const&, bool, giac::context const*)in libgiac.a(prog.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
Then we execute sudo sh mkstat after we remove fltk libraries from within it. It returns these errors:

Code : Tout sélectionner

Undefined symbols:
  "_add_history", referenced from:
      rl_gets(int) in icas.o
  "_using_history", referenced from:
      _main in icas.o
  "_readline", referenced from:
      rl_gets(int) in icas.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
strip: can't open file: icas (No such file or directory)
Filio and Petros

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Compile Giac on Mac OS X

Message par parisse » lun. déc. 13, 2010 9:09 pm

You must find where libreadline and libhistory are located on your system, perhaps in /usr/lib, or you must comment READLINE defines in config.h.

pemitsig
Messages : 17
Inscription : lun. nov. 29, 2010 3:26 pm

Re: Compile Giac on Mac OS X

Message par pemitsig » mer. déc. 15, 2010 5:57 pm

Hello,

We removed all the references of READLINE from the config.h files, ran sudo make clean, sudo make. Afterwards we ran sudo sh mkstat and it didn't return any errors. sudo sh mkaout though returned these errors:

Code : Tout sélectionner

Undefined symbols:
  "_libintl_gettext", referenced from:
      giac::check_local_assign(giac::gen const&, giac::context const*)in prog.o
      giac::check_local_assign(giac::gen const&, giac::context const*)in prog.o
      giac::check_local_assign(giac::gen const&, giac::context const*)in prog.o
      giac::check_local_assign(giac::gen const&, giac::context const*)in prog.o
      giac::check_local_assign(giac::gen const&, giac::context const*)in prog.o
      giac::check_local_assign(giac::gen const&, giac::context const*)in prog.o
      giac::symb_program_sto(giac::gen const&, giac::gen const&, giac::gen const&, giac::gen const&, bool, giac::context const*)in prog.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
We tried to link lintl library by including -lintl in mkaout but it doesn't pass, it returns

Code : Tout sélectionner

ld: library not found for -lintl
collect2: ld returned 1 exit status
What can we do about this?

Filio and Petros

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Compile Giac on Mac OS X

Message par parisse » mer. déc. 15, 2010 6:30 pm

Oops sorry, you don't have to run sh mkaout (that is the shell script I'm running under linux). If sh mkstat ran without error, then you are done with the commandline version of giac, you should be able to type
./icas
and the program should run, you can try a few commands like 1+1 or factor(x^4-1) to see if it works.
If it works, you can try to compile additional libraries, starting with FLTK to have a graphical interface (but this one is probably not easy to compile) or readline to have some decent commandline interface in the terminal, then maths libraries, MPFR and gsl are probably the easiest ones.

pemitsig
Messages : 17
Inscription : lun. nov. 29, 2010 3:26 pm

Re: Compile Giac on Mac OS X

Message par pemitsig » mer. déc. 15, 2010 6:55 pm

Ok, icas did run and we managed to use it in the terminal only like this:

Code : Tout sélectionner

noname:src filioui$ ./icas 5^2
Help file aide_cas not found
// Unable to find keyword file doc/en/keywords
Help file doc/en/aide_cas not found
Added 0 synonyms

25
Let's say now we want to use some functions in an iphone app. Do you know how we can import giac library now? We didn't run sudo make install so the library wasn't installed in our system, right? We can't just add include <giac.h> in our code, can we?

Filio and Petros

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: Compile Giac on Mac OS X

Message par parisse » mer. déc. 15, 2010 9:01 pm

Running giac in an iphone app is quite different than on the mac, you can not use the compiled object files for the mac on the iphone. If I'm correct, you must cross-compile for the ARM processor of the iphone and you must build a user interface (UI) for the iphone using the API of the iphone. You can use #include <giac/giac.h> or (#include giac headers one by one) in your UI source code, then you will have to build the iphone executable linking to all the ARM object files compiled from the giac source files. You must also have cross-compiled the required libraries (i.e. GMP at least). However, I don't know how to do that precisely, you must learn how to use the iphone devkit.

Répondre