≡

wincent.dev

  • Products
  • Blog
  • Wiki
  • Issues
You are viewing an historical archive of past issues. Please report new issues to the appropriate project issue tracker on GitHub.
Home » Issues » Bug #2135

Bug #2135: Does not compile on my system

Kind bug
Product Command-T
When Created 2013-12-23T05:16:43Z, updated 2014-07-15T06:23:19Z
Status closed
Reporter anonymous
Tags no tags

Description

Since adding the use of pthread, command-t fails to compile on my system with gcc 4.8.2. The followin patch is needed to get it to compile

diff --git a/ruby/command-t/extconf.rb b/ruby/command-t/extconf.rb
index eedeae0..5b6e80c 100644
--- a/ruby/command-t/extconf.rb
+++ b/ruby/command-t/extconf.rb
@@ -37,7 +37,11 @@ header('stdlib.h')
 header('string.h')
 
 # optional headers
-have_header('pthread.h') # sets HAVE_PTHREAD_H if found
+if have_header('pthread.h') 
+    # sets HAVE_PTHREAD_H if found
+    $CFLAGS << ' -pthread'
+    $LDFLAGS << ' -pthread'
+end
 
 RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']

Comments

  1. Greg Hurrell 2013-12-23T05:27:56Z

    My best guess here is that you're using a fairly old Ruby (pre-1.9); is that right?

    I think it was around 1.9 that Ruby started incorporating pthreads by default (in the move from green threads to real threads, albeit with an enormous GIL that prevents any real concurrency).

  2. Greg Hurrell 2014-03-06T14:47:03Z

    Likely related:

    https://github.com/wincent/Command-T/issues/65

  3. Greg Hurrell 2014-03-06T14:52:40Z

    Merged bug #2153 into this one.

  4. Greg Hurrell 2014-03-06T15:35:29Z

    I think I was doing it wrong with the have_header call. have_library probably does what we want:

    diff --git a/ruby/command-t/extconf.rb b/ruby/command-t/extconf.rb
    index eedeae0..433deeb 100644
    --- a/ruby/command-t/extconf.rb
    +++ b/ruby/command-t/extconf.rb
    @@ -36,8 +36,10 @@ def header(item)
     header('stdlib.h')
     header('string.h')
    
    -# optional headers
    -have_header('pthread.h') # sets HAVE_PTHREAD_H if found
    +# optional
    +if RbConfig::CONFIG['THREAD_MODEL'] == 'pthread'
    +  have_library('pthread', 'pthread_create') # sets HAVE_PTHREAD_H if found
    +end
    
     RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']

    See: http://ruby-doc.org/stdlib-2.1.0/libdoc/mkmf/rdoc/MakeMakefile.html#method-i-have_library

  5. Greg Hurrell 2014-07-15T06:23:13Z

    I believe this has been fixed for a while now (since commit 069be54d), so marking as closed.

  6. Greg Hurrell 2014-07-15T06:23:19Z

    Status changed:

    • From: new
    • To: closed
Add a comment

Comments are now closed for this issue.

  • contact
  • legal

Menu

  • Blog
  • Wiki
  • Issues
  • Snippets