0

sampleSource code(include makefile)

I make a test for the sample above, But when I compile it got error ! Did I do it wrong?

H:\Ruby\test_ymal\MyTest>make
compiling MyTest.c
In file included from d:/RailsInstaller/Ruby2.2.0/include/ruby-2.2.0/ruby/define
                 from d:/RailsInstaller/Ruby2.2.0/include/ruby-2.2.0/ruby/ruby.h
                 from d:/RailsInstaller/Ruby2.2.0/include/ruby-2.2.0/ruby.h:33,
                 from MyTest.c:2:
d:/RailsInstaller/Ruby2.2.0/include/ruby-2.2.0/ruby/win32.h:319:44: warning: 'st
 extern int clock_gettime(clockid_t, struct timespec *);
                                            ^
d:/RailsInstaller/Ruby2.2.0/include/ruby-2.2.0/ruby/win32.h:320:43: warning: 'st
 extern int clock_getres(clockid_t, struct timespec *);
                                           ^
linking shared-object mytest.so
process_begin: CreateProcess(NULL, rm -f mytest.so, ...) failed.
make (e=2):
Makefile:253: recipe for target 'mytest.so' failed
make: [mytest.so] Error 2 (ignored)
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: mytest-i38
mytest-i386-mingw32.def: file not recognized: File truncated
collect2.exe: error: ld returned 1 exit status
Makefile:253: recipe for target 'mytest.so' failed
make: *** [mytest.so] Error 1

----add by 2016/05/03 ----------------------

H:\Ruby\test_ymal\MyTest>make
generating mytest-i386-mingw32.def
compiling MyTest.c
linking shared-object mytest.so
process_begin: CreateProcess(NULL, rm -f mytest.so, ...) failed.
make (e=2):
Makefile:271: recipe for target 'mytest.so' failed
make: [mytest.so] Error 2 (ignored)

but the (mytest.so) file tested in ruby is ok .
how to solve this error?
process_begin: CreateProcess(NULL, rm -f mytest.so, ...) failed

irb(main):003:0> require 'H:\Ruby\test_ymal\MyTest\mytest.so'
=> true
irb(main):004:0> include MyTest
=> Object
irb(main):005:0> puts test1
10
=> nil
irb(main):006:0> exit
nainaigu
  • 147
  • 2
  • 13
  • please share the actual source and the Makefile that was created. This looks like an issue with the makefile or the toolchain you are using – Mircea May 02 '16 at 15:55
  • @Mircea thanks for comment. I add my test source code just now(include makefile).thanks for helping – nainaigu May 03 '16 at 00:17
  • @Mircea i fixed same bugs in makefile. but one error still exist.could you help me? – nainaigu May 03 '16 at 14:45

1 Answers1

0

i find the answer. rm -rf mytest.so process is added in makefile . just move that out.

nainaigu
  • 147
  • 2
  • 13