segfault with 0.6.2 on Nokia n800

Bugs

Modérateur : xcasadmin

Répondre
Simon Pickering
Messages : 7
Inscription : mer. févr. 21, 2007 9:57 am

segfault with 0.6.2 on Nokia n800

Message par Simon Pickering » mar. févr. 27, 2007 6:10 pm

I've compiled giac/xcas 0.6.2 for the Nokia N800 using GCC 3.4.4, but when I run the program (icas for example), I get a segfault. This is the output of the gdb backtrace:

Nokia-N800-51:/home/user# LD_LIBRARY_PATH=/home/user:$LD_LIBRARY_PATH gdb ./icas
GNU gdb 6.4
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "arm-linux-gnueabi"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) r
Starting program: /home/user/icas

Program received signal SIGSEGV, Segmentation fault.
0x41851380 in std::string::compare () from /usr/lib/libstdc++.so.6
(gdb) bt
#0 0x41851380 in std::string::compare () from /usr/lib/libstdc++.so.6
#1 0x0005fa28 in std::operator< <char, std::char_traits<char>, std::allocator<char> > (__lhs=@0x10, __rhs=@0xbee6d518) at basic_string.h:2149
#2 0x401dd260 in std::less<std::string>::operator() (this=0x406e3374, __x=@0x10, __y=@0xbee6d518) at stl_function.h:227
#3 0x401dd7fc in std::_Rb_tree<std::string, std::pair<std::string const, giac::gen>, std::_Select1st<std::pair<std::string const, giac::gen> >, std::less<std::string>, std::allocator<std::pair<std::string const, giac::gen> > >::insert_unique (this=0x406e3374, __position={_M_node = 0x406e3378}, __v=@0xbee6d518)
at stl_tree.h:905
#4 0x401dd378 in std::map<std::string, giac::gen, std::less<std::string>, std::allocator<std::pair<std::string const, giac::gen> > >::insert (
this=0x406e3374, position={_M_node = 0x406e3378}, __x=@0xbee6d518) at stl_map.h:384
#5 0x401dccc4 in std::map<std::string, giac::gen, std::less<std::string>, std::allocator<std::pair<std::string const, giac::gen> > >::operator[] (
this=0x406e3374, __k=@0x406cfff0) at stl_map.h:339
#6 0x405366f4 in giac::lexer_functions_register (u=@0x406d000c, s=@0x406cfff0, parser_token=1) at input_lexer.ll:114
#7 0x404ad354 in unary_function_ptr (this=0x406d000c, myptr=0x406cffec, myquoted=0, parser_token=1) at unary.cc:75
#8 0x40131a7c in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at sym2poly.cc:167
#9 0x40132e88 in global constructors keyed to _ZN4giac8dbgprintERKNS_6tensorINS_3genEEE () at sym2poly.cc:2254
#10 0x4100b28c in _dl_rtld_di_serinfo () from /lib/ld-linux.so.3
#11 0x00026980 in ?? ()
#12 0x00026980 in ?? ()
Previous frame identical to this frame (corrupt stack?)

Any help with this would be appreciated.


Simon

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

Message par parisse » mar. févr. 27, 2007 7:43 pm

It's the static initialization ordering that is faulty. input_lexer.o must be loaded before any object file that contains an auto-registering function. Look at Makefile.ipaq how the object files are loaded, you might have to change the ordering (probably reverse) of the files in the Makefile to build the library or icas.

Simon Pickering
Messages : 7
Inscription : mer. févr. 21, 2007 9:57 am

Message par Simon Pickering » mar. févr. 27, 2007 10:22 pm

Right, I moved input_lexer.o to be the first module, and now I get the following (slightly different, but the same end location for the segfault):

Program received signal SIGSEGV, Segmentation fault.
0x41851384 in std::string::compare () from /usr/lib/libstdc++.so.6
(gdb) bt
#0 0x41851384 in std::string::compare () from /usr/lib/libstdc++.so.6
#1 0x0002b9ac in std::operator==<char, std::char_traits<char>, std::allocator<char> > (__lhs=@0x1b4368, __rhs=@0x0) at basic_string.h:2075
#2 0x4054111c in giac::operator== (a=@0xbeabfa80, b=@0xbeabfa70) at gen.cc:6982
#3 0x40508760 in giac::is_inf (e=@0x406dfe18) at gen.cc:134
#4 0x40531dd4 in giac::sym_mult (a=@0x406dfe18, b=@0x406dfd58) at gen.cc:5279
#5 0x4052d9e4 in $a () at gen.cc:4757
#6 0x404a57d4 in $a () at prog.cc:5576
#7 0x404b51a4 in global constructors keyed to _ZN4giac16giac_modules_tabE () at prog.cc:5839
#8 0x4100b28c in _dl_rtld_di_serinfo () from /lib/ld-linux.so.3
#9 0x00026980 in ?? ()
#10 0x00026980 in ?? ()
Previous frame identical to this frame (corrupt stack?)

Is this again something to do with the object file ordering, or is there something wrong with the string compare function (or the way it's called). I note this is GCC 3.4.4, which is a later version than that recommended in the installation notes. It's not something funny like the compare function having changed?

Thanks,


Simon

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

Message par parisse » mer. févr. 28, 2007 9:01 am

I'm using arm-linux-g++ (GCC) 3.4.1, I suggest that you try the same ordering as I do in Makefile.ipaq:
GIACOBJS = sym2poly.o gausspol.o maple.o ti89.o mathml.o moyal.o misc.o permu.o quater.o desolve.o input_parser.o symbolic.o index.o modpoly.o modfactor.o ezgcd.o derive.o solve.o intg.o risch.o lin.o series.o subst.o vecteur.o tex.o global.o ifactor.o alg_ext.o gauss.o isom.o help.o plot.o plot3d.o rpn.o prog.o pari.o unary.o usual.o identificateur.o gen.o input_lexer.o softmath.o
There are indeed other initializations that must be done in the right order (and unfortunately I don't know how you can tell this to the linker).[/code]

Simon Pickering
Messages : 7
Inscription : mer. févr. 21, 2007 9:57 am

Message par Simon Pickering » mer. févr. 28, 2007 6:57 pm

I modified the Makefile.ipaq makefile and used that to build the xcas binary, however there's still a segfault:

Program received signal SIGSEGV, Segmentation fault.
0x41851384 in std::string::compare () from /usr/lib/libstdc++.so.6
(gdb) bt
#0 0x41851384 in std::string::compare () from /usr/lib/libstdc++.so.6
#1 0x001d6038 in std::operator==<char, std::char_traits<char>, std::allocator<char> > ()
#2 0x004b1920 in giac::operator== ()
#3 0x0047a9fc in giac::is_inf ()
#4 0x004a2efc in giac::sym_mult ()
#5 0x0049ed68 in giac::operator* ()
#6 0x407a17d4 in $a () at prog.cc:5576
#7 0x407b11a4 in global constructors keyed to _ZN4giac16giac_modules_tabE () at prog.cc:5839
#8 0x4100b28c in _dl_rtld_di_serinfo () from /lib/ld-linux.so.3
#9 0x000e1430 in ?? ()
#10 0x000e1430 in ?? ()
Previous frame identical to this frame (corrupt stack?)

I'm not sure what else to try.


Simon

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

Message par parisse » mer. févr. 28, 2007 7:18 pm

Did you try to build xcas exactly with the Makefile.ipaq or did you build a shared library and xcas or icas linked with the shared lib? If build exactly like I build it, does it work? I'll try to build icas as soon as possible for linux ARM to see if I get the same problem (I'm afraid I'll have problem to debug if it does not work since I don't have a building ARM platform)

Simon Pickering
Messages : 7
Inscription : mer. févr. 21, 2007 9:57 am

Message par Simon Pickering » mer. févr. 28, 2007 11:13 pm

I built it using the ipaq Makefile with a few changes:

changed include & library search paths
changed the majority of the static libs to be dynamic. I left fltk* as static.
Removed the softmath module as the N800 has hardware floating point.

I had to build libgiac as without linking against this I get some errors - so I did a build using the normal Makefile first to create this lib. The errors are as follows:

[sbox-SDK_ARMEL: ~/build/giac/giac-0.6.2/src] > make -f Makefile.n800
arm-linux-g++ -s -g -mfpu=vfp -mfloat-abi=softfp -I.. -I. -I/include -I/usr/include -I/usr/X11R6/include -I/usr/local/include -I/usr/local/arm-linux/include -I/usr/local/arm-linux/usr/include -I/usr/local/arm-linux/usr/local/include -I/usr/local/arm-linux/usr/X11R6/include sym2poly.o gausspol.o maple.o ti89.o mathml.o moyal.o misc.o permu.o quater.o desolve.o input_parser.o symbolic.o index.o modpoly.o modfactor.o ezgcd.o derive.o solve.o intg.o risch.o lin.o series.o subst.o vecteur.o tex.o global.o ifactor.o alg_ext.o gauss.o isom.o help.o plot.o plot3d.o rpn.o prog.o pari.o unary.o usual.o identificateur.o gen.o input_lexer.o hist.o History.o Input.o Xcas1.o Equation.o Print.o Tableur.o Editeur.o Flv_CStyle.o Flve_Check_Button.o Flve_Input.o Flv_Style.o Flv_Data_Source.o Flve_Combo.o Flv_List.o Flv_Table.o Graph.o Graph3d.o Help1.o gl2ps.o -o xcas /usr/local/lib/libfltk_images.a /usr/local/lib/libfltk.a /usr/local/lib/libfltk_gl.a -L/lib -L/usr/lib -L/usr/X11R6/lib -L/usr/local/lib -L/usr/local/arm-linux/lib -L/usr/local/arm-linux/usr/lib -L/usr/local/arm-linux/usr/local/lib -L/usr/local/arm-linux/usr/X11R6/lib -lGL -lGLU -lXext -lX11 -lXau -ldl -lpng12 -ljpeg -lz -lgmp -lpthread -lstdc++ -lgmp -lmpfr -lpng12 -lgslcblas -lreadline -lhistory
gausspol.o: In function `giac::mod_factor(giac::tensor<giac::gen> const&, giac::tensor<giac::gen>&, int, std::vector<giac::facteur<giac::tensor<giac::gen> >, std::allocator<giac::facteur<giac::tensor<giac::gen> > > >&)':/home/simon/build/giac/giac-0.6.2/src/gausspol.cc:2964: undefined reference to `NTL::vec_pair_GF2X_long::~vec_pair_GF2X_long()'
:/home/simon/build/giac/giac-0.6.2/src/gausspol.cc:2964: undefined reference to `NTL::vec_pair_GF2X_long::~vec_pair_GF2X_long()'
:/home/simon/build/giac/giac-0.6.2/src/gausspol.cc:2967: undefined reference to `NTL::ZZ_p::init(NTL::ZZ const&)'
:/home/simon/build/giac/giac-0.6.2/src/gausspol.cc:2975: undefined reference to `NTL::vec_pair_ZZ_pX_long::~vec_pair_ZZ_pX_long()'
:/home/simon/build/giac/giac-0.6.2/src/gausspol.cc:2975: undefined reference to `NTL::vec_pair_ZZ_pX_long::~vec_pair_ZZ_pX_long()'
gausspol.o: In function `~ZZ_pX':/usr/local/include/NTL/ZZ_pX.h:79: undefined reference to `NTL::vec_ZZ_p::~vec_ZZ_p()'
gausspol.o: In function `NTL::CanZass(NTL::ZZ_pX const&, long)':/usr/local/include/NTL/ZZ_pXFactoring.h:140: undefined reference to `NTL::CanZass(NTL::vec_pair_ZZ_pX_long&, NTL::ZZ_pX const&, long)'
:/usr/local/include/NTL/ZZ_pXFactoring.h:140: undefined reference to `NTL::vec_pair_ZZ_pX_long::~vec_pair_ZZ_pX_long()'
gausspol.o: In function `~ZZ':/usr/local/include/NTL/ZZ.h:77: undefined reference to `_ntl_zfree'
gausspol.o: In function `~GF2X':/usr/local/include/NTL/GF2X.h:22: undefined reference to `NTL::WordVector::~WordVector()'
gausspol.o: In function `NTL::CanZass(NTL::GF2X const&, long)':/usr/local/include/NTL/GF2XFactoring.h:35: undefined reference to `NTL::CanZass(NTL::vec_pair_GF2X_long&, NTL::GF2X const&, long)'
:/usr/local/include/NTL/GF2XFactoring.h:35: undefined reference to `NTL::vec_pair_GF2X_long::~vec_pair_GF2X_long()'
modpoly.o: In function `giac::tab2ZZX(giac::gen const*, int)':/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2365: undefined reference to `NTL::vec_ZZ::SetMaxLength(long)'
:/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2366: undefined reference to `NTL::vec_ZZ::SetLength(long)'
:/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2368: undefined reference to `NTL::SetCoeff(NTL::ZZX&, long, NTL::ZZ const&)'
modpoly.o: In function `giac::ZZX2tab(NTL::ZZX const&, int&, giac::gen*&)':/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2377: undefined reference to `NTL::coeff(NTL::ZZX const&, long)'
modpoly.o: In function `giac::modpoly2GF2X(giac::dbgprint_vector<giac::gen> const&)':/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2386: undefined reference to `NTL::SetCoeff(NTL::GF2X&, long, long)'
:/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2387: undefined reference to `NTL::operator<<(std::basic_ostream<char, std::char_traits<char> >&, NTL::GF2X const&)'
modpoly.o: In function `giac::GF2X2modpoly(NTL::GF2X const&)':/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2393: undefined reference to `NTL::deg(NTL::GF2X const&)'
:/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2396: undefined reference to `NTL::coeff(NTL::GF2X const&, long)'
modpoly.o: In function `giac::modpoly2ZZ_pX(giac::dbgprint_vector<giac::gen> const&)':/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2407: undefined reference to `NTL::ZZ_p::ZZ_p()'
:/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2409: undefined reference to `NTL::SetCoeff(NTL::ZZ_pX&, long, NTL::ZZ_p const&)'
:/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2411: undefined reference to `NTL::operator<<(std::basic_ostream<char, std::char_traits<char> >&, NTL::ZZ_pX const&)'
modpoly.o: In function `giac::ZZ_pX2modpoly(NTL::ZZ_pX const&)':/home/simon/build/giac/giac-0.6.2/src/modpoly.cc:2420: undefined reference to `NTL::coeff(NTL::ZZ_pX const&, long)'
modpoly.o: In function `NTL::ZZ::operator=(NTL::ZZ const&)':/usr/local/include/NTL/ZZ.h:72: undefined reference to `_ntl_zcopy1'
modpoly.o: In function `NTL::add(NTL::ZZ&, NTL::ZZ const&, NTL::ZZ const&)':/usr/local/include/NTL/ZZ.h:289: undefined reference to `_ntl_zadd'
modpoly.o: In function `NTL::mul(NTL::ZZ&, NTL::ZZ const&, NTL::ZZ const&)':/usr/local/include/NTL/ZZ.h:384: undefined reference to `_ntl_zmul'
modpoly.o: In function `NTL::ZZ::operator=(long)':/usr/local/include/NTL/ZZ.h:74: undefined reference to `_ntl_zintoz1'
modpoly.o: In function `ZZ':/usr/local/include/NTL/ZZ.h:57: undefined reference to `_ntl_zcopy1'
modpoly.o: In function `NTL::conv(long&, NTL::ZZ const&)':/usr/local/include/NTL/ZZ.h:180: undefined reference to `_ntl_ztoint'
modpoly.o: In function `NTL::sub(NTL::ZZ&, NTL::ZZ const&, NTL::ZZ const&)':/usr/local/include/NTL/ZZ.h:294: undefined reference to `_ntl_zsub'
modpoly.o: In function `NTL::div(NTL::ZZ&, NTL::ZZ const&, NTL::ZZ const&)':/usr/local/include/NTL/ZZ.h:477: undefined reference to `_ntl_zdiv'
modpoly.o: In function `NTL::operator==(NTL::ZZ const&, long)':/usr/local/include/NTL/ZZ.h:264: undefined reference to `_ntl_zscompare'
modpoly.o: In function `NTL::negate(NTL::ZZ&, NTL::ZZ const&)':/usr/local/include/NTL/ZZ.h:304: undefined reference to `_ntl_zcopy1'
:/usr/local/include/NTL/ZZ.h:304: undefined reference to `_ntl_znegate'
modpoly.o: In function `NTL::operator<(NTL::ZZ const&, long)':/usr/local/include/NTL/ZZ.h:266: undefined reference to `_ntl_zscompare'
modpoly.o: In function `~ZZX':/usr/local/include/NTL/ZZX.h:44: undefined reference to `NTL::vec_ZZ::~vec_ZZ()'
modpoly.o: In function `vec_ZZ':/usr/local/include/NTL/vec_ZZ.h:10: undefined reference to `NTL::vec_ZZ::operator=(NTL::vec_ZZ const&)'
modpoly.o: In function `NTL::rem(NTL::ZZ&, NTL::ZZ const&, NTL::ZZ const&)':/usr/local/include/NTL/ZZ.h:482: undefined reference to `_ntl_zmod'
modpoly.o: In function `NTL::ZZ_p::modulus()':/usr/local/include/NTL/ZZ_p.h:172: undefined reference to `NTL::ZZ_pInfo'
modpoly.o: In function `NTL::GCD(NTL::ZZX const&, NTL::ZZX const&)':/usr/local/include/NTL/ZZX.h:614: undefined reference to `NTL::GCD(NTL::ZZX&, NTL::ZZX const&, NTL::ZZX const&)'
modfactor.o: In function `giac::ntlfactor(giac::gen*, int, giac::gen**, int*, int)':/home/simon/build/giac/giac-0.6.2/src/modfactor.cc:858: undefined reference to `NTL::factor(NTL::ZZ&, NTL::vec_pair_ZZX_long&, NTL::ZZX const&, long, long)'
:/home/simon/build/giac/giac-0.6.2/src/modfactor.cc:865: undefined reference to `NTL::vec_pair_ZZX_long::~vec_pair_ZZX_long()'
:/home/simon/build/giac/giac-0.6.2/src/modfactor.cc:865: undefined reference to `NTL::vec_pair_ZZX_long::~vec_pair_ZZX_long()'
pari.o: In function `giac::do_giac_pari_init(long)':/home/simon/build/giac/giac-0.6.2/src/pari.cc:59: undefined reference to `pari_init_opts'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:64: undefined reference to `functions_basic'
pari.o: In function `giac::GEN2string(long* const&)':/home/simon/build/giac/giac-0.6.2/src/pari.cc:198: undefined reference to `GENtostr'
pari.o: In function `evallg':../src/kernel/none/level1.h:180: undefined reference to `pari_err'
pari.o: In function `new_chunk':../src/kernel/none/level1.h:229: undefined reference to `pari_err'
:../src/kernel/none/level1.h:246: undefined reference to `avma'
:../src/kernel/none/level1.h:246: undefined reference to `bot'
pari.o: In function `utoi':../src/kernel/none/level1.h:486: undefined reference to `gen_0'
pari.o: In function `giac::ingen2GEN(giac::gen const&, giac::dbgprint_vector<giac::gen> const&, giac::context const*)':/home/simon/build/giac/giac-0.6.2/src/pari.cc:426: undefined reference to `gp_read_str'
pari.o: In function `stoi':../src/kernel/none/level1.h:492: undefined reference to `gen_0'
pari.o: In function `giac::gen2GEN(giac::gen const&, giac::dbgprint_vector<giac::gen> const&, giac::context const*)':/home/simon/build/giac/giac-0.6.2/src/pari.cc:434: undefined reference to `GP_DATA'
pari.o: In function `giac::pari_isprime(giac::gen const&)':/home/simon/build/giac/giac-0.6.2/src/pari.cc:439: undefined reference to `gisprime'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:442: undefined reference to `avma'
pari.o: In function `giac::pari_ifactor(giac::gen const&)':/home/simon/build/giac/giac-0.6.2/src/pari.cc:447: undefined reference to `factorint'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:451: undefined reference to `avma'
pari.o: In function `giac::pari_exec(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, giac::context const*)':/home/simon/build/giac/giac-0.6.2/src/pari.cc:499: undefined reference to `gp_read_str'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:504: undefined reference to `avma'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:504: undefined reference to `PARI_stack_limit'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:504: undefined reference to `GP_DATA'
pari.o: In function `giac::_pari(giac::gen const&, giac::context const*)':/home/simon/build/giac/giac-0.6.2/src/pari.cc:620: undefined reference to `functions_basic'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:620: undefined reference to `GP_DATA'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:620: undefined reference to `precdl'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:620: undefined reference to `precreal'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:620: undefined reference to `gnil'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:620: undefined reference to `PARI_stack_limit'
:/home/simon/build/giac/giac-0.6.2/src/pari.cc:620: undefined reference to `avma'
pari.o: In function `giac::pari_help(giac::gen const&)':/home/simon/build/giac/giac-0.6.2/src/pari.cc:725: undefined reference to `functions_basic'
collect2: ld returned 1 exit status
make: *** [xcas] Error 1

In retrospect, these look like they could be sorted out by linking directly against libpari and libntl, I'll give that a go and remove libgiac from the mix.


The Makefile I used (successfully - by adding libgiac) is as follows:

# -*- mode:Makefile -*-
CXXFLAGS = -g -mfpu=vfp -mfloat-abi=softfp -I.. -I. -I/include -I/usr/include -I/usr/X11R6/include -I/usr/local/include -I/usr/local/arm-linux/include -I/usr/local/arm-linux/usr/include -I/usr/local/arm-linux/usr/local/include -I/usr/local/arm-linux/usr/X11R6/include
OBJS = hist.o History.o Input.o Xcas1.o Equation.o Print.o Tableur.o Editeur.o Flv_CStyle.o Flve_Check_Button.o Flve_Input.o Flv_Style.o Flv_Data_Source.o Flve_Combo.o Flv_List.o Flv_Table.o Graph.o Graph3d.o Help1.o gl2ps.o
GIACOBJS = sym2poly.o gausspol.o maple.o ti89.o mathml.o moyal.o misc.o permu.o quater.o desolve.o input_parser.o symbolic.o index.o modpoly.o modfactor.o ezgcd.o derive.o solve.o intg.o risch.o lin.o series.o subst.o vecteur.o tex.o global.o ifactor.o alg_ext.o gauss.o isom.o help.o plot.o plot3d.o rpn.o prog.o pari.o unary.o usual.o identificateur.o gen.o input_lexer.o
LIBS = -L/lib -L/usr/lib -L/usr/X11R6/lib -L/local/lib -L/local/arm-linux/lib -L/local/arm-linux/usr/lib -L/local/arm-linux/usr/local/lib -L/local/arm-linux/usr/X11R6/lib -lmpfr -lfltk_images -lfltk -lGL -lGLU -ljpeg -lpng -lz -lX11 -lXext -lgsl -lgslcblas -lgmp -ldl -lpthread
STATLIBS = /usr/local/lib/libfltk_images.a /usr/local/lib/libfltk.a /usr/local/lib/libfltk_gl.a -L/lib -L/usr/lib -L/usr/X11R6/lib -L/usr/local/lib -L/usr/local/arm-linux/lib -L/usr/local/arm-linux/usr/lib -L/usr/local/arm-linux/usr/local/lib -L/usr/local/arm-linux/usr/X11R6/lib -lGL -lGLU -lXext -lX11 -lXau -ldl -lpng12 -ljpeg -lz -lgmp -lpthread -lstdc++ -L./.libs/ -lgiac -lgmp -lmpfr -lpng12 -lgslcblas -lreadline -lhistory
DYNLIBS = -L/usr/local/lib -L/usr/X11R6/lib -lX11 -lXext -lgiac -lgmp -lmpfr -lpng12 -lgslcblas -lreadline -lhistory -lncurses
# For windows: remove -ldl in LIBS above and uncomment WLIBS below, + -DWIN32
# For linux: add -ldl in LIBS and comment WLIBS
xcas: $(OBJS) $(GIACOBJS)
# arm-linux-g++ $(CXXFLAGS) $(OBJS) -o xcasnew $(DYNLIBS) $(LIBS)
# arm-linux-g++ $(CXXFLAGS) $(GIACOBJS) $(OBJS) -o xcasnew $(LIBS) #$(WLIBS)
arm-linux-g++ -s $(CXXFLAGS) $(GIACOBJS) $(OBJS) -o xcas $(STATLIBS)
hist.o: hist.cxx
arm-linux-g++ $(CXXFLAGS) -c hist.cxx
hist.cxx: hist.fl
fluid -c hist.fl
Help1.o: Help1.cc
arm-linux-g++ $(CXXFLAGS) -c Help1.cc
.cc.o:
arm-linux-g++ $(CXXFLAGS) -c $<
.c.o:
arm-linux-g++ $(CXXFLAGS) -c $<
clean:
rm -f $(OBJS)

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

Message par parisse » jeu. mars 01, 2007 8:12 am

Indeed, I do not build the ipaq version with pari and NTL myself (I use config.h.ipaq as config.h file). If you have built using ./configure and have NTL and pari, you should link to them. For the libgiac version, it's the Makefile.am that should be modified to have the right module load ordering in the library.

Simon Pickering
Messages : 7
Inscription : mer. févr. 21, 2007 9:57 am

Message par Simon Pickering » jeu. mars 01, 2007 2:06 pm

I built using the Makefile.ipaq and config.h.ipaq (some modifications to the Makefile.ipaq to allow the correct search paths, etc., but leaving the order of the .o file as they were). I get a segfault:

Program received signal SIGSEGV, Segmentation fault.
0x41851380 in std::string::compare () from /usr/lib/libstdc++.so.6
(gdb) bt
#0 0x41851380 in std::string::compare () from /usr/lib/libstdc++.so.6
#1 0x0002c6a0 in std::operator+<char, std::char_traits<char>, std::allocator<char> > ()
#2 0x000b59c0 in std::operator+<char, std::char_traits<char>, std::allocator<char> > ()
#3 0x000b5f5c in std::operator+<char, std::char_traits<char>, std::allocator<char> > ()
#4 0x000b5ad8 in std::operator+<char, std::char_traits<char>, std::allocator<char> > ()
#5 0x000b5424 in std::operator+<char, std::char_traits<char>, std::allocator<char> > ()
#6 0x003de508 in __gmpz_perfect_square_p ()
#7 0x0035eac0 in std::operator<< <double, char, std::char_traits<char> > ()
#8 0x00027e3c in ?? ()

I then copied the order of the Makefile.ipaq .o files into the standard Makefile.am, and compiled with that. I get a segfault:

Program received signal SIGSEGV, Segmentation fault.
0x41851380 in std::string::compare () from /usr/lib/libstdc++.so.6
(gdb) bt
#0 0x41851380 in std::string::compare () from /usr/lib/libstdc++.so.6
#1 0x0005fa28 in std::operator< <char, std::char_traits<char>, std::allocator<char> > (__lhs=@0x10, __rhs=@0xbea19518) at basic_string.h:2149
#2 0x401dd260 in std::less<std::string>::operator() (this=0x406e3374, __x=@0x10, __y=@0xbea19518) at stl_function.h:227
#3 0x401dd7fc in std::_Rb_tree<std::string, std::pair<std::string const, giac::gen>, std::_Select1st<std::pair<std::string const, giac::gen> >, std::less<std::string>, std::allocator<std::pair<std::string const, giac::gen> > >::insert_unique (this=0x406e3374, __position={_M_node = 0x406e3378}, __v=@0xbea19518)
at stl_tree.h:905
#4 0x401dd378 in std::map<std::string, giac::gen, std::less<std::string>, std::allocator<std::pair<std::string const, giac::gen> > >::insert (
this=0x406e3374, position={_M_node = 0x406e3378}, __x=@0xbea19518) at stl_map.h:384
#5 0x401dccc4 in std::map<std::string, giac::gen, std::less<std::string>, std::allocator<std::pair<std::string const, giac::gen> > >::operator[] (
this=0x406e3374, __k=@0x406cfff0) at stl_map.h:339
#6 0x405366f4 in giac::lexer_functions_register (u=@0x406d000c, s=@0x406cfff0, parser_token=1) at input_lexer.ll:114
#7 0x404ad354 in unary_function_ptr (this=0x406d000c, myptr=0x406cffec, myquoted=0, parser_token=1) at unary.cc:75
#8 0x40131a7c in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at sym2poly.cc:167
#9 0x40132e88 in global constructors keyed to _ZN4giac8dbgprintERKNS_6tensorINS_3genEEE () at sym2poly.cc:2254
#10 0x4100b28c in _dl_rtld_di_serinfo () from /lib/ld-linux.so.3
#11 0x00026980 in ?? ()
#12 0x00026980 in ?? ()
Previous frame identical to this frame (corrupt stack?)

I then reveresed the order of the .o files (so that input_lexer.ll is first in the list rather than last as it is for the Makefile.ipaq makefile) and compiled again, and received exactly the same segfault as with the object files in the same order as in Makefile.ipaq (shown immediately above this paragraph).

Therefore, I can't see that it can be to do with the object file ordering. Do you have any other suggestions? I must try compiling on x86 and see whether I get any errors. If I had an iPAQ, I'd do a compile for that (I do have a Zaurus, so I may try compiling for that to see whether I get the same error).

Thanks,


Simon

Simon Pickering
Messages : 7
Inscription : mer. févr. 21, 2007 9:57 am

Message par Simon Pickering » jeu. mars 01, 2007 2:12 pm

Looking at the error messages, specifically this line:

#1 0x0005fa28 in std::operator< <char, std::char_traits<char>, std::allocator<char> > (__lhs=@0x10, __rhs=@0xbea19518) at basic_string.h:2149

I'm assuming that the lhs and rhs are supposed to be addresses of something . Iooks like they should point to these:

const basic_string<_CharT, _Traits, _Alloc>& __lhs

const basic_string<_CharT, _Traits, _Alloc>& __rhs

Is an address of 0x10 therefore not a little strange?


Simon

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

Message par parisse » jeu. mars 01, 2007 2:37 pm

Yes, 0x10 is definitively strange. I bet there is some infinite recursion somewhere and the stack got corrupted. Another suggestion could be to run gdb and put breakpoints at static initialization code lines in a few source files and see when the segfault happens.

Répondre