Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile on Arch #6

Closed
marcin-rzeznicki opened this issue Jun 8, 2013 · 7 comments
Closed

Cannot compile on Arch #6

marcin-rzeznicki opened this issue Jun 8, 2013 · 7 comments

Comments

@marcin-rzeznicki
Copy link

... or, in general, on any systems where FORTIFY_SOURCE is in use. CPPFLAGS in resulting makefile is

 CPPFLAGS =  -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags)
 CFLAGS   = $(CCDLFLAGS) -Wall -Werror $(ARCH_FLAG)

. I assume that this gets pulled in by default by mkmf because of how ruby was built on particular system. extconf.rb "destroys" CFLAGS by setting it unconditionally to -Wall -Werror (default setting on my system is:

 CFLAGS   = $(CCDLFLAGS) -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fPIC $(ARCH_FLAG)

)
This is unfortunate course of events as:

  • all warnings are treated as errors
  • warning is generated when compiling with FORTIFY_SOURCE set and no optimization
make
compiling breakpoint.c
In file included from /usr/include/string.h:25:0,
                 from /usr/include/ruby-2.0.0/ruby/ruby.h:51,
                 from /usr/include/ruby-2.0.0/ruby.h:33,
                 from ./debase_internals.h:4,
                 from breakpoint.c:1:
/usr/include/features.h:330:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^
cc1: all warnings being treated as errors
make: *** [breakpoint.o] Error 1

I believe that resetting CFLAGS is wrong thing to do, probably CFLAGS should've been appended to instead.

@denofevil
Copy link
Member

I've pushed 70f4179 that appends CFLAGS instead of rewriting. Could you please verify that it compiles on your system? You can do it by running rake test, it does compilation before testing

@marcin-rzeznicki
Copy link
Author

Hi @denofevil ,
Thanks for very quick response. Your patch looks good on my machine:

/home/rzeznik/git/debase rzeznik $: rake test cd ext cd - creating Makefile compiling breakpoint.c compiling context.c compiling debase_internals.c compiling locker.c linking shared-object debase_internals.so /usr/bin/ruby -I"lib:./ext:./lib" -I"/usr/lib/ruby/2.0.0" "/usr/lib/ruby/2.0.0/rake/rake_test_loader.rb" "test/test_base.rb" "test/test_breakpoints.rb" "test/test_catchpoint.rb" "test/test_load.rb" "test/test_reload_bug.rb"

Thanks

@marcin-rzeznicki
Copy link
Author

@denofevil : Should I close this issue? From my POV it is completely solved.

@denofevil
Copy link
Member

I want to push updated version to rubygems, I'll better leave this one open until that as a reminder

@marcin-rzeznicki
Copy link
Author

Good idea :-) Thanks.

@t-richards
Copy link

Unfortunately, debase fails to build for me (also on Arch). Compilation succeeds, but the tests fail.

tom@foo:~/debase$ git log -1
commit 9fb1f9361f2421dd617e2810f622b62566941396
Merge: 70f4179 ea316ed
Author: Dennis Ushakov <dennis.ushakov@jetbrains.com>
Date:   Mon Jun 10 11:26:46 2013 +0400

    Merge branch 'master' of https://github.com/denofevil/debase

tom@foo:~/debase$ rake test
cd ext
cd -
creating Makefile
compiling breakpoint.c
compiling locker.c
compiling context.c
compiling debase_internals.c
linking shared-object debase_internals.so
/usr/bin/ruby -I"lib:./ext:./lib" -I"/home/tom/.gem/ruby/2.0.0/gems/rake-10.1.0/lib" "/home/tom/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_test_loader.rb" "test/test_catchpoint.rb" "test/test_reload_bug.rb" "test/test_breakpoints.rb" "test/test_load.rb" "test/test_base.rb" 
Loaded suite /home/tom/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_test_loader
Started
....F
===============================================================================
Failure:
test_current_context(TestRubyDebug)
/home/tom/debase/test/test_base.rb:26:in `test_current_context'
     23:                  File.basename(Debugger.current_context.frame_file))
     24:     assert_raises(ArgumentError) {Debugger.current_context.frame_file(1, 2)}
     25:     assert_raises(ArgumentError) {Debugger.current_context.frame_file(15)}
  => 26:     assert_equal(1, Debugger.current_context.stack_size)
     27:     assert_equal(TestRubyDebug, Debugger.current_context.frame_class)
     28:     assert_equal(false, Debugger.current_context.dead?, 'Not dead yet!')
     29:   ensure
<1> expected but was
<2>

diff:
? 1
? 2
===============================================================================
...

Finished in 0.0160199 seconds.

8 tests, 38 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
87.5% passed

499.38 tests/s, 2372.05 assertions/s
rake aborted!
Command failed with status (1): [ruby -I"lib:./ext:./lib" -I"/home/tom/.gem/ruby/2.0.0/gems/rake-10.1.0/lib" "/home/tom/.gem/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_test_loader.rb" "test/test_catchpoint.rb" "test/test_reload_bug.rb" "test/test_breakpoints.rb" "test/test_load.rb" "test/test_base.rb" ]

Tasks: TOP => test
(See full trace by running task with --trace)

I tried installing v0.0.4 via rubygems, but it has the same issue after fixing the CFLAGS problem. Any suggestions?

@denofevil
Copy link
Member

Tests are broken for quite a while, but compilation is ok now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants