public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9
@ 2011-08-15 10:00 Maciej Bliziński
  2011-08-15 10:18 ` Marc Glisse
  0 siblings, 1 reply; 9+ messages in thread
From: Maciej Bliziński @ 2011-08-15 10:00 UTC (permalink / raw)
  To: gcc-help

Hello,

I'm working on a bootstrap of gcc-4.6.1 using Sun Studio on Solaris 9.
I'm currently stuck at a liblto_plugin.so linking issue[1], but I'd
first like to verify whether my general approach is correct.

There is a mutual incompatibility between flags accepted by Sun Studio
and GCC.  Therefore, 2 sets of CFLAGS are needed: one for the host
compiler (here: Sun Studio), and one gcc for the subsequent stages.
The first one is set via CFLAGS, and the second one is set via
CFLAGS_FOR_TARGET.  Is this approach correct? (I also saw references
to the TARGET_CFLAGS variable, so I'm not sure which one to use.)

Maciej

[1] http://lists.opencsw.org/pipermail/maintainers/2011-August/015173.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9
  2011-08-15 10:00 Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9 Maciej Bliziński
@ 2011-08-15 10:18 ` Marc Glisse
  2011-08-15 12:23   ` Maciej Bliziński
  0 siblings, 1 reply; 9+ messages in thread
From: Marc Glisse @ 2011-08-15 10:18 UTC (permalink / raw)
  To: Maciej Bliziński; +Cc: gcc-help

On Mon, 15 Aug 2011, Maciej BliziĂąski wrote:

> I'm working on a bootstrap of gcc-4.6.1 using Sun Studio on Solaris 9.
> I'm currently stuck at a liblto_plugin.so linking issue[1], but I'd
> first like to verify whether my general approach is correct.

libtool doesn't seem to have noticed you are not using gcc/linux.

> There is a mutual incompatibility between flags accepted by Sun Studio
> and GCC.  Therefore, 2 sets of CFLAGS are needed: one for the host
> compiler (here: Sun Studio), and one gcc for the subsequent stages.
> The first one is set via CFLAGS, and the second one is set via
> CFLAGS_FOR_TARGET.  Is this approach correct? (I also saw references
> to the TARGET_CFLAGS variable, so I'm not sure which one to use.)

http://gcc.gnu.org/install/build.html
(BOOT_CFLAGS)
But you should probably leave alone the flags used by gcc and only touch 
the flags used by suncc (although the default ones worked well enough last 
I tried).


-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9
  2011-08-15 10:18 ` Marc Glisse
@ 2011-08-15 12:23   ` Maciej Bliziński
  2011-08-15 13:04     ` Marc Glisse
  0 siblings, 1 reply; 9+ messages in thread
From: Maciej Bliziński @ 2011-08-15 12:23 UTC (permalink / raw)
  To: gcc-help

2011/8/15 Marc Glisse <marc.glisse@inria.fr>:
> On Mon, 15 Aug 2011, Maciej Bliziński wrote:
>
>> I'm working on a bootstrap of gcc-4.6.1 using Sun Studio on Solaris 9.
>> I'm currently stuck at a liblto_plugin.so linking issue[1], but I'd
>> first like to verify whether my general approach is correct.
>
> libtool doesn't seem to have noticed you are not using gcc/linux.

Is there a standard way to tell it that?  There already was a
hardcoded AM_CFLAGS bit, which was incompatible with Sun Studio, so I
made a provisional patch to push the build forward.

http://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg/gcc4/branches/bootstrap-4.6/files/0001-clear-AM_CFLAGS-in-lto-plugin.patch

Perhaps there are more hardcoded assumptions about the build environment?

I think I saw tests for -Wall passing by in other parts of the build,
perhaps they could be reused. I also saw that revision 177614
addresses some of these issues, but I guess these changes haven't made
it into a release yet.

>> There is a mutual incompatibility between flags accepted by Sun Studio
>> and GCC.  Therefore, 2 sets of CFLAGS are needed: one for the host
>> compiler (here: Sun Studio), and one gcc for the subsequent stages.
>> The first one is set via CFLAGS, and the second one is set via
>> CFLAGS_FOR_TARGET.  Is this approach correct? (I also saw references
>> to the TARGET_CFLAGS variable, so I'm not sure which one to use.)
>
> http://gcc.gnu.org/install/build.html
> (BOOT_CFLAGS)
> But you should probably leave alone the flags used by gcc and only touch the
> flags used by suncc (although the default ones worked well enough last I
> tried).

There are some flags I need to pass to the last stage of the
compilation, namely -march=v8, because of the policy at OpenCSW to
build sparcv8 and not sparcv8+ (default for gcc) binaries.  Looks like
BOOT_CFLAGS work for that purpose.

The current point where I'm stuck is the lto-plugin linking problem,
any advice is appreciated.

Maciej

[1] http://gcc.gnu.org/viewcvs?view=revision&revision=177614

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9
  2011-08-15 12:23   ` Maciej Bliziński
@ 2011-08-15 13:04     ` Marc Glisse
  2011-08-15 15:46       ` Maciej Bliziński
  0 siblings, 1 reply; 9+ messages in thread
From: Marc Glisse @ 2011-08-15 13:04 UTC (permalink / raw)
  To: Maciej Bliziński; +Cc: gcc-help

On Mon, 15 Aug 2011, Maciej Bliziński wrote:

> 2011/8/15 Marc Glisse <marc.glisse@inria.fr>:
>> On Mon, 15 Aug 2011, Maciej Bliziński wrote:
>>
>>> I'm working on a bootstrap of gcc-4.6.1 using Sun Studio on Solaris 9.
>>> I'm currently stuck at a liblto_plugin.so linking issue[1], but I'd
>>> first like to verify whether my general approach is correct.
>>
>> libtool doesn't seem to have noticed you are not using gcc/linux.
>
> Is there a standard way to tell it that?

Well, it works for me:
/bin/bash ./libtool --tag=CC --tag=disable-static --mode=link cc -g -module -bindir /export/home/oracle/i/libexec/gcc/i386-pc-solaris2.10/4.6.1 -o liblto_plugin.la -rpath /export/home/oracle/i/libexec/gcc/i386-pc-solaris2.10/4.6.1 lto-plugin.lo -Wc,../libiberty/pic/libiberty.a
libtool: link: cc -G -h liblto_plugin.so.0 -o .libs/liblto_plugin.so.0.0.0  .libs/lto-plugin.o   -lc  ../libiberty/pic/libiberty.a

So it does know to use -G and -h instead of -shared and -soname. No idea 
why it's different for you.

Btw, I set CC=cc and used --with-gmp=... --with-gnu-as --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld

> http://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg/gcc4/branches/bootstrap-4.6/files/0001-clear-AM_CFLAGS-in-lto-plugin.patch
>
> I think I saw tests for -Wall passing by in other parts of the build,
> perhaps they could be reused. I also saw that revision 177614
> addresses some of these issues, but I guess these changes haven't made
> it into a release yet.

Yes, that revision was only on trunk.

> There are some flags I need to pass to the last stage of the
> compilation, namely -march=v8, because of the policy at OpenCSW to
> build sparcv8 and not sparcv8+ (default for gcc) binaries.  Looks like
> BOOT_CFLAGS work for that purpose.

You would still need CFLAGS_FOR_TARGET I guess. Doesn't configuring with 
--with-arch=v8 or --with-arch-32=v8 work?

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9
  2011-08-15 13:04     ` Marc Glisse
@ 2011-08-15 15:46       ` Maciej Bliziński
  2011-08-15 16:12         ` Marc Glisse
  0 siblings, 1 reply; 9+ messages in thread
From: Maciej Bliziński @ 2011-08-15 15:46 UTC (permalink / raw)
  To: gcc-help

2011/8/15 Marc Glisse <marc.glisse@inria.fr>:
>>> libtool doesn't seem to have noticed you are not using gcc/linux.
>>
>> Is there a standard way to tell it that?
>
> Well, it works for me:
> /bin/bash ./libtool --tag=CC --tag=disable-static --mode=link cc -g -module
> -bindir /export/home/oracle/i/libexec/gcc/i386-pc-solaris2.10/4.6.1 -o
> liblto_plugin.la -rpath
> /export/home/oracle/i/libexec/gcc/i386-pc-solaris2.10/4.6.1 lto-plugin.lo
> -Wc,../libiberty/pic/libiberty.a
> libtool: link: cc -G -h liblto_plugin.so.0 -o .libs/liblto_plugin.so.0.0.0
>  .libs/lto-plugin.o   -lc  ../libiberty/pic/libiberty.a
>
> So it does know to use -G and -h instead of -shared and -soname. No idea why
> it's different for you.

I tried on 3 boxes, and it seems to work on one of them. One thing I
noticed was that the box on which it worked, did not have the
CSWlibtool package installed, which means there was no
/opt/csw/bin/libtool (/opt/csw/bin is in PATH). The box on which it
worked, no libtool was available in PATH. I also noticed that the
lto-plugin directory is one of the two that provides its own libtool
executable. The other is zlib. As an experiment, I hand-edited the
generated Makefile in the lto-plugin directory, changing the default
LIBTOOL setting (pointing to ${topdir}/libtool) to /opt/csw/bin/bash
/opt/csw/bin/libtool.

It made the linking pass. But what would be the proper fix?

> Btw, I set CC=cc and used --with-gmp=... --with-gnu-as
> --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld

Same here.

>> There are some flags I need to pass to the last stage of the
>> compilation, namely -march=v8, because of the policy at OpenCSW to
>> build sparcv8 and not sparcv8+ (default for gcc) binaries.  Looks like
>> BOOT_CFLAGS work for that purpose.
>
> You would still need CFLAGS_FOR_TARGET I guess. Doesn't configuring with
> --with-arch=v8 or --with-arch-32=v8 work?

Compilation breaks with:

This target does not support --with-arch.
Valid --with options are: cpu float tune
gmake[4]: *** [configure-stage1-gcc] Error 1
gmake[4]: Leaving directory
`/home/maciej/src/opencsw/pkg/gcc4/branches/bootstrap-4.6-suncc/work/solaris9-sparc/build-isa-sparcv8/gcc-4.6.1/objdir'

Maciej

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9
  2011-08-15 15:46       ` Maciej Bliziński
@ 2011-08-15 16:12         ` Marc Glisse
  2011-08-17  9:01           ` Maciej Bliziński
  0 siblings, 1 reply; 9+ messages in thread
From: Marc Glisse @ 2011-08-15 16:12 UTC (permalink / raw)
  To: Maciej Bliziński; +Cc: gcc-help

On Mon, 15 Aug 2011, Maciej Bliziński wrote:

> 2011/8/15 Marc Glisse <marc.glisse@inria.fr>:
>>>> libtool doesn't seem to have noticed you are not using gcc/linux.
>>>
>>> Is there a standard way to tell it that?
>>
>> Well, it works for me:
>> /bin/bash ./libtool --tag=CC --tag=disable-static --mode=link cc -g -module
>> -bindir /export/home/oracle/i/libexec/gcc/i386-pc-solaris2.10/4.6.1 -o
>> liblto_plugin.la -rpath
>> /export/home/oracle/i/libexec/gcc/i386-pc-solaris2.10/4.6.1 lto-plugin.lo
>> -Wc,../libiberty/pic/libiberty.a
>> libtool: link: cc -G -h liblto_plugin.so.0 -o .libs/liblto_plugin.so.0.0.0
>>  .libs/lto-plugin.o   -lc  ../libiberty/pic/libiberty.a
>>
>> So it does know to use -G and -h instead of -shared and -soname. No idea why
>> it's different for you.
>
> I tried on 3 boxes, and it seems to work on one of them. One thing I
> noticed was that the box on which it worked, did not have the
> CSWlibtool package installed, which means there was no
> /opt/csw/bin/libtool (/opt/csw/bin is in PATH). The box on which it
> worked, no libtool was available in PATH. I also noticed that the
> lto-plugin directory is one of the two that provides its own libtool
> executable. The other is zlib. As an experiment, I hand-edited the
> generated Makefile in the lto-plugin directory, changing the default
> LIBTOOL setting (pointing to ${topdir}/libtool) to /opt/csw/bin/bash
> /opt/csw/bin/libtool.
>
> It made the linking pass. But what would be the proper fix?

Libtool was badly generated because configure didn't have/guess the right 
information.

>> Btw, I set CC=cc and used --with-gmp=... --with-gnu-as
>> --with-as=/usr/sfw/bin/gas --without-gnu-ld --with-ld=/usr/ccs/bin/ld
>
> Same here.

Note that I get the same error you get if I have a GNU ld on my PATH and I 
don't specify --without-gnu-ld --with-ld=/usr/ccs/bin/ld.

>>> There are some flags I need to pass to the last stage of the
>>> compilation, namely -march=v8, because of the policy at OpenCSW to
>>> build sparcv8 and not sparcv8+ (default for gcc) binaries.  Looks like
>>> BOOT_CFLAGS work for that purpose.

>> You would still need CFLAGS_FOR_TARGET I guess. Doesn't configuring with
>> --with-arch=v8 or --with-arch-32=v8 work?
> Compilation breaks with:
>
> This target does not support --with-arch.
> Valid --with options are: cpu float tune

Right, on sparc you don't want -march=v8 but -mcpu=v8, so that would be 
--with-cpu=v8 (or --with-cpu-32=v8, not sure which).

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9
  2011-08-15 16:12         ` Marc Glisse
@ 2011-08-17  9:01           ` Maciej Bliziński
  2011-08-17 10:29             ` Jonathan Wakely
  0 siblings, 1 reply; 9+ messages in thread
From: Maciej Bliziński @ 2011-08-17  9:01 UTC (permalink / raw)
  To: gcc-help

2011/8/15 Marc Glisse <marc.glisse@inria.fr>:
>>> You would still need CFLAGS_FOR_TARGET I guess. Doesn't configuring with
>>> --with-arch=v8 or --with-arch-32=v8 work?
>>
>> Compilation breaks with:
>>
>> This target does not support --with-arch.
>> Valid --with options are: cpu float tune
>
> Right, on sparc you don't want -march=v8 but -mcpu=v8, so that would be
> --with-cpu=v8 (or --with-cpu-32=v8, not sure which).

I tried with --with-cpu-32=v8 and got:

checking if mkdir takes one argument... no
This target does not support --with-cpu_32.
Valid --with options are: cpu float tune
gmake[4]: *** [configure-stage1-gcc] Error 1

Is it an expected behavior?

I can try passing --with-cpu=v8.  However, this setting is not valid
for the 64-bit builds of shared libraries, so I'll see how it goes.

Maciej

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9
  2011-08-17  9:01           ` Maciej Bliziński
@ 2011-08-17 10:29             ` Jonathan Wakely
  2011-08-17 11:08               ` Marc Glisse
  0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Wakely @ 2011-08-17 10:29 UTC (permalink / raw)
  To: Maciej Bliziński; +Cc: gcc-help

2011/8/17 Maciej Bliziński:
>
> I tried with --with-cpu-32=v8 and got:
>
> checking if mkdir takes one argument... no
> This target does not support --with-cpu_32.
> Valid --with options are: cpu float tune
> gmake[4]: *** [configure-stage1-gcc] Error 1
>
> Is it an expected behavior?

From http://gcc.gnu.org/install/configure.html

"The --with-cpu-32 and --with-cpu-64 options specify separate default
CPUs for 32-bit and 64-bit modes; these options are only supported for
i386, x86-64 and PowerPC. "

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9
  2011-08-17 10:29             ` Jonathan Wakely
@ 2011-08-17 11:08               ` Marc Glisse
  0 siblings, 0 replies; 9+ messages in thread
From: Marc Glisse @ 2011-08-17 11:08 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Maciej Bliziński, gcc-help

On Wed, 17 Aug 2011, Jonathan Wakely wrote:

> 2011/8/17 Maciej Bliziński:
>>
>> I tried with --with-cpu-32=v8 and got:
>>
>> checking if mkdir takes one argument... no
>> This target does not support --with-cpu_32.
>> Valid --with options are: cpu float tune
>> gmake[4]: *** [configure-stage1-gcc] Error 1
>>
>> Is it an expected behavior?
>
> From http://gcc.gnu.org/install/configure.html
>
> "The --with-cpu-32 and --with-cpu-64 options specify separate default
> CPUs for 32-bit and 64-bit modes; these options are only supported for
> i386, x86-64 and PowerPC. "

Which means it should be filed in bugzilla as a RFE, not a bug.

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-08-17 11:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-15 10:00 Bootstraping gcc-4.6.1 with Sun Studio on Solaris 9 Maciej Bliziński
2011-08-15 10:18 ` Marc Glisse
2011-08-15 12:23   ` Maciej Bliziński
2011-08-15 13:04     ` Marc Glisse
2011-08-15 15:46       ` Maciej Bliziński
2011-08-15 16:12         ` Marc Glisse
2011-08-17  9:01           ` Maciej Bliziński
2011-08-17 10:29             ` Jonathan Wakely
2011-08-17 11:08               ` Marc Glisse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).