Opened 8 years ago

Last modified 8 years ago

#708 new bug

singular-dev package on jim contains architecture dependent (32bit) headers

Reported by: lorenz@… Owned by: mschulze
Priority: minor Milestone: 4-1-0 and higher
Component: dontKnow Version: 4-0-2
Keywords: ubuntu, package Cc: wagner@…

Description

I am trying to use libsingular on a x86_64 Ubuntu 12.04, but the same problem exists on 14.04: When using some functions the program crashes with symbol lookup failures. In the library enterid takes two int values:

nm --demangle -D /usr/lib/libSingular-4.0.2.so  | grep enterid
00000000000ba7c0 T enterid(char const*, int, int, idrec**, int, int)

The preprocessed source for the client code contains two shorts at the end:

# 136 "/usr/include/singular/misc/auxiliary.h"
typedef short BOOLEAN;
...
idhdl enterid(const char * a, int lev, int t, idhdl* root, BOOLEAN init=1, BOOLEAN serach=1);

The reason seems to be that the files /usr/include/singular/{singularconfig.h,libpolysconfig.h} from the singular-dev package were configured for a 32 bit system:

#define AC_CONFIGURE_ARGS " '--build=i686-linux-gnu' ...

and later:

/* The size of `long', as computed by sizeof. */
#ifndef SIZEOF_LONG
#define SIZEOF_LONG 4
#endif

/* "i686" */
#ifndef SI_CPU_I386
#define SI_CPU_I386 1
#endif

But the library is 64 bit and was probably built with SIZEOF_LONG = 8:

file /usr/lib/libSingular-4.0.2.so 
/usr/lib/libSingular-4.0.2.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x8c112bfd66b3b56d345fccda9d7b65ca71188ee0, stripped

Change History (5)

comment:1 Changed 8 years ago by Oleksandr

Can you run Singular -v? What is the output?

comment:2 Changed 8 years ago by anonymous

yes:

$ Singular -v
Singular for x86_64-Linux version 4.0.2 (4020, 64 bit) Mar  4 2015 09:32:57 #d00f4f0|MMMM
with
	GMP(5.0.2),NTL(5.4.2),factory(@(#) factoryVersion = 4.0.1),
	static readline,Plural,DBM,
	dynamic modules,dynamic p_Procs,OM_NDEBUG,SING_NDEBUG,CC:OPTIMIZE,eigenvalues,Gauss-Manin system,random=1425986443
built-in modules: {}
AC_CONFIGURE_ARGS =  '--build=x86_64-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--libexecdir=${prefix}/lib/singular' '--disable-maintainer-mode' '--disable-dependency-tracking' '--enable-gfanlib' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security' --enable-omalloc  OMALLOC_LIBS='/tmp/wd_singular/debSingular/singular-4.0.2/omalloc/libomalloc.la' OMALLOC_INCLUDES='-I/tmp/wd_singular/debSingular/singular-4.0.2' --with-Singular RESOURCES_LIBS='/tmp/wd_singular/debSingular/singular-4.0.2/resources/libresources.la' RESOURCES_INCLUDES='-I/tmp/wd_singular/debSingular/singular-4.0.2 ' FACTORY_LIBS='/tmp/wd_singular/debSingular/singular-4.0.2/factory/libfactory.la' FACTORY_INCLUDES='-I/tmp/wd_singular/debSingular/singular-4.0.2 -I/tmp/wd_singular/debSingular/singular-4.0.2/factory/include',
CC = gcc,FLAGS : -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security  -pipe -fno-common -O3 -Wno-unused-function -Wno-trigraphs -Wno-unused-parameter -Wunknown-pragmas -Wno-unused-variable -fomit-frame-pointer -fwrapv -fvisibility=default -finline-functions -fno-exceptions -funroll-loops ,
CXX = g++,FLAGS : -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -pipe -fno-common -O3 -Wno-unused-function -Wno-trigraphs -Wno-unused-parameter -Wunknown-pragmas -Wno-unused-variable -fomit-frame-pointer -fwrapv -fvisibility=default -finline-functions -fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-enforce-eh-specs -fconserve-space -funroll-loops,
DEFS : ,CPPFLAGS : -D_FORTIFY_SOURCE=2,
LDFLAGS : -Wl,-Bsymbolic-functions -Wl,-z,relro -pipe -fno-common -O3 -Wno-unused-function -Wno-trigraphs -Wno-unused-parameter -Wunknown-pragmas -Wno-unused-variable -fomit-frame-pointer -fwrapv -fvisibility=default -finline-functions -fno-exceptions -funroll-loops  -rdynamic -Wl,-undefined,dynamic_lookup,LIBS : -lreadline -ltermcap -lrt -lpthread  (ver: 4.6.3)
argv[0]   :	Singular
SearchPath:	/usr/bin/../share/singular/LIB:/usr/bin/../share/factory:/usr/lib/singular/singular/MOD:/usr/bin
Singular  :	/usr/bin/Singular
BinDir    :	/usr/bin
ProcDir   :	/usr/lib/singular/singular/MOD
RootDir   :	/usr/bin/..
DataDir   :	/usr/bin/../share
DefaultDir:	/usr
InfoFile  :	
IdxFile   :	
HtmlDir   :	
ExDir     :	
Path      :	/usr/bin:/usr/lib/singular/singular/MOD:/home/forti/root/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/bin:/usr/games
emacs     :	
xemacs    :	
SingularEmacs:	/usr/bin/Singular
EmacsLoad :	/usr/bin/../share/singular/emacs/.emacs-singular
EmacsDir  :	/usr/bin/../share/singular/emacs
SingularXterm:	/usr/bin/Singular
xterm     :	/usr/bin/xterm
EmacsDir  :	/usr/bin/../share/singular/emacs
Available HelpBrowsers: firefox-www, konqueror-www, dummy, emacs, 
Current HelpBrowser: firefox-www 
                     SINGULAR                                 /
 A Computer Algebra System for Polynomial Computations       /   version 4.0.2
                                                           0<
 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann     \   Feb 2015
FB Mathematik der Universitaet, D-67653 Kaiserslautern        \
> 

It probably only affects programs trying to link against libsingular.

The complete list of configure args in the singularconfig header is:

/* ac_configure_args */
#ifndef AC_CONFIGURE_ARGS
#define AC_CONFIGURE_ARGS " '--build=i686-linux-gnu' '--prefix=/usr' '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' '--sysconfdir=/etc' '--localstatedir=/var' '--libexecdir=${prefix}/lib/singular' '--disable-maintainer-mode' '--disable-dependency-tracking' '--enable-gfanlib' 'build_alias=i686-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2' 'CXXFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security' --enable-omalloc  OMALLOC_LIBS='/tmp/wd_singular/debSingular/singular-4.0.2/omalloc/libomalloc.la' OMALLOC_INCLUDES='-I/tmp/wd_singular/debSingular/singular-4.0.2' --with-Singular RESOURCES_LIBS='/tmp/wd_singular/debSingular/singular-4.0.2/resources/libresources.la' RESOURCES_INCLUDES='-I/tmp/wd_singular/debSingular/singular-4.0.2 ' FACTORY_LIBS='/tmp/wd_singular/debSingular/singular-4.0.2/factory/libfactory.la' FACTORY_INCLUDES='-I/tmp/wd_singular/debSingular/singular-4.0.2 -I/tmp/wd_singular/debSingular/singular-4.0.2/factory/include'"
#endif

PS: I had to remove the ManualUrl from the output to satisfy the spam check...

comment:3 Changed 8 years ago by Oleksandr

Singular looks fine. What libraries does it need (e.g. ldd Singular)?

And yes, those headers /usr/include/singular/{singularconfig.h,libpolysconfig.h} look like a 32-bit build. Clearly they can only be used together with 32-bit shared libraries... Do you have 32-bit shared libraries installed in parallel?

Are you sure that those 32-bit headers are bundled together with your 64-bit Singular executable and /usr/lib/libSingular-4.0.2.so in a single package?

comment:4 Changed 8 years ago by anonymous

These headers are not in the same package as the library but in the dev package:

$ dpkg-query -L singular-dev | grep 'singularconfig.h\|libpolysconfig.h'
/usr/include/singular/singularconfig.h
/usr/include/singular/libpolysconfig.h

This package is supposed to be architecture independent but these files are not:

$ apt-cache show singular-dev
Package: singular-dev
Source: singular
Version: 4.0.2-1
Architecture: all
Maintainer: Mathias Schulze <mschulze@mathematik.uni-kl.de>
Installed-Size: 1376
Priority: optional
Section: math
Filename: pool/main/s/singular/singular-dev_4.0.2-1_all.deb
Size: 281222
SHA256: 04da0505341e6f7058cbe19fa5cf5f4e6e16c811a9e616cadcdf97b20f65d3ce
SHA1: bd18d33922ab3264e0d0e3389d418479e6a358bf
MD5sum: 9b7aeaef2acd1b1028a1921698be0cc4
Description: computer algebra system for polynomial computations (development)
 Singular is a computer algebra system for polynomial computations with
 emphasis on the special needs of commutative algebra, algebraic geometry,
 and singularity theory.
 .
 This package contains development files.

The library is contained in the singular-bin package (amd64 version):

$ dpkg-query -L singular-bin | grep libSingular
/usr/lib/libSingular.la
/usr/lib/libSingular.a
/usr/lib/libSingular-4.0.2.so
/usr/lib/libSingular.so

$ apt-cache show singular-bin
Package: singular-bin
Source: singular
Version: 4.0.2-1
Architecture: amd64
Maintainer: Mathias Schulze <mschulze@mathematik.uni-kl.de>
Installed-Size: 39319
Depends: libc6 (>= 2.15), libcdd0, libgcc1 (>= 1:4.1.1), libgmp10, libntl-5.4.2, libreadline6 (>= 6.0), libstdc++6 (>= 4.6)
Priority: optional
Section: math
Filename: pool/main/s/singular/singular-bin_4.0.2-1_amd64.deb
Size: 12444246
SHA256: 513b715f83512f37666e148caa2318e378c5fa1fe1644724d6a432c28e1225ef
SHA1: 6f1317ef450a1d27348d611911f2ce4a92db87d6
MD5sum: 91fa39be04527bb8b2fa22f2680951ac
Description: computer algebra system for polynomial computations (binary files)
 Singular is a computer algebra system for polynomial computations with
 emphasis on the special needs of commutative algebra, algebraic geometry,
 and singularity theory.
 .
 This package contains binary files.

I did not install any 32bit singular packages. There are a few unrelated 32 bit libraries in /usr/lib32.

The library needs:

$ ldd /usr/lib/libSingular-4.0.2.so 
	linux-vdso.so.1 =>  (0x00007fff77eb6000)
	libpolys-4.0.2.so => /usr/lib/libpolys-4.0.2.so (0x00007f827a7bb000)
	libfactory-4.0.2.so => /usr/lib/libfactory-4.0.2.so (0x00007f827a412000)
	libresources-4.0.2.so => /usr/lib/libresources-4.0.2.so (0x00007f827a20b000)
	libomalloc-0.9.6.so => /usr/lib/libomalloc-0.9.6.so (0x00007f8279ff8000)
	libgmp.so.10 => /usr/lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f8279d8a000)
	libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6 (0x00007f8279b47000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f827992a000)
	libstdc++.so.6 => /usr/local/lib/libstdc++.so.6 (0x00007f8279626000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8279329000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8278f6a000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8278d66000)
	libntl-5.4.2.so => /usr/lib/libntl-5.4.2.so (0x00007f8278997000)
	libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f8278770000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f827b0fe000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f827855a000)

comment:5 Changed 8 years ago by Oleksandr

Owner: changed from somebody to mschulze

well, clearly singular-dev is architecture dependent at the moment (32-bit only) since it contains all the *config.h.

@Mathias: I hope that Mathias will be able to resolve the issue with singular-dev.

As a work around - i would suggest the following: remove all singular* packages, build Singular from sources & install it locally. It is also the best approach for you as it enables debugging.

Note: See TracTickets for help on using tickets.