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

rjb doesn't compile on Cygwin #29

Closed
thorstenkampe opened this issue Jun 29, 2014 · 4 comments
Closed

rjb doesn't compile on Cygwin #29

thorstenkampe opened this issue Jun 29, 2014 · 4 comments

Comments

@thorstenkampe
Copy link

This seems to be the same issue as in issue #7 ("rjb fails to compile on windows"). This is on Cygwin64 with a 64-bit JDK 8. Same error on Cygwin32 with a 32-bit JDK.

Putting typedef long long __int64; (from jniwrap.h) above typedef __int64 jlong; in jni_md.h fixes the error.

Thorsten

$ gem install --user-install rjb
WARNING:  You don't have /home/thorsten/.gem/ruby/1.9.1/bin in your PATH,
          gem executables will not run.
Building native extensions.  This could take a while...
ERROR:  Error installing rjb:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby.exe extconf.rb
checking for jni.h... yes
checking for locale_charset() in iconv.h... no
checking for nl_langinfo() in langinfo.h... yes
checking for setlocale() in locale.h... yes
checking for getenv()... yes
creating extconf.h
creating Makefile

make
make: Warning: File 'Makefile' has modification time 1,5 s in the future
gcc -I. -I/usr/include/ruby-1.9.1/x86_64-cygwin -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -I"/cygdrive/c/Program Files/Java/jdk1.8.0_05/include" -I"/cygdrive/c/Program Files/Java/jdk1.8.0_05/include/win32" -DRUBY_EXTCONF_H=\"extconf.h\"    -ggdb -O2 -pipe -Wimplicit-function-declaration   -fno-strict-aliasing  -I"/cygdrive/c/Program Files/Java/jdk1.8.0_05/include" -I"/cygdrive/c/Program Files/Java/jdk1.8.0_05/include/win32"  -o load.o -c load.c
In file included from /cygdrive/c/Program Files/Java/jdk1.8.0_05/include/jni.h:45:0,
                 from jniwrap.h:29,
                 from load.c:31:
/cygdrive/c/Program Files/Java/jdk1.8.0_05/include/win32/jni_md.h:34:1: Fehler: unbekannter Typname: »__int64«
 typedef __int64 jlong;
 ^
Makefile:206: recipe for target 'load.o' failed
make: *** [load.o] Error 1

Gem files will remain installed in /home/thorsten/.gem/ruby/1.9.1/gems/rjb-1.4.9 for inspection.
Results logged to /home/thorsten/.gem/ruby/1.9.1/gems/rjb-1.4.9/ext/gem_make.out
@thorstenkampe
Copy link
Author

Correction: compiling does work in Cygwin32 but it gives directly this error on invocation of the gem:

Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

@arton
Copy link
Owner

arton commented Jun 29, 2014

Hi Thorsten

Do you know CYGWIN specific directive ?
It can be compiled fine on both Visual C and mingw gcc. And I don't use Cygwin and have no knowledge about Cygwin's compiler.
That means, I can't put long long stuff because if I put it on my code, Visual C can't compile it. It's more problematic for me and Visual C users.
The only resolution is you may write the code and make pull request that makes:
#if defined( CYWGIN specific symbole I have no knowledge and don't want investigate it)
typedef long long __int64;
#endif

Regards.

@thorstenkampe
Copy link
Author

There are actually two issues:

  • the if defined from jniwrap.h would have to extended to match Cygwin64
#if defined(__GNUC__) && (defined(__CYGWIN32__) || defined(__MINGW32__))
 #if !defined(__int64)
  typedef long long __int64;
 #endif
#endif
  • the Ruby gem (in this case asciidoc-diagram) cannot run the native extension
    Cygwin's gcc is very much like Linux gcc:

https://cygwin.com/cygwin-ug-net/programming.html#gcc-64

While the Mingw and Microsoft compilers use the LLP64 data model, Cygwin compilers use the LP64 data model, just like Linux. This affects the size of the type long. In the LLP64 model preferred by Microsoft, sizeof(long) is 4. This applies for the related Win32 types like LONG, ULONG, DWORD, etc., too.

But I would be fine using Mingw GCC (instead of Cygwin's gcc) if you have instructions how to do that.

@arton
Copy link
Owner

arton commented Jun 29, 2014

I believe that using Mingw gcc in most popular way is:
http://rubyinstaller.org/
It installs and prepares environment for ruby, mingw and some required libraries. And you can install gems naturally.
Best regards.

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

2 participants