Building the library with/for MinGW64 using msys

Post Reply
Jsor
Posts: 2
Joined: Fri May 31, 2013 2:11 am

Building the library with/for MinGW64 using msys

Post by Jsor »

I'm using Go, and want to write bindings for (at least a subset of) Bullet for Go. Go more or less requires 64-bit compilation. Right now I use msys with everything set up to use 64-bit MinGW (64-bit GCC, MinGW-w64 compiled GLEW, etc). I tried building bullet, but cmake seems dead set on building everything for VC++ 10*. Can anyone give me a quick rundown of building everything for MinGW-w64 on Windows (if such a thing is indeed possible), and where all the generated files are output to? Preferably using msys, but I'm not super picky.

* And running configure seems to detect mingw32, but not mingw-w64, either way, running make seems to only output VC++ files unless I'm looking in the wrong place.

As a sidenote, it doesn't seem to detect glut, even though I have all the files in the correct MinGW64 directories (and all my environment variables set correctly to those lib/bin/include paths). I'm sure it's installed correctly because a quick bare-bones GLUT program compiles and runs correctly. I'm not sure if these two things are related or not.
laadams85
Posts: 18
Joined: Wed May 22, 2013 1:45 pm

Re: Building the library with/for MinGW64 using msys

Post by laadams85 »

You can either use the gui to change the output to mingw or change the -g option on the command line. Here is a good start on using cmake for MinGW64. http://stellarium.org/wiki/index.php/Co ... hMinGW-w64. I had issues getting glut to work as well, you may take a look at the GLUT_INCLUDE_DIR:PATH and GLUT_glut_LIBRARY:FILEPATH entries in the CMakeCache.txt file. I ended up turning the USE_GLUT:bool to off.
Jsor
Posts: 2
Joined: Fri May 31, 2013 2:11 am

Re: Building the library with/for MinGW64 using msys

Post by Jsor »

Thanks, now I'm getting the error:
c:/MinGW/msys/1.0/home/Jsor/dev/bullet-2.81-rev2613/Extras/Serialize/BulletFileLoader/bDNA.cpp: In member function 'void bParse::bDNA::init(char*, int, bool)':
c:/MinGW/msys/1.0/home/Jsor/dev/bullet-2.81-rev2613/Extras/Serialize/BulletFileLoader/bDNA.cpp:390:13: error: cast from 'char*' to 'long int' loses precision [-fpermissive]
c:/MinGW/msys/1.0/home/Jsor/dev/bullet-2.81-rev2613/Extras/Serialize/BulletFileLoader/bDNA.cpp:423:13: error: cast from 'char*' to 'long int' loses precision [-fpermissive]
make[2]: *** [Extras/Serialize/BulletFileLoader/CMakeFiles/BulletFileLoader.dir/bDNA.obj] Error 1
make[1]: *** [Extras/Serialize/BulletFileLoader/CMakeFiles/BulletFileLoader.dir/all] Error 2
make: *** [all] Error 2

When running make. I understand what the error means, but since it appears to be serialization code (based on the file path) I'm not sure if there's a good way to fix it. Any ideas?
laadams85
Posts: 18
Joined: Wed May 22, 2013 1:45 pm

Re: Building the library with/for MinGW64 using msys

Post by laadams85 »

Take out the "extras" from the cmake settings file
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Building the library with/for MinGW64 using msys

Post by Mako_energy02 »

Bumping this because I have upgraded to MinGW64 to get access to additional features and when test compiling my engine I have run into this exact problem. Disabling "Extras" or even "Serialize" in cmake isn't an option for me. Currently using Bullet 2.82.
luisoncpp
Posts: 3
Joined: Thu Mar 31, 2016 7:00 pm

Re: Building the library with/for MinGW64 using msys

Post by luisoncpp »

Sorry for resurrecting an old post, but it's not too long and I have exactly the same problem trying to compile Bullet3-2.83.7 with this version of MinGW 64:
g++.exe (Rev2, Built by MSYS2 project) 5.3.0
This is how the compiler shows the error:

Code: Select all

C:/Users/Luis/Downloads/Borrame/bullet3-2.83.7/src/Bullet3Serialize/Bullet2FileLoader/b3DNA.cpp:393:13: error: cast from 'char*' to 'long int' loses precision [-fpermissive]
   nr= (long)cp;
             ^
C:/Users/Luis/Downloads/Borrame/bullet3-2.83.7/src/Bullet3Serialize/Bullet2FileLoader/b3DNA.cpp:429:13: error: cast from 'char*' to 'long int' loses precision [-fpermissive]
   nr= (long)cp;
             ^
That error means literally that the program tries to convert a pointer to a long int, and that's wrong because a pointer has 64 bits and apparently a long int has 32 bits.
I made an attempt to solve it enabling C++11 from cmake and using the type intptr_t instead of long, but even when bullet compiled, my program crashes before running the main.
Does anyone managed to build Bullet on MinGW 64? for what I have seen, looks like it's not very portable because it depends a lot in the non-standarized sizes of the basic data types.

EDIT: actually, my debugger wasn't working well and I tought that the program was crashing before the main, but what is really happening is that everything crashes when I try to use std::cout
K3Z4
Posts: 1
Joined: Thu May 19, 2016 1:22 pm

Re: Building the library with/for MinGW64 using msys

Post by K3Z4 »

same here:

..\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp: In member function 'virtual plCollisionShapeHandle__* RealTimeBullet3CollisionSdk::createSphereShape(plCollisionWorldHandle, plReal)':
..\truijs\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp:128:62: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (plCollisionShapeHandle) world->m_nextFreeShapeIndex++;
^
..\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp: In member function 'virtual plCollisionShapeHandle__* RealTimeBullet3CollisionSdk::createPlaneShape(plCollisionWorldHandle, plReal, plReal, plReal, plReal)':
..\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp:150:62: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (plCollisionShapeHandle) world->m_nextFreeShapeIndex++;
^
..\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp: In member function 'virtual plCollisionShapeHandle__* RealTimeBullet3CollisionSdk::createCapsuleShape(plCollisionWorldHandle, plReal, plReal, int)':
..\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp:172:62: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (plCollisionShapeHandle) world->m_nextFreeShapeIndex++;
^
..\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp: In member function 'virtual plCollisionShapeHandle__* RealTimeBullet3CollisionSdk::createCompoundShape(plCollisionWorldHandle)':
..\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp:189:62: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (plCollisionShapeHandle) world->m_nextFreeShapeIndex++;
^
..\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp: In member function 'virtual plCollisionObjectHandle__* RealTimeBullet3CollisionSdk::createCollisionObject(plCollisionWorldHandle, void*, int, plCollisionShapeHandle, plReal*, plReal*)':
..\sources\bullet3-2.83.7\examples\Collision\Internal\RealTimeBullet3CollisionSdk.cpp:268:67: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (plCollisionObjectHandle)world->m_nextFreeCollidableIndex++;
Post Reply