ocra icon indicating copy to clipboard operation
ocra copied to clipboard

Native extension problem with ocra

Open SaitoWu opened this issue 9 years ago • 10 comments

Seems like ocra didn't include the .so file in the final .exe, How can i add it?

My package command is: ocra bin\linner

The gem is saitowu/linner

C:\Users\Satio\Desktop\linner-0.8.5>linner.exe
C:/Users/Satio/AppData/Local/Temp/ocrC6F3.tmp/lib/ruby/2.1.0/rubygems/ext/builde
r.rb:160:in `chdir': ERROR: Failed to build gem native extension. (Gem::Ext::Bui
ldError)

    No such file or directory @ dir_chdir - C:/Users/Satio/AppData/Local/Temp/oc
rC6F3.tmp/lib/ruby/gems/2.1.0/gems/json-1.8.2/ext/json/ext/generator

Gem files will remain installed in C:/Users/Satio/AppData/Local/Temp/ocrC6F3.tmp
/lib/ruby/gems/2.1.0/gems/json-1.8.2 for inspection.

In the orgin gem, there is a ext/generator.so file in it. And I tried to use ocra bin\linner --gem-full to package, It goes to:

C:\Users\Satio\Desktop\linner-0.8.5>linner.exe
C:/Users/Satio/AppData/Local/Temp/ocr7247.tmp/lib/ruby/2.1.0/rubygems/ext/builde
r.rb:159:in `synchronize': ERROR: Failed to build gem native extension. (Gem::Ex
t::BuildError)

    ERROR: Failed to build gem native extension.

    deadlock; recursive locking

Gem files will remain installed in C:/Users/Satio/AppData/Local/Temp/ocr7247.tmp
/lib/ruby/gems/2.1.0/gems/json-1.8.2 for inspection.
Results logged to C:/Users/Satio/AppData/Local/Temp/ocr7247.tmp/lib/ruby/gems/2.
1.0/extensions/x86-mingw32/2.1.0/json-1.8.2/gem_make.out

SaitoWu avatar Mar 16 '15 16:03 SaitoWu

I'm getting this exact error. Any progress?

Tristian avatar Mar 31 '15 19:03 Tristian

I got this issue too. My gem is json, referred by aws-sdk.

3str avatar Apr 01 '15 03:04 3str

I had similar issue and fixed it by including .so file itself instead of gem, just like if it were normal source code file.

KoBeWi avatar Apr 17 '15 22:04 KoBeWi

almost the same when including 'eventmachine'

C:/Users/Cichol/AppData/Local/Temp/ocr53CE.tmp/lib/ruby/2.1.0/rubygems/ext/build
er.rb:89:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::Build
Error)

    C:/Users/Cichol/AppData/Local/Temp/ocr53CE.tmp/bin/ruby.exe extconf.rb
mkmf.rb can't find header files for ruby at C:/Users/Cichol/AppData/Local/Temp/o
cr53CE.tmp/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in C:/Users/Cichol/AppData/Local/Temp/ocr53CE.tm
p/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.7 for inspection.

app.rb:

require 'eventmachine'

Gemfile:

gem 'eventmachine'

command:

ocra app.rb --gemfile Gemfile --no-dep-run --gem-full=eventmachine --add-all-core

onyxblade avatar Jul 16 '15 12:07 onyxblade

I have the same error with the json gem. Did someone find a fix?

louisatome avatar Nov 30 '15 11:11 louisatome

Hello larsch, guys. Reporting same error here.

Windows 8.1 Enterprise x64 ruby 2.1.7p400 (2015-08-18 revision 51632) [i386-mingw32] ocra (1.3.6) json (1.8.3)

damian-m-g avatar Jan 26 '16 12:01 damian-m-g

I confirm same issue happening on ruby-2.2.2-p95x64 (not expecting to work in there, just in case).

Working with ruby-2.0.0-p647.

Been testing with 3 last versions of json just in case it was the problem but is not. Also there's no bug report related on its website.

damian-m-g avatar Jan 26 '16 13:01 damian-m-g

Same issue here as well with json 1.8.3 and ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]

mjbyter avatar Apr 04 '16 13:04 mjbyter

@matthewayala I made this quick ugly fix that resolved the problem with the json gem if i remember correctly... https://github.com/louisatome/ocra/commit/41cff48ac2c6e5b728e0a052eb4378017ec4e424

louisatome avatar Apr 04 '16 14:04 louisatome

@louisatome Thanks! Using your fix along with --gem-full=json did the trick

mjbyter avatar Apr 04 '16 17:04 mjbyter