Opened 15 years ago

Closed 14 years ago

#1758 closed Patches (fixed)

Boost 1.35 fails to build under gcc 3.4 unix Solaris

Reported by: jgottman@… Owned by: Peter Dimov
Milestone: Boost 1.37.0 Component: smart_ptr
Version: Boost 1.35.0 Severity: Showstopper
Keywords: Cc:

Description

When I tried to build the boost libraries under gcc 3.4 unix Solaris, I repeatedly got an error message that looked like

/var/tmp//ccdt31Ke.s: Assembler messages:
/var/tmp//ccdt31Ke.s:619: Error: Architecture mismatch on "cas".
/var/tmp//ccdt31Ke.s:619:  (Requires v9|v9a|v9b; requested architecture is v8.)

I traced the problem to the following lines in <detail\sp_counted_base.hpp>:

#elif defined(__GNUC__) && ( defined( __sparcv8 ) || defined( __sparcv9 ) )

# include <boost/detail/sp_counted_base_gcc_sparc.hpp>

which call the following command:

    __asm__ __volatile__( "cas %0, %2, %1"
                        : "+m" (*dest_), "+r" (swap_)
                        : "r" (compare_)
                        : "memory" );

It looks like sparcv8 is not sufficient to call this command, only sparcv9 is. Note also the <detail/sp_counted_base_solaris.hpp> is apparantly never included.

Joe Gottman

Change History (5)

comment:1 by Peter Dimov, 15 years ago

Status: newassigned

The problem here is that while UltraSPARC supports CAS even in 32 bit mode (the so-called V8+ instruction set), GCC doesn't define __sparcv8plus or __sparcv9 in 32 bit mode, even when V9 or V8+ is selected as a CPU. It only sets __sparcv9 in 64 bit builds, presumably for compatibility reasons. So there is no way to detect whether sp_counted_base_gcc_sparc.hpp will work.

comment:2 by Peter Dimov, 15 years ago

Can you please try a build with instruction-set=v9?

comment:3 by jgottman@…, 15 years ago

This works. What are the advantages of compiling with instruction set 9 versus 8?

comment:4 by Peter Dimov, 14 years ago

Milestone: Boost 1.36.0Boost 1.37.0

comment:5 by Peter Dimov, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [48837]) Fix #1758. V9 is the default for g++ 4.2 or later, on 4.1 and earlier do not attempt to use CAS on V8.

Note: See TracTickets for help on using tickets.