michaeledgar / laser

Static analysis and style linter for Ruby code.
http://carboni.ca/projects/p/laser
GNU Affero General Public License v3.0
387 stars 17 forks source link

Compilation error on Windows #4

Open agrimm opened 13 years ago

agrimm commented 13 years ago

Running the following command on Windows with RubyInstaller installed Ruby

gem install --verbose --force pkg\laser-0.5.2.gem

gave me

Building native extensions.  This could take a while...
ERROR:  Error installing pkg\laser-0.5.2.gem:
        ERROR: Failed to build gem native extension.

        C:/Ruby19/bin/ruby.exe extconf.rb
checking for main() in -lstdc++... yes
creating Makefile

make
g++ -I. -IC:/Ruby19/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby19/include/ruby-1.9.1/ruby/backward -I/C/Ruby19/include/ruby-1.9.1 -I.   -O2 -g -Wall -Wno-parentheses     -o BasicBlock.o -c BasicBlock.cp
p
In file included from BasicBlock.cpp:1:0:
BasicBlock.h: In constructor 'Laser::BasicBlock::BasicBlock()':
BasicBlock.h:26:100: warning: converting to non-pointer type 'VALUE' from NULL
BasicBlock.h:26:100: warning: converting to non-pointer type 'VALUE' from NULL
g++ -shared -s -o BasicBlock.so BasicBlock.o -L. -LC:/Ruby19/lib -L.  -Wl,--enable-auto-image-base,--enable-auto-import   -lmsvcrt-ruby191 -lstdc++  -lshell32 -lws2_32
c:/devkit/mingw/bin/../lib/gcc/mingw32/4.5.1\libstdc++.a(stdexcept.o):stdexcept.cc:(.text+0x0): multiple definition of `std::logic_error::what() const'
c:/devkit/mingw/bin/../lib/gcc/mingw32/4.5.1/libstdc++.dll.a(d000700.o):(.text+0x0): first defined here
c:/devkit/mingw/bin/../lib/gcc/mingw32/4.5.1\libstdc++.a(stdexcept.o):stdexcept.cc:(.text+0xb0): multiple definition of `std::logic_error::~logic_error()'
c:/devkit/mingw/bin/../lib/gcc/mingw32/4.5.1/libstdc++.dll.a(d001554.o):(.text+0x0): first defined here
c:/devkit/mingw/bin/../lib/gcc/mingw32/4.5.1\libstdc++.a(stdexcept.o):stdexcept.cc:(.text+0x148): multiple definition of `std::logic_error::logic_error(std::string const&)'
c:/devkit/mingw/bin/../lib/gcc/mingw32/4.5.1/libstdc++.dll.a(d001551.o):(.text+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [BasicBlock.so] Error 1

Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/laser-0.5.2 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/laser-0.5.2/ext/laser/gem_make.out

Let me know if you need more details.

agrimm commented 13 years ago

By means of comparison, it installed fine on OS X Snow Leopard.

michaeledgar commented 13 years ago

I'm unfamiliar with mingw + ruby development, and c++ is pretty tough to make happen with Ruby to begin with. In doing some digging, such "multiple definition" issues seem to have cropped up with mingw before. It seems that specifying -lstdc++ pulls in both a DLL and a static archive of the same library. Unfortunately I'm not exactly sure how to fix this in the extconf.rb file, which is what generates that config line. I'll leave this open, and probably just end up rewriting it all in straight C, which is much easier to mix with Ruby.

agrimm commented 13 years ago

Thanks for the reply. Are the creators of RubyInstaller aware of "multiple definition" issues happening with some gems?

michaeledgar commented 13 years ago

This was incorrectly marked fixed because my redmine issue numbers differ from github's, and I haven't nailed that down yet.

agrimm commented 12 years ago

I asked about this in the RubyInstaller mailing list, and got a reply from Luis Lavena who created a gist modifying laser. http://groups.google.com/group/rubyinstaller/browse_thread/thread/b456fb497477bd

I haven't tried out the gist yet.

luislavena commented 12 years ago

@michaeledgar The gist is here:

https://gist.github.com/9c427254f4b97eb54c1b

Also, using rake-compiler will enable in a future any can generate cross compiled gems (from Linux/OSX to Windows) so you can try changes without the need of a Windows box.

Cheers.