code-google-com / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

cmake . -G "MinGW Makefiles" fails #352

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Download and extract bullet-2.76.zip
2. In root directory, run cmake . -G "MinGW Makefiles"

Cmake produces the following results:
-------------------------------------------------------
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: C:/Qt/2010.02/mingw/bin/gcc.exe
-- Check for working C compiler: C:/Qt/2010.02/mingw/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Qt/2010.02/mingw/bin/g++.exe
-- Check for working CXX compiler: C:/Qt/2010.02/mingw/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:126 (string):
  string sub-command REPLACE requires at least four arguments.

OPENGL FOUND
glu32opengl32
GLUT NOT FOUND not found, trying to use MINGW glut32
-- Configuring incomplete, errors occurred!
-------------------------------------------------------

What version of the product are you using? On what operating system?
OS: Windows Vista Home Premium 32 bit
CMake ver. 2.8
MinGW as a part of QT SDK 2010.02.

Original issue reported on code.google.com by mikhail....@gmail.com on 3 Mar 2010 at 12:13

GoogleCodeExporter commented 9 years ago

Can you try replacing those lines around 126 by this check and see if that 
helps?

IF (USE_GLUT AND MSVC)
        string (REPLACE "/D_WINDOWS" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
        remove_definitions(-D_WINDOWS )
ENDIF()

Original comment by erwin.coumans on 3 Mar 2010 at 8:50

GoogleCodeExporter commented 9 years ago
Yes, this helps. 

Cmake produces the following results:
-------------------------------------------------------
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: C:/Qt/2010.02/mingw/bin/gcc.exe
-- Check for working C compiler: C:/Qt/2010.02/mingw/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: c:/Qt/2010.02/mingw/bin/g++.exe
-- Check for working CXX compiler: c:/Qt/2010.02/mingw/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
OPENGL FOUND
glu32opengl32
GLUT NOT FOUND not found, trying to use MINGW glut32
-- Configuring done
-- Generating done
-- Build files have been written to: C:/bullet-2.76
-------------------------------------------------------

Thanks!

Original comment by mikhail....@gmail.com on 3 Mar 2010 at 9:16

GoogleCodeExporter commented 9 years ago
in file bullet-2.76/Extras/Serialize/BulletFileLoader/bChunk.h
line 20 should be changed from

#ifdef _WIN32

to 

#if defined (_WIN32) && ! defined (__MINGW32__)

in order to compile with MinGW. Otherwise MinGW will complain about __int64 not 
naming a type.

Original comment by mikhail....@gmail.com on 3 Mar 2010 at 9:31

GoogleCodeExporter commented 9 years ago
New problems while making. 

-------------------------------------------------------
[ 76%] Built target AppBasicDemo
Linking CXX executable AppBox2dDemo.exe
Warning: resolving __imp__glClear by linking to __imp__glClear@4
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
Warning: resolving __imp__glDisable by linking to __imp__glDisable@4
Warning: resolving __imp__glMatrixMode by linking to __imp__glMatrixMode@4
Warning: resolving __imp__glLoadIdentity by linking to __imp__glLoadIdentity@0
Warning: resolving __imp__glDisableClientState by linking to __imp__glDisableCli
entState@4
Warning: resolving __imp__glEnableClientState by linking to __imp__glEnableClien
tState@4
Warning: resolving __imp__glVertexPointer by linking to __imp__glVertexPointer@1
6
Warning: resolving __imp__glDrawArrays by linking to __imp__glDrawArrays@12
Warning: resolving __imp__glLineWidth by linking to __imp__glLineWidth@4
Warning: resolving __imp__glPopMatrix by linking to __imp__glPopMatrix@0
Warning: resolving __imp__glPushMatrix by linking to __imp__glPushMatrix@0
Warning: resolving __imp__glViewport by linking to __imp__glViewport@16
Warning: resolving __imp__glOrtho by linking to __imp__glOrtho@48
Warning: resolving __imp__glEnable by linking to __imp__glEnable@4
Warning: resolving __imp__glBlendFunc by linking to __imp__glBlendFunc@8
CMakeFiles\AppBox2dDemo.dir\Box2dDemo.obj:Box2dDemo.cpp:(.text+0x25e): undefined
 reference to `_imp__glFlush'
CMakeFiles\AppBox2dDemo.dir\Box2dDemo.obj:Box2dDemo.cpp:(.text+0x428): undefined
 reference to `_imp__glFlush'
..\..\lib\libOpenGLSupport.a(GL_DialogWindow.obj):GL_DialogWindow.cpp:(.text+0x1
b5): undefined reference to `_imp__glColor4ub'
..\..\lib\libOpenGLSupport.a(GL_DialogWindow.obj):GL_DialogWindow.cpp:(.text+0x6
56): undefined reference to `_imp__glColor4ub'
..\..\lib\libOpenGLSupport.a(GL_DialogWindow.obj):GL_DialogWindow.cpp:(.text+0x7
0b): undefined reference to `_imp__glTexEnvi'
..\..\lib\libOpenGLSupport.a(GL_DialogWindow.obj):GL_DialogWindow.cpp:(.text+0x7
4a): undefined reference to `_imp__glPopClientAttrib'
..\..\lib\libOpenGLSupport.a(GL_DialogWindow.obj):GL_DialogWindow.cpp:(.text+0x7
4f): undefined reference to `_imp__glPopAttrib'
..\..\lib\libOpenGLSupport.a(GL_DialogWindow.obj):GL_DialogWindow.cpp:(.text+0x7
b3): undefined reference to `_imp__glGetIntegerv'
..\..\lib\libOpenGLSupport.a(GL_DialogWindow.obj):GL_DialogWindow.cpp:(.text+0x8
7d): undefined reference to `_imp__glGetFloatv'
..\..\lib\libOpenGLSupport.a(GL_DialogWindow.obj):GL_DialogWindow.cpp:(.text+0x9
04): undefined reference to `_imp__glGetTexEnviv'
..\..\lib\libOpenGLSupport.a(GL_DialogWindow.obj):GL_DialogWindow.cpp:(.text+0x9
21): undefined reference to `_imp__glTexEnvi'
collect2: ld returned 1 exit status
mingw32-make[2]: *** [Demos/Box2dDemo/AppBox2dDemo.exe] Error 1
mingw32-make[1]: *** [Demos/Box2dDemo/CMakeFiles/AppBox2dDemo.dir/all] Error 2
mingw32-make: *** [all] Error 2
-------------------------------------------------------

Originally my QT MinGW distribution didn't contain libglut32.a, so I downloaded 
it 
from http://chortle.ccsu.edu/Bloodshed/glutming.zip and placed it into 
mingw\lib. 

Note that previous version of bullet (2.75) compiled just fine with this trick.

Original comment by mikhail....@gmail.com on 3 Mar 2010 at 9:41

GoogleCodeExporter commented 9 years ago
Is glColor4ub etc not supported by your OpenGL/glut version?

Original comment by erwin.coumans on 3 Mar 2010 at 10:52

GoogleCodeExporter commented 9 years ago
Well, mingw/include/gl/gl.h contains declaration 
-------------------------------------------------------
GLAPI void APIENTRY glColor4ub( GLubyte red, GLubyte green, GLubyte blue, 
GLubyte 
alpha );
-------------------------------------------------------

and mingw/lib/libopengl32.a contains symbols _glColor4ub@16, 
__imp__glColor4ub@16.

So I suppose, it is supported.

Original comment by mikhail....@gmail.com on 6 Mar 2010 at 5:11

GoogleCodeExporter commented 9 years ago

You might want to check this with the MinGW developers. It works just fine under
Windows, Mac OSX and Linux.

Thanks,
Erwin

Original comment by erwin.coumans on 15 Mar 2010 at 10:07

GoogleCodeExporter commented 9 years ago
(or just skip AppBox2dDemo, remove Box2dDemo from the 
Bullet/Demos/CCmakeLists.txt)

Original comment by erwin.coumans on 15 Mar 2010 at 10:09

GoogleCodeExporter commented 9 years ago
Unless you come up with a patch, we don't have resources to fix OpenGL issues 
that 
happen with MinGW.

Original comment by erwin.coumans on 31 Mar 2010 at 9:03

GoogleCodeExporter commented 9 years ago
I had the same linker errors for AppBox2dDemo.exe (on MSYS/MinGW). 

Try adding
#include <GL/gl.h> 
to GL_DialogWindow.h  around line 41:

#ifdef _WINDOWS
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#else
#include <GL/gl.h> // ~line 41: ADD THIS FOR "MSYS Makefiles"
#include <GL/glut.h>
#endif
#endif

I hope it also helps for the "MinGW Makefiles" cmake-option!

Original comment by peter.ho...@gmail.com on 2 Apr 2010 at 11:39

GoogleCodeExporter commented 9 years ago
It seems that, depending on the GLUT implementation that you are using, the 
calling 
convention for GL&GLUT functions might be "guessed incorrectly". 

For example, on my system, when including gl.h before glut.h, APIENTRY is set 
to 
__stdcall and everything works fine. 

When including glut.h only, I get an "empty definition" for APIENTRY:
#define APIENTRY 
This leads to the above mentioned linker errors...

I hope that helped!

p.s.: Maybe other preprocessor tokens like "CALLBACK" lead to similar errors.

Original comment by peter.ho...@gmail.com on 4 Apr 2010 at 6:02

GoogleCodeExporter commented 9 years ago
I don't know a lot about compilers, but I can read error messages and decide 
what I need and don't need. Since i'm using this for just physics and CD, i had 
to eliminate the threading files and so ignoring them in the build. This worked 
and it's simple (just in case anyone is a newbee or worse than I, here's how I 
did it: )

(I was having the same error btw as this user). I'm using MinGW32 version 4, 
CodeBlocks 10, and Bullet release 4.7. On Win Vista Home Premium. I opened a 
new project in Code::Blocks (CB) and went to the directory where I downloaded 
and unpacked Bullet Physics (BP) by right clicked my project name 
(bulletphysicstest) and ->Add Recursively that file (C:\Bullet\src - (i 
installed it in C:\Bullet). 

I was having errors making it relating to OpenCL as well as the Threading 
libraries from BP, so, like mikhail..@gmail.com above, I went to  
http://chortle.ccsu.edu/Bloodshed/glutming.zip and downloaded just 
thelibglut32.a file into the directory where i have mingw compiler lib 
(mingw/lib) (you can check where yours is in CB by going to the menu 
bar->Settings->Compiler and Debugger->Toolchains and Executables tab->C++ 
compiler (or c, or whatever you're using).
That cleared the first problem.

The second problem the Build was failing on was dealing with the Threading 
libraries, so in panel that lists all sources/headers and others, i deleted the 
threading folder (recursively, so all subfolders were deleted as well). 

There are many threading apps if you need, including windows.h built in 
threaders, (i use sfml's sf::Thread for simple stuff though it's mostly for my 
graphics library). 

In any case, I cleaned, and rebuilt the project, and it all compiled without 
errors. Ready to go.

Original comment by TheBryan...@gmail.com on 3 Oct 2011 at 11:33

GoogleCodeExporter commented 9 years ago
I also got the cmake . -G "MinGW Makefiles" fail

Got it to work by appending two lines in CMakeLists.txt:

After:
            #TODO add better GLUT detection for MinGW
Append:
            INCLUDE_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/Glut)
            SET(GLUT_glut_LIBRARY ${BULLET_PHYSICS_SOURCE_DIR}/Glut/glut32.lib)

Hope this helps

Original comment by Yannick.Semail@gmail.com on 30 Oct 2011 at 12:35