LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-20-2020, 04:05 PM   #1
thethinker
Member
 
Registered: Jul 2006
Location: Peabody, MA, USA
Distribution: Xubuntu, Slackware, Pop!_OS
Posts: 206
Blog Entries: 2

Rep: Reputation: 33
Question Possible 32 bit / 64 bit compatibility issues when compiling from source


So I am trying to install SageMath from source (actually, I'm using the SlackBuilds script, but I *wrote* that script, so....), and some libraries are not linking correctly. I'm in contact with the developers, and they've said that the following lines:

Code:
/usr/lib64/gcc/x86_64-slackware-linux/5.5.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible ///usr/lib/libm.so when searching for -lm
/usr/lib64/gcc/x86_64-slackware-linux/5.5.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible ///usr/lib/libm.a when searching for -lm
/usr/lib/libgmp.so: error adding symbols: File in wrong format
"are suspicious", and suggest that the problem is related to cross-compilation issues. That checks out - the SlackBuilds script works as intended on a vanilla Slackware installation. However, the machine I'm on now has multilib enabled, following the SlackDocs tutorial (https://docs.slackware.com/slackware:multilib). Their actual suggestion was to "reinstall gmp", but I'm afraid of doing that blind, since I might replace a single 64 bit library with a 32 bit one!

I can see that gmp is indeed one of the packages that had the 32-bit compatability done on it. Is it possible something went wrong in that process? It's kinda likely that I screwed it up, but I haven't noticed anything like this yet, and that was some time ago.

Code:
$ uname -a
Linux Zonadar 4.4.14 #1 SMP Fri Jun 24 13:30:15 CDT 2016 x86_64 Intel(R) Core(TM) i5 CPU         760  @ 2.80GHz GenuineIntel GNU/Linux
 
Old 03-20-2020, 04:11 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware FreeBSD Win10 MX
Posts: 9,839

Rep: Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118
maybe try using a sandbox
14.2 > System > sandbox (2.18)
Using chroot to build sandbox environment

Last edited by BW-userx; 03-20-2020 at 04:16 PM.
 
Old 03-20-2020, 04:14 PM   #3
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,288

Rep: Reputation: 707Reputation: 707Reputation: 707Reputation: 707Reputation: 707Reputation: 707Reputation: 707
Quote:
Originally Posted by thethinker View Post
suggest that the problem is related to cross-compilation issues. That checks out - the SlackBuilds script works as intended on a vanilla Slackware installation.
That is correct, your 64-bit compilation tries to link against 32-bit libm and libgmp (and maybe others, I cannot tell from your quote).
Maybe you should add an explicit -L/usr/lib64 -L/lib64 to your compile commandline(s), to make sure it finds the 64-bit libraries first before any 32-bit ones.
I never used a multi-lib system myself and haven't seen your SlackBuild, but in Slackware the libraries in /usr/lib:/lib (which are by default added at the end of the commandline) are the 32-bit ones, the 64-bit libraries always are in directories that end on 64, like /usr/lib64, /usr/local/lib64, etc.
 
Old 03-21-2020, 08:22 AM   #4
mickski56
LQ Newbie
 
Registered: Mar 2018
Posts: 28

Rep: Reputation: Disabled
As @ehartman says and from https://slackbuilds.org/faq/#multilib

If you are using multilib packages from somewhere and also have some 32bit packages installed, then you might run into problems with the build process trying to link 32bit libraries instead of 64bit libraries. If this occurs, it can probably be solved by placing the following line:
LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}" \after the lines for CFLAGS and CXXFLAGS passed to the configure script. In other words, make it look something like this:
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}" \
./configure \

Beyond that, you are on your own. This is an unsupported setup.

Other things to think about
Does /usr/lib64/libgmp.so actually exist and point to something ?
How is your PKG_CONFIG_PATH set, does it list /usr/lib64 & /usr/local/lib64 before anything else ?
Search config.log for libgmp and see if you can work out what's going wrong.
Run configure and see if you can bypass pkg-config for the offending library (unlikely in this case i think)

Explicit LDFLAGS added to the slackbuild work 9 times out of 10.
hth
 
1 members found this post helpful.
Old 03-21-2020, 09:23 AM   #5
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,874

Rep: Reputation: Disabled
Please share a complete build log.

Code:
./SageMath.SlackBuild 2>&1 | tee /tmp/sagemath.log
Its impossible for us to tell if those errors are the real issue or not with the information provided.

Quote:
Originally Posted by BW-userx View Post
That sandbox doesn't do what you think it does.

Its used to prevent build scripts from breaking free from their DESTDIR and writing/modifying files directly to the file system.

Code:
sandbox ./foo.SlackBuild
It will not help building SageMath, but maybe it could help find an unrelated bug(s) in the SageMath build script or build system.
 
1 members found this post helpful.
Old 03-23-2020, 01:14 PM   #6
thethinker
Member
 
Registered: Jul 2006
Location: Peabody, MA, USA
Distribution: Xubuntu, Slackware, Pop!_OS
Posts: 206

Original Poster
Blog Entries: 2

Rep: Reputation: 33
Quote:
Originally Posted by orbea View Post
Please share a complete build log.

Code:
./SageMath.SlackBuild 2>&1 | tee /tmp/sagemath.log
Its impossible for us to tell if those errors are the real issue or not with the information provided.
Done, you can check it out here:

https://www.dropbox.com/s/grmxmpdb7clxfcx/sage.log?dl=0
 
Old 03-23-2020, 01:24 PM   #7
thethinker
Member
 
Registered: Jul 2006
Location: Peabody, MA, USA
Distribution: Xubuntu, Slackware, Pop!_OS
Posts: 206

Original Poster
Blog Entries: 2

Rep: Reputation: 33
Quote:
Originally Posted by mickski56 View Post
As @ehartman says and from https://slackbuilds.org/faq/#multilib

If you are using multilib packages from somewhere and also have some 32bit packages installed, then you might run into problems with the build process trying to link 32bit libraries instead of 64bit libraries. If this occurs, it can probably be solved by placing the following line:
LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}" \after the lines for CFLAGS and CXXFLAGS passed to the configure script. In other words, make it look something like this:
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}" \
./configure \

Beyond that, you are on your own. This is an unsupported setup.
Well this is great - the SlackBuilds script does not invoke .configure. I guess that's bad form anyway, and I'll see if I can fix it.

(I took over maintenance of this script, because it was orphaned. So it's my responsibility now!)

Last edited by thethinker; 03-23-2020 at 01:46 PM. Reason: Tried it and have more information. Which was wrong!
 
Old 03-23-2020, 02:16 PM   #8
mickski56
LQ Newbie
 
Registered: Mar 2018
Posts: 28

Rep: Reputation: Disabled
Sorry is the slackbuild academic/sage/sage.SlackBuild ?

If so try
LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}" \
make build
 
Old 03-23-2020, 03:09 PM   #9
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,874

Rep: Reputation: Disabled
Quote:
Originally Posted by thethinker View Post
Thanks, this seems to be the problem.

Code:
[iml-1.0.4p1.p2] /usr/lib/libgmp.so: error adding symbols: File in wrong format
For reference the full error.

Code:
[iml-1.0.4p1.p2] /usr/bin/bash ../libtool --tag=CC   --mode=link gcc -I///usr/include -I/tmp/SBo/sage-9.0/local/include  -I. -O3 -g  -version-info 1:1:1  -L/tmp/SBo/sage-9.0/local/lib -Wl,-rpath,/tmp/SBo/sage-9.0/local/lib  -lm -o libiml.la -rpath /tmp/SBo/sage-9.0/local/lib libiml_la-basisop.lo libiml_la-certsolve.lo libiml_la-error.lo libiml_la-latreduce.lo libiml_la-memalloc.lo libiml_la-mtrans.lo libiml_la-nonsysolve.lo libiml_la-padiclift.lo libiml_la-reconsolu.lo libiml_la-RNSop.lo libiml_la-nullspace.lo -L///usr/lib -lgmp -L/tmp/SBo/sage-9.0/local/lib -lgmp -L/tmp/SBo/sage-9.0/local/lib -L/tmp/SBo/sage-9.0/local/lib -lopenblas   
[iml-1.0.4p1.p2] libtool: link: gcc -shared  -fPIC -DPIC  .libs/libiml_la-basisop.o .libs/libiml_la-certsolve.o .libs/libiml_la-error.o .libs/libiml_la-latreduce.o .libs/libiml_la-memalloc.o .libs/libiml_la-mtrans.o .libs/libiml_la-nonsysolve.o .libs/libiml_la-padiclift.o .libs/libiml_la-reconsolu.o .libs/libiml_la-RNSop.o .libs/libiml_la-nullspace.o   -L/tmp/SBo/sage-9.0/local/lib -lm -L///usr/lib /usr/lib/libgmp.so -lopenblas  -O3 -Wl,-rpath -Wl,/tmp/SBo/sage-9.0/local/lib   -Wl,-soname -Wl,libiml.so.0 -o .libs/libiml.so.0.1.1
[iml-1.0.4p1.p2] /usr/lib64/gcc/x86_64-slackware-linux/5.5.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible ///usr/lib/libm.so when searching for -lm
[iml-1.0.4p1.p2] /usr/lib64/gcc/x86_64-slackware-linux/5.5.0/../../../../x86_64-slackware-linux/bin/ld: skipping incompatible ///usr/lib/libm.a when searching for -lm
[iml-1.0.4p1.p2] /usr/lib/libgmp.so: error adding symbols: File in wrong format
[iml-1.0.4p1.p2] collect2: error: ld returned 1 exit status
[iml-1.0.4p1.p2] Makefile:373: recipe for target 'libiml.la' failed
[iml-1.0.4p1.p2] make[6]: *** [libiml.la] Error 1
[iml-1.0.4p1.p2] make[6]: Leaving directory '/tmp/SBo/sage-9.0/local/var/tmp/sage/build/iml-1.0.4p1.p2/src/src'
[iml-1.0.4p1.p2] Makefile:339: recipe for target 'all-recursive' failed
[iml-1.0.4p1.p2] make[5]: *** [all-recursive] Error 1
[iml-1.0.4p1.p2] make[5]: Leaving directory '/tmp/SBo/sage-9.0/local/var/tmp/sage/build/iml-1.0.4p1.p2/src'
[iml-1.0.4p1.p2] Makefile:270: recipe for target 'all' failed
[iml-1.0.4p1.p2] make[4]: *** [all] Error 2
[iml-1.0.4p1.p2] make[4]: Leaving directory '/tmp/SBo/sage-9.0/local/var/tmp/sage/build/iml-1.0.4p1.p2/src'
This shows the problem is not in sagemath, but in iml-1.0.4p1, specifically in the file "config/gmp-check.m4" which hardcodes "lib". I think the correct solution would be to replace the gmp-check.m4 file with a proper pkg-config check.

Additionally sage-math further hardcodes it in "build/pkgs/iml/spkg-install".

Code:
# When using GMP from a standard system location it shouldn't really
# matter what we put here, but iml's configure script requires we
# provide *something*, and this should be reasonable in most cases
SAGE_GMP_LIB="`echo "$SAGE_GMP_INCLUDE" | sed 's|/include|/lib|'`"

sdh_configure --enable-shared \
              --with-default="$SAGE_LOCAL" \
              --with-gmp-include="$SAGE_GMP_INCLUDE" \
              --with-gmp-lib="$SAGE_GMP_LIB" \
              --with-cblas="$(pkg-config --libs cblas)" \
              --with-cblas-include="$(pkg-config --cflags cblas)" \
              "$IML_CONFIGURE"
A quick workaround would be to add this to the slackbuild.

Code:
sed -i "s|/lib|/lib${LIBDIRSUFFIX}|" build/pkgs/iml/spkg-install
There may be other places that require similar fixes.
 
1 members found this post helpful.
Old 03-23-2020, 06:06 PM   #10
mickski56
LQ Newbie
 
Registered: Mar 2018
Posts: 28

Rep: Reputation: Disabled
Quote:
Originally Posted by mickski56 View Post
Sorry is the slackbuild academic/sage/sage.SlackBuild ?

If so try
LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}" \
make build
I have just tried this and sage at least built without error on my multilib install.
You will also need to add

if [ "$ARCH" = "i586" ]; then
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
else
LIBDIRSUFFIX=""
fi

somewhere just after the arch detection section of the slackbuild in order to set LIBDIRSUFFIX.
Also LIBDIRSUFFIX should probably be LIBSUFFIX
 
1 members found this post helpful.
Old 03-23-2020, 06:13 PM   #11
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,874

Rep: Reputation: Disabled
Quote:
Originally Posted by mickski56 View Post
Also LIBDIRSUFFIX should probably be LIBSUFFIX
LIBDIRSUFFIX is the what the templates contain and is standardized.

https://slackbuilds.org/templates/
 
Old 03-23-2020, 09:18 PM   #12
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 6,651

Rep: Reputation: 4387Reputation: 4387Reputation: 4387Reputation: 4387Reputation: 4387Reputation: 4387Reputation: 4387Reputation: 4387Reputation: 4387Reputation: 4387Reputation: 4387
Quote:
Originally Posted by orbea View Post
LIBDIRSUFFIX is the what the templates contain and is standardized.

https://slackbuilds.org/templates/
It might be standardized, but it isn't included in the sage.SlackBuild script.
 
Old 03-23-2020, 09:39 PM   #13
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,874

Rep: Reputation: Disabled
Maintainers are welcome to remove it in the case the build script doesn't use it and sage might not need it if their build system was fixed...
 
Old 03-25-2020, 02:42 PM   #14
thethinker
Member
 
Registered: Jul 2006
Location: Peabody, MA, USA
Distribution: Xubuntu, Slackware, Pop!_OS
Posts: 206

Original Poster
Blog Entries: 2

Rep: Reputation: 33
Quote:
Originally Posted by mickski56 View Post
I have just tried this and sage at least built without error on my multilib install.
You will also need to add

if [ "$ARCH" = "i586" ]; then
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
LIBDIRSUFFIX="64"
else
LIBDIRSUFFIX=""
fi

somewhere just after the arch detection section of the slackbuild in order to set LIBDIRSUFFIX.
Also LIBDIRSUFFIX should probably be LIBSUFFIX
Can you be more specific, like maybe attach your working script? I added these lines

Code:
if [ "$ARCH" = "i586" ]; then
    LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
    LIBDIRSUFFIX="64"
else
    LIBDIRSUFFIX=""
fi
After the SAGEROOT declaration, and then this line

Code:
LDFLAGS="-L/usr/lib${LIBDIRSUFFIX}"
right before the "make build" command, and the error persists. Here's mine:

https://www.dropbox.com/s/ed7r18j02e...lackBuild?dl=0

Last edited by thethinker; 03-25-2020 at 02:45 PM.
 
Old 03-25-2020, 03:01 PM   #15
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware FreeBSD Win10 MX
Posts: 9,839

Rep: Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118Reputation: 2118
the big thing I learned about install scripts is, that they can be edited to suit ones needs and to make it work, if is doesn't as it is already written.
Just saying.
 
  


Reply

Tags
compilation, multilib, sagemath


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to have a 32-bit compatibility driver? Shingoshi Linux - Kernel 8 06-29-2009 01:54 PM
Slackware 64 Bit .. Needs 32 bit compatibility clowther Linux - Software 3 06-06-2009 12:55 PM
32-bit compatibility on a 64-bit AMD box ?? Rod Butcher Linux - General 4 01-11-2007 05:10 PM
32 bit compatibility for 64 bit distros Phil Brooks Linux - Software 9 03-31-2005 06:27 PM
If you have a AMD 64 chip with Fedora 64 bit OS are there compatibility 32bit issues C++ Newbie Linux - Newbie 2 04-07-2004 10:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration