Opened 12 years ago

Closed 12 years ago

#8039 closed defect (fixed)

ATLAS libs fail to build on Open Solaris 64 bit due to wrong LDFLAG -melf_x86_64

Reported by: jsp Owned by: drkirkby
Priority: major Milestone: sage-4.3.4
Component: porting Keywords: building
Cc: Merged in: sage-4.3.4.alpha0
Authors: Jaap Spies Reviewers: David Kirkby
Report Upstream: Workaround found; Bug reported upstream. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jsp)

in src/CONFIG/src/SpewMakeInc.c LDFLAGS are set for inclusion in Make.inc. This file is included in all Makefiles.

As a workaround I changed -melf_x86_64 in -64 in Make.inc in the directory where the libraries are built.

This is SunOS with SAGE64="yes" only.

An spkg can be found here: http://boxen.math.washington.edu/home/jsp/ports/atlas-3.8.3.p12.spkg

Attachments (2)

atlas-3.8.3.p11.patch (2.6 KB) - added by jsp 12 years ago.
atlas-3.8.3.p12.patch (2.2 KB) - added by jsp 12 years ago.
Updated patch

Download all attachments as: .zip

Change History (22)

comment:1 Changed 12 years ago by jsp

  • Status changed from new to needs_review

comment:2 follow-up: Changed 12 years ago by drkirkby

What has been changed? I can't find the changed file? You should not change the ATLAS source code, but create a patch, which gets applied with spkg-install.

comment:3 Changed 12 years ago by drkirkby

PS, you should also report this failure upstream.

comment:4 in reply to: ↑ 2 Changed 12 years ago by jsp

Replying to drkirkby:

What has been changed? I can't find the changed file? You should not change the ATLAS source code, but create a patch, which gets applied with spkg-install.

See the patch.

Jaap

comment:5 Changed 12 years ago by drkirkby

  • Status changed from needs_review to needs_work

This will not work for me, as I believe there is a syntax error in your script. This might be an example of things that work on one shell do not on another.

ATLAS-build/lib/Makefile will be changed.
'-shared' will be changed to '-G'
'-soname' will be changed to '-h'
'--whole-archive' will be changed to '-zallextract'
'--no-whole-archive' will be changed to '-zdefaultextract'
A copy of the original Makefile will be copied to Makefile.orig
./spkg-install-script: line 94: [: yes: unary operator expected
make[2]: Entering directory `/export/home/drkirkby/sage-4.3.1/spkg/build/atlas-3.8.3.p11/ATLAS-build/lib'
rm -f libatlas.so liblapack.so

This is line 94 of the script, which is causing the problem.

  if [ $SAGE64 ="yes" ]; then 

I believe there should be a space after the '=' sign.

I'd make a couple of other points tests in general, I've gleaned from studying the shell more, and from things from comp.unix.shell.

  • It is better to test for "x$SAGE64" = xyes, as some shells have problems if SAGE64 is not defined. Adding an 'x' or anything else you fancy, will avoid that possibility, though 'x' is commonly used, so I would stick to a lower case x. That problem is not true of modern versions of bash, but its a good habit to get into, as then your scripts will work on any shell.
  • It is desirable to quote "x$SAGE64" as potentially SAGE64 might be set to something with spaces in it. I know in this case, there unlikely to be spaces, but you don't know if someone has set it correctly or not.

Hence the following is the safest test sort of test, and does not contain any unnecessary quotes. Quoting xNO will not hurt, but it is unnecessary as you know xNO will have no spaces, but you don't know that about FOOBAR.

             if [ "x$FOOBAR" = xNO ]; then

I leave you to convert it to what is needed here. Otherwise I become an author and can't review it!

I would also

  • Report this upstream, and add to the trac ticket the URL of the ticket. Currently it is set to N/A which is clearly not true.
  • Stick a note in the spkg-install saying why the change is made. i.e. the original flag is not valid. -64 is needed to build 64-bit, or something like that.
  • I would echo a quick statement like I did before when changing flags, like I did before.
'-shared' will be changed to '-G'
  • You are using a temporary variable of 'makefile' while editing 'Make.inc' I think that is unwise, and I know I was guilty of it above, but 'makefile' has some significance, and you could overwrite such a file if it existed.

Better would be

sed 's/-melf_x86_64/-64/g' Make.inc > Make.inc.tmp

or perhaps uses Make.inc.$$, which will create a file with the PID appended.

Also, the description is inaccurate, as it says "As a workaround I changed -melf_x86_64 in -64 in Make.inc". I think you mean you changed it too -64.

So with

  • The syntax error removed
  • Description updated.
  • Some other minor changes you might want to consider
  • Reported upstream, the URL posted.
  • Change to "reported upstream" from N/A
  • Revised patch attached.

then I think this should be ok. But now, there is a syntax error so it will not build at all for me.

Dave

Changed 12 years ago by jsp

comment:6 Changed 12 years ago by jsp

  • Cc drkirkby removed
  • Report Upstream changed from N/A to Workaround found; Bug reported upstream.
  • Status changed from needs_work to needs_review

Mostly done as you wrote above.

Reported upstream: https://sourceforge.net/tracker/?func=detail&aid=2941029&group_id=23725&atid=379483

Jaap

comment:7 Changed 12 years ago by drkirkby

  • Status changed from needs_review to needs_work

I'm a bit worried about this one:

Platform detected to be 32 bits

Dave

comment:8 Changed 12 years ago by drkirkby

  • Reviewers set to David Kirkby

It also fails on my machine

make[1]: *** [atlas_run] Error 7
make[1]: Leaving directory `/export/home/drkirkby/sage-4.3.1/spkg/build/atlas-3.8.3.p11/ATLAS-build'
make: *** [IRun_comp] Error 2
Assertion failed: !system(ln), file /export/home/drkirkby/sage-4.3.1/spkg/build/atlas-3.8.3.p11/ATLAS-build/../src//CONFIG/src/config.c, line 125

OS configured as SunOS (2)

Assembly configured as GAS_x8632 (1)

Vector ISA Extension configured as  SSE3 (2,28)

Architecture configured as  Corei7 (16)

Clock rate configured as 3325Mhz
Cannot detect CPU throttling.
/bin/sh: line 1: 22300: Abort(coredump)
xconfig exited with 6
make -f Make.top build
make[1]: Entering directory `/export/home/drkirkby/sage-4.3.1/spkg/build/atlas-3.8.3.p11/ATLAS-build'
make[1]: Make.top: No such file or directory
make[1]: *** No rule to make target `Make.top'.  Stop.
make[1]: Leaving directory `/export/home/drkirkby/sage-4.3.1/spkg/build/atlas-3.8.3.p11/ATLAS-build'
make: *** [build] Error 2
Failed to build ATLAS.
Failed to build ATLAS.

real	0m3.065s
user	0m1.150s
sys	0m1.074s
sage: An error occurred while installing atlas-3.8.3.p11

comment:9 Changed 12 years ago by jsp

This is on your machine too:

chmod: cannot access `/export/home/jaap/sage_port/sage-4.3.1/local/lib/libptf77blas.a': No such file or directory
make[1]: [install_lib] Error 1 (ignored)
make[1]: Leaving directory `/export/home/jaap/sage_port/sage-4.3.1/spkg/build/atlas-3.8.3.p11/ATLAS-build'
Deleting liblapack.so on Solaris due to bug in numpy/scipy

real    8m49.450s
user    7m35.780s
sys     1m0.353s
Successfully installed atlas-3.8.3.p11

What's wrong?

Jaap

comment:10 Changed 12 years ago by jsp

  • Status changed from needs_work to needs_review

Dave, Did you try again? Still no reaction from upstream.

Jaap

comment:11 Changed 12 years ago by drkirkby

  • Status changed from needs_review to positive_review

Given

  • I found -m64 fixed the problem on the command line, and
  • you have proven it works on my machine

I am going to give this is a positive review.

comment:12 follow-up: Changed 12 years ago by mpatel

  • Status changed from positive_review to needs_work
  • Work issues set to Increase patch level

Sage 4.3.2 includes atlas-3.8.3.p11.spkg. Should the package here be p12?

comment:13 in reply to: ↑ 12 Changed 12 years ago by jsp

Replying to mpatel:

Sage 4.3.2 includes atlas-3.8.3.p11.spkg. Should the package here be p12?

Maybe now, but not on the moment I wrote the patch!

There is a real danger that tickets with positive review are not merged for a long time and bitrot.

Jaap

comment:14 follow-up: Changed 12 years ago by mpatel

I think I've merged all the other Solaris-related tickets at {32} into a candidate 4.3.3.alpha0.

comment:15 in reply to: ↑ 14 Changed 12 years ago by jsp

Replying to mpatel:

I think I've merged all the other Solaris-related tickets at {32} into a candidate 4.3.3.alpha0.

Look at 'porting' to see some more!

Jaap

comment:16 Changed 12 years ago by mpatel

Yes, I've already those.

comment:17 Changed 12 years ago by mpatel

  • Work issues changed from Increase patch level to Rebase vs. #7827

Changed 12 years ago by jsp

Updated patch

comment:18 Changed 12 years ago by jsp

  • Description modified (diff)
  • Status changed from needs_work to needs_review
  • Work issues Rebase vs. #7827 deleted

Rebased and increased patch level. New spkg:

http://boxen.math.washington.edu/home/jsp/ports/atlas-3.8.3.p12.spkg

make[1]: Leaving directory `/export/home/jaap/sage_port/sage-4.3.2.alpha1/spkg/build/atlas-3.8.3.p12/ATLAS-build'
Deleting liblapack.so on Solaris due to bug in numpy/scipy

real    9m5.693s
user    7m45.589s
sys     1m3.860s
Successfully installed atlas-3.8.3.p12
You can safely delete the temporary build directory
/export/home/jaap/sage_port/sage-4.3.2.alpha1/spkg/build/atlas-3.8.3.p12
Making Sage/Python scripts relocatable...
Making script relocatable
Finished installing atlas-3.8.3.p12.spkg
-bash-3.2$ file local/lib/libatlas.*
local/lib/libatlas.a:   current ar archive, not a dynamic executable or shared object
local/lib/libatlas.so:  ELF 64-bit LSB dynamic lib AMD64 Version 1, dynamically linked, not stripped, no debugging information available

Jaap

comment:19 Changed 12 years ago by drkirkby

  • Status changed from needs_review to positive_review

That looks good. It would be nice to find out exactly what -melf_x86_64 is supposed to do, but on a practical level, this allows ATLAS to build on OpenSolaris?. Some more changees may be needed once Sage builds and we can run the doctests. But at least this builds, only effects Solaris and allows progress to be made.

comment:20 Changed 12 years ago by mvngu

  • Merged in set to sage-4.3.4.alpha0
  • Resolution set to fixed
  • Status changed from positive_review to closed
  • Summary changed from [with spkg, needs review] ATLAS libs fail to build on Open Solaris 64 bit due to wrong LDFLAG -melf_x86_64 to ATLAS libs fail to build on Open Solaris 64 bit due to wrong LDFLAG -melf_x86_64

Merged atlas-3.8.3.p12.spkg in the standard spkg repository.

Note: See TracTickets for help on using tickets.