Cext build error on Win7 32-bit

C:\Users\Jon\Documents\JavaDev\jruby>g++ --version
g++ (tdm-1) 4.5.1

C:\Users\Jon\Documents\JavaDev\jruby>ant clean cext
……
[exec] g++ -DNDEBUG -O2 -fno-omit-frame-pointer -fno-strict-aliasing -W
-Wall -Wno-unused -Wno-parentheses -Werror -Wundef
-I"/c/Users/Jon/Documents/JavaDev/jruby/cext/src/…/…//build"
-I"/c/Users/Jon/Documents/JavaDev/jruby/cext/src"
-I"/c/Users/Jon/Documents/JavaDev/jruby/cext/src/…/…//build"/jni
-I"/c/Users/Jon/Documents/JavaDev/jruby/cext/src"/include
-I"/c/Users/Jon/Documents/JavaDev/jruby/cext/src"/include/ruby
-I"C:\Program Files\Java\jdk1.6.0_21/include" -I"C:\Program
Files\Java\jdk1.6.0_21/include/win32" -D_REENTRANT
-D_LARGEFILE64_SOURCE -D_GNU_SOURCE -march=native -mtune=native
-D_JNI_IMPLEMENTATION_ -DRUBY_DLLSPEC="__declspec(dllexport)" -c
/c/Users/Jon/Documents/JavaDev/jruby/cext/src/invoke.cpp -o
/c/Users/Jon/Documents/JavaDev/jruby/cext/src/…/…//build/invoke.o
[exec] cc1plus.exe: warnings being treated as errors
[exec] c:/Users/Jon/Documents/JavaDev/jruby/cext/src/invoke.cpp: In
function
‘jlong Java_org_jruby_cext_Native_callFunction(JNIEnv*, _jobject*,
jlong, jlong)’:
[exec]
c:/Users/Jon/Documents/JavaDev/jruby/cext/src/invoke.cpp:304:16: error:
converting to non-pointer type ‘jlong’ from NULL
[exec]
c:/Users/Jon/Documents/JavaDev/jruby/cext/src/invoke.cpp:308:16: error:
converting to non-pointer type ‘jlong’ from NULL
[exec] make: ***
[/c/Users/Jon/Documents/JavaDev/jruby/cext/src/…/…//build/invoke.o]
Error 1

BUILD FAILED
C:\Users\Jon\Documents\JavaDev\jruby\build.xml:1520: exec returned: 2


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Compiling should work again. (I really need to get a Windows CI)
Also, I changed the RbConfig library to check CC and CPP system
variables, if they are set in the environment when the process starts.
Could you try if that works for you? Also, I think I fixed passing
arguments to extconf.rb. Could you try that, too?

Regards,
Tim

On Sep 9, 2010, at 4:10 PM, Jon wrote:

[exec] c:/Users/Jon/Documents/JavaDev/jruby/cext/src/invoke.cpp:304:16: error: converting to non-pointer type 'jlong' from NULL

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iEYEARECAAYFAkyJGOgACgkQLbWJItnd6Cw9jACcCBfJ93A6pIEr6/YTsONTuN3I
QTEAnRKKyRyvrc6XNoThoBIgyIqsa+aS
=/94T
-----END PGP SIGNATURE-----


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Great!..compile worked perfectly.

I’ll try the env vars and the extconf.rb tests later and report back.
The only question I had on

http://github.com/jruby/jruby/blob/cext/src/org/jruby/libraries/RbConfigLibrary.java#L253-256

was whether there are enough spaces in ‘cc’ and ‘cpp’ for the following
lines in the case where CC or CPP come from the environment. I’ll see
if the env vars on my Win7 system come into Java with a space at the
end.

http://github.com/jruby/jruby/blob/cext/src/org/jruby/libraries/RbConfigLibrary.java#L269

http://github.com/jruby/jruby/blob/cext/src/org/jruby/libraries/RbConfigLibrary.java#L282

Jon

g++ (tdm-1) 4.5.1
[exec] make: *** [/c/Users/Jon/Documents/JavaDev/jruby/cext/src/…/…//build/invoke.o] Error 1

http://xircles.codehaus.org/manage_email

Jon


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I applied your patch and added rb_obj_clone. Redcloth’s specs are
completely green on my machine :slight_smile:

On Sep 9, 2010, at 9:46 PM, Jon wrote:

Jon
C:\Users\Jon\Documents\CDev\rdiscount>gem install rdiscount-1.6.5.jm1.gem --platform=ruby

gcc -shared -o redcloth_scan.dll redcloth_attributes.o redcloth_inline.o redcloth_sc

Great!..compile worked perfectly.

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

=== ENV VAR TEST RESULTS ===

1298c8d as-is failed for me because the CC env var didn’t come into Java
ending in a space. With the attached trivial patch I was able to
successfully install and run rdiscount but had problems with RedCloth.

The problem with RedCloth appears to be that the freshly built
lib/native/i386-Windows/jruby-cext.dll doesn’t export rb_obj_clone.

I’ve got an idea on how to make RbConfigLibrary.java a bit more simpler
and robust in this respect, but I’ll send a patch later for your review
after testing it a bit more.

Onto testing the extconf.rb arg passing…

Jon

C:\Users\Jon\Documents\CDev\rdiscount>set CC=gcc

C:\Users\Jon\Documents>echo %PATH%
C:\Users\Jon\Documents\JavaDev\jruby\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem

=== RDISCOUNT RESULTS ===

C:\Users\Jon\Documents\CDev\rdiscount>gem install
rdiscount-1.6.5.jm1.gem --platform=ruby
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
Temporarily enhancing PATH to include DevKit…
Building native extensions. This could take a while…
Successfully installed rdiscount-1.6.5.jm1
1 gem installed

C:\Users\Jon\Documents\CDev\rdiscount>jruby -e “require
‘rubygems’;require ‘rdiscount’;puts RDiscount.new(‘hello
cext
’).to_html”
calling init (63288dd6)

hello cext

=== REDCLOTH RESULTS ===

C:\Users\Jon\Documents>gem install RedCloth --platform=ruby
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
Temporarily enhancing PATH to include DevKit…
Building native extensions. This could take a while…
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.

C:/Users/Jon/Documents/JavaDev/jruby/bin/jruby.exe extconf.rb
WARNING: JRuby does not support native extensions or the mkmf' library very well. Check http://kenai.com/projects/jruby/pages/Home for alternatives. C:/Users/Jon/Documents/JavaDev/jruby/lib/ruby/1.8/mkmf.rb:29 warning: already initialized constant RUBY_PLATFORM C:/Users/Jon/Documents/JavaDev/jruby/lib/ruby/1.8/mkmf.rb:39 warning: already initialized constant MAKEFILE_CONFIG creating Makefile ...<SNIP>... gcc -I. -IC:/Users/Jon/Documents/JavaDev/jruby/lib/native/include -IC:/Users/Jon/Docu ments/JavaDev/jruby/lib/native/include/ruby -I. -fno-omit-frame-pointer -fno-strict- aliasing -fexceptions -O2 -m32 -march=native -mtune=native -c redcloth_scan.c gcc -shared -o redcloth_scan.dll redcloth_attributes.o redcloth_inline.o redcloth_sc an.o -L"." -L"/Users/Jon/Documents/JavaDev/jruby/lib" -LC:/Users/Jon/Documents/JavaDe v/jruby/lib/native/i386-Windows -ljruby-cext -Wl,--enable-auto-image-base,--enable-au to-import -m32 -march=native -mtune=native redcloth_scan.o:redcloth_scan.c:(.text+0xa33b): undefined reference to rb_obj_clone’

collect2: ld returned 1 exit status
make: *** [redcloth_scan.dll] Error 1

414605b looks good so far…redcloth is also working for me as is a curb
gem install and sucessful manual Makefile creation via extconf.rb as
shown below.

FYI, the generated Makefile has gcc hardcoded for “LDSHARED = gcc
-shared”

I’m getting failures trying to install the eventmachine gem, but that’s
another thread.

Jon

=== EXTCONF.RB ARG TEST ===

C:\Users\Jon\Documents>gem install curb --platform=ruby –
–with-curl-lib=“C:/gnuwin32/curl/bin”
–with-curl-include=“C:/gnuwin32/curl/include”
JRuby limited openssl loaded. http://jruby.org/openssl
gem install jruby-openssl for full support.
Temporarily enhancing PATH to include DevKit…
Building native extensions. This could take a while…
Successfully installed curb-0.7.8
1 gem installed

C:\Users\Jon\Documents>jruby -e “require ‘rubygems’;require ‘curb’;puts
Curl::Easy.perform(‘http://jruby.org’).body_str”
calling init (63fc1560)

JRuby.org :: Home ...

OK, let’s try creating curb’s Makefile manually…

C:\Users\Jon\Documents\JavaDev\jruby\lib\ruby\gems\1.8\gems\curb-0.7.8\ext>jruby
-rdevkit extconf.rb --with-curl-lib=“C:/gnuwin32/curl/bin”
–with-curl-include=“C:/gnuwin32/curl/include”

Temporarily enhancing PATH to include DevKit…
WARNING: JRuby does not support native extensions or the `mkmf’ library
very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
C:/Users/Jon/Documents/JavaDev/jruby/lib/ruby/1.8/mkmf.rb:29 warning:
already initialized constant RUBY_PLATFORM
C:/Users/Jon/Documents/JavaDev/jruby/lib/ruby/1.8/mkmf.rb:39 warning:
already initialized constant MAKEFILE_CONFIG
" -fno-omit-frame-pointer -fno-strict-aliasing -fexceptions"
checking for curl-config… no
checking for main() in -lcurl… yes
checking for curl/curl.h… yes
checking for curlinfo_redirect_time… yes
checking for curlinfo_response_code… yes
checking for curlinfo_filetime… yes
……
checking for curl_multi_perform()… yes
checking for Ruby 1.9 Hash… no
checking for Ruby 1.9 st.h… no
checking for curl_easy_escape… yes
creating curb_config.h
creating Makefile

I applied your patch and added rb_obj_clone. Redcloth’s specs are completely green on my machine :slight_smile:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email