Forum: Ruby ./configure doesn't like CFLAGS='-ggdb'

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dave H. (Guest)
on 2006-03-28 03:14
(Received via mailing list)
My RubyCocoa app has started exploding with "BUS ERROR," or perhaps
more precisely,
		Program received signal:  "EXC_BAD_ACCESS".

Asking the debugger to help told me that it was caused as a result of
something going wrong with an Event running down the chain and then
something bad happening, but that was about all I could figure out. I'm
not even sure what kind of event it was.

I found the following info on how to make Ruby and RubyCocoa more
"debuggable" at
http://www.rubycocoa.com/an-introduction-to-rubycocoa/6:

	First, build a debuggable version of Ruby.
	In your ruby source directory, run the following
	commands from the bash shell:
		$ CFLAGS='-g -ggdb -fno-common' ./configure
		$ make
		$ sudo make install

Except that configure is very unhappy about that "-ggdb" flag. :(
"checking for C compiler default output file name... configure: error:
C compiler cannot create executables"

I also tried the form that the ./configure --help output suggested:
	./configure CFLAGS='-g -ggdb -fno-common'

It continues past that spot without a problem if I leave out the
"-ggdb" part.

 From config.log:

	configure:2000: checking for C compiler default output file name
	configure:2003: gcc -g -ggdb -fno-common    conftest.c  >&5
	/var/tmp//cc0knt2z.s:1:Expected comma after segment-name
	/var/tmp//cc0knt2z.s:1:Rest of line ignored. 1st junk character valued
76 (L).
	/var/tmp//cc0knt2z.s:2:Expected comma after segment-name
	/var/tmp//cc0knt2z.s:2:Rest of line ignored. 1st junk character valued
76 (L).
	/var/tmp//cc0knt2z.s:3:Expected comma after segment-name
	/var/tmp//cc0knt2z.s:3:Rest of line ignored. 1st junk character valued
76 (L).
	/var/tmp//cc0knt2z.s:25:Expected comma after segment-name
	/var/tmp//cc0knt2z.s:25:Rest of line ignored. 1st junk character
valued 95 (_).
	/var/tmp//cc0knt2z.s:69:Expected comma after segment-name
	/var/tmp//cc0knt2z.s:69:Rest of line ignored. 1st junk character
valued 32 ( ).
	/var/tmp//cc0knt2z.s:120:Expected comma after segment-name
	/var/tmp//cc0knt2z.s:120:Rest of line ignored. 1st junk character
valued 32 ( ).
	/var/tmp//cc0knt2z.s:147:Expected comma after segment-name
	/var/tmp//cc0knt2z.s:147:Rest of line ignored. 1st junk character
valued 32 ( ).
	/var/tmp//cc0knt2z.s:199:Expected comma after segment-name
	/var/tmp//cc0knt2z.s:199:Rest of line ignored. 1st junk character
valued 32 ( ).
	/var/tmp//cc0knt2z.s:206:Expected comma after segment-name
	/var/tmp//cc0knt2z.s:206:Rest of line ignored. 1st junk character
valued 32 ( ).
	configure:2006: $? = 1
	configure: failed program was:
	| /* confdefs.h.  */
	|
	| #define PACKAGE_NAME ""
	| #define PACKAGE_TARNAME ""
	| #define PACKAGE_VERSION ""
	| #define PACKAGE_STRING ""
	| #define PACKAGE_BUGREPORT ""
	| /* end confdefs.h.  */
	|
	| int
	| main ()
	| {
	|
	|   ;
	|   return 0;
	| }
	configure:2045: error: C compiler cannot create executables
	See `config.log' for more details.

Can anybody fill me in on what I need to do differently to compile Ruby
with the "-ggdb" flag?
Dave H. (Guest)
on 2006-03-30 01:15
(Received via mailing list)
On Mar 27, 2006, at 15:13, Dave H. wrote:
>
> Can anybody fill me in on what I need to do differently to compile
> Ruby with the "-ggdb" flag?

Is this a harder question than I thought, or maybe I asked this in the
wrong place?
Nicolas Desprès (Guest)
on 2006-03-30 07:57
(Received via mailing list)
On 3/29/06, Dave H. <removed_email_address@domain.invalid> wrote:
>
I've just compiled the Ruby last cvs version with -ggdb and "make
test" succeeded.
Dave H. (Guest)
on 2006-04-01 05:53
(Received via mailing list)
On Mar 29, 2006, at 19:56, Nicolas Desprès wrote:

>>
>>
>
> I've just compiled the Ruby last cvs version with -ggdb and "make
> test" succeeded.

I'm not getting that far. "configure" won't let me try to actually
compile, because it declares that the compiler isn't working right when
I add that flag.

Maybe it's something that "got fixed" in the current version . . . .
Olof Sivertsson (Guest)
on 2006-04-01 19:48
(Received via mailing list)
On 4/1/06, Dave H. <removed_email_address@domain.invalid> wrote:
> >> Is this a harder question than I thought, or maybe I asked this in the
> I add that flag.
>
> Maybe it's something that "got fixed" in the current version . . . .
>
>
>

I too can build both the latest CVS version and the 1.8.4 release with
-ggdb. But I'm on a x86 Debian GNU/Linux machine, while I guess you're
on a Mac (and probably a PowerPC) since you're using RubyCocoa.
Perhaps the installed version of gcc or as or some other surrounding
tools are broken with the -ggdb flag? You could try upgrading gcc (I
successfully built ruby with gcc 4.0.3) to see if that helps.

But before you go to all that trouble, just try running configure
without -ggdb and instead hand-edit Makefile after this step, changing
the line which contains CFLAGS=<someflags> to include -ggdb, and then
continue building ruby (but you will probably get the same error in
the next step instead...)
Dave H. (Guest)
on 2006-04-02 03:52
(Received via mailing list)
On Apr 1, 2006, at 7:45, Olof Sivertsson wrote:

> continue building ruby (but you will probably get the same error in
> the next step instead...)

You are correct on all counts. I found the line you described with no
problem, changed it, and started getting error messages immediately. I
also took another close look at the man pages for "gcc" which warned me
that OSX gcc had some bonus Apple commands but is also missing some
things, and that under OSX it's actually a link to gcc-3.3.

Except it's not. Last time I tried to compile Ruby, I couldn't get it
to run until I replaced the "/user/bin/gcc" link with a simple copy of
the "gcc3" file in my /user/bin directory.

So I went back to the make file, and changed the CC= to be CC=gcc-3.3

And hocus-pocus-in-focus, the makefile is now merrily pouring page
after page of utterly mystifying yet somehow reassuring text across my
screen.

Thanks!
This topic is locked and can not be replied to.