Opened 11 years ago

Closed 11 years ago

#9833 closed defect (duplicate)

fatal relocation error with Cliquer library on 64-bit Solaris and OpenSolaris

Reported by: drkirkby Owned by: drkirkby
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: porting: Solaris Keywords:
Cc: jhpalmieri, ncohen, jason, jsp, mvngu, mpatel Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


If a 64-bit version of Sage is built on OpenSolaris, Sage reports an error as soon as it is started.

drkirkby@hawk:~$ 64/sage-4.5.3.alpha2/sage
| Sage Version 4.5.3.alpha2, Release Date: 2010-08-23                |
| Type notebook() for the GUI, and license() for information.        |
*                                                                    *
* Warning: this is a prerelease version, and it may be unstable.     *
*                                                                    *


ImportError: python: fatal: relocation error: R_AMD64_PC32: file /export/home/drkirkby/64/sage-4.5.3.alpha2/local/lib// symbol main: value 0x28152e8c7d4 does not fit
Error importing ipy_profile_sage - perhaps you should run %upgrade?
WARNING: Loading of ipy_profile_sage failed.

The problem of fatal relocation errors is discussed on this Sun blog by Rod Evans.

A shared library should show no output from the following command:

$ elfdump -d library | fgrep TEXTREL

But in a 64-bit builds of Sage on both OpenSolaris x64 and Solaris 10 on SPARC, but show output. The following is from an OpenSolaris machine, but similar is seen on a 64-bit SPARC build of Sage.

drkirkby@hawk:~$ elfdump -d 64/sage-4.5.3.alpha2/local/lib/  | grep TEXTREL
      [17]  TEXTREL           0                   
      [25]  FLAGS             0x4                 [ TEXTREL ]

If this flag is found, then the link-editor thinks this file contains non-pic code.

Looking at the way the shared library is built on Solaris, it is different from other platforms.

# Flags for building a dynamically linked shared object.
if [ "$UNAME" = "Linux" ] || [ "$UNAME" = "FreeBSD" ]; then
    SAGESOFLAGS="-shared -Wl,-soname,"
    export SAGESOFLAGS
elif [ "$UNAME" = "Darwin" ]; then
    SAGESOFLAGS="-dynamiclib -single_module -flat_namespace -undefined dynamic_l
    export SAGESOFLAGS
elif [ "$UNAME" = "SunOS" ]; then
    SAGESOFLAGS="-G -Bdynamic"
    export SAGESOFLAGS
elif [ "$UNAME" = "CYGWIN" ]; then
    SAGESOFLAGS="-shared -Wl,-soname,"

Using just

elif [ "$UNAME" = "SunOS" ]; then

was sufficient to produce a shared library which did not exhibit this problem. When Sage was started, Sage no longer produced the libcliquer error message, though it did fail to run properly.

There are in fact several other libraries in Sage that show show output using the elfdump command above.


(These were observed on OpenSolaris x64. I've confirmed the same is true of on 64-bit SPARC using t2.math, but I've not verified if all the other libraries show this problem. )

I doubt whether these are the only issues preventing Sage running properly on 64-bit Solaris, but these should be resolved.


  • The current version of Cliquer in Sage 1.2 is not the latest.
  • Cliquer 1.2.1 is a bug-fix only release, so should be safe.
  • The Cliquer test suite can't be run as there's no spkg-check file - see #9767

it makes sense to update Cliquer and sort out the Solaris and spkg-check issues at the same time.


Change History (5)

comment:1 Changed 11 years ago by leif

This is a general error in how Cliquer is adapted to/built for Sage.

It is intended as a stand-alone program, and therefore contains main().

You must (or should) not build [shared] libraries containing a main() function.

Instead, use #ifdef ... and -D... depending on what you build. I think Sage should build and install both, the program and a library. (If you remove/omit main() for the shared library, the loader problems should vanish.)

  • cliquer-1.2.p6/

    old new  
    22##### Configurable options:
     4# Don't need to set any of these compiler variables. They have already been
     5# set when running SAGE_ROOT/local/bin/sage-env as part of installing a
     6# package.
    47## Compiler:
    5 CC=gcc
     8# CC=gcc
    811## Compiler flags:
    1013# GCC:  (also -march=pentium etc, for machine-dependent optimizing)
    11 CFLAGS=-Wall -O3 -fomit-frame-pointer -funroll-loops
     14# Build in 64-bit mode on Mac OS X with an Intel processor.
     16# Flags for building a dynamically linked shared object.
     17# SAGESOFLAGS=""
     18# ifeq (`uname`, Linux)
     19#       SAGESOFLAGS=-shared -Wl,-soname,
     20# endif
     21# ifeq (`uname`, Darwin)
     22#       SAGESOFLAGS=-shared -dynamiclib
     23# endif
     24# ifeq (`uname`, SunOS)
     25#       SAGESOFLAGS=-G -Bdynamic
     26# endif
    1328# GCC w/ debugging:
    1429#CFLAGS=-Wall -g -DINLINE=
    3651        $(CC) $(LDFLAGS) -o $@ testcases.o cliquer.o graph.o reorder.o
    3853cl: cl.o cliquer.o graph.o reorder.o
    39         $(CC) $(LDFLAGS) -o $@ cl.o cliquer.o graph.o reorder.o
     54        $(CC) $(LDFLAGS) $(SAGESOFLAGS) -o cl.o cliquer.o graph.o reorder.o
    4256cl.o testcases.o cliquer.o graph.o reorder.o: cliquer.h set.h graph.h misc.h reorder.h Makefile cliquerconf.h

Note the changes made to the cl target (which is [the name of] the stand-alone program).

This package really needs work (but there's - besides others - already a ticket (#9871) for an upstream update as well). The files in src/ are not even vanilla, but contain weird changes in order to use Cliquer as a library from within Sage.

comment:2 Changed 11 years ago by drkirkby

This can be closed when #9871 is closed.

Another relevant ticket is #9870, which should sort out many of the issues with Cliquer.


comment:3 Changed 11 years ago by mvngu

  • Cc mvngu added

comment:4 Changed 11 years ago by drkirkby

  • Cc mpatel added

Minh, this ticket can be effectively ignored now. Since #9871 is merged in sage-4.6.alpha1, one might assume it will get to sage-4.6. With hindsight the issue resolved on this ticket should have been resolved here, but I intending updating the source, so created a wider ticket to do that, only to find that was not going to be possible.

Leif intended resolving #9870.

I'm not sure what the procedure his here, and whether this should be closed now (since it's merged in sage-4.6.alpha1, or wait until it's merged in sage-4.6. I believe the latter is probably more appropriate, as it could potentially be found to be problematic and not get merged in 4.6 at all.


comment:5 Changed 11 years ago by mpatel

  • Milestone changed from sage-4.6 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from new to closed

I'm closing this ticket as a "duplicate" of #9871. Please reopen it, if the Cliquer relocation error remains or reappears.

Note: See TracTickets for help on using tickets.