Page 1 of 1

Compiling...

Posted: Mon Jan 04, 2010 12:22 am
by Dave
Hey guys. I'm reluctant to do this, but I have no choice now. I've tried and tried to compile the new version of chipmunk, but I just can't seem to do it. Could someone please upload up a compiled static lib for win32/mingw please? Thanks. :)

Re: Compiling...

Posted: Mon Jan 04, 2010 9:26 am
by slembcke
And please post a patch so I can add whatever changes are needed to trunk!

Re: Compiling...

Posted: Mon Jan 04, 2010 10:03 am
by viblo
I have successfully compiled a dll manually on windows with mingw/gcc. I need to do it manually for pymunk so I don't know how/if it works with cmake/make and mingw.

Try with these two commands (from the chipmunk src directory where chipmunk.h and the other files are):

Code: Select all

> gcc -O3 -std=gnu99 -ffast-math -c *.c constraints/*.c
> gcc -static -o libchipmunk.a *.o
(I can try it myself when Im on my normal computer later if the commands above doesnt work for you.)

edit: Fixed the second command.

Re: Compiling...

Posted: Mon Jan 04, 2010 7:00 pm
by Dave
Well, the first line compiles all the object files successfully, but the linker runs into a problem. Thanks for the help man, I really appreciate it. 8-)
gcc wrote:C:\Chipmunk-5.0.0\src>gcc -O3 -std=gnu99 -ffast-math -c *.c constraints/*.c

C:\Chipmunk-5.0.0\src>gcc -o chipmunk.a *.o
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0xd2): undefined reference to `Win
Main@16'
collect2: ld returned 1 exit status
Edit:
Actually, I think I can manage now that I have the object files. I should be able to use the freebasic linker, which I think is actually the same one gcc uses... I'm not positive on that, but I was able to get a static lib that way before. Hey, Slembcke. If you want, I'll post the translated headers and stuff for that compiler after I've finished. It's kind of obscure, but it would be one more binding in the tank... if you want it. I know there are interested freebasic users. ;)

Edit2: lol
Not to be a pest, but I've got all the object files compiled into a static lib. Now to get the new headers translated. Swig chokes on a few of the macros for some reason, but we'll get it. ;)

Re: Compiling...

Posted: Tue Jan 05, 2010 4:45 am
by viblo
Oh, I see now that I missed the -static argument to gcc, sorry about that. (and you might want to call the out file libchipmunk.a instead)

Code: Select all

> gcc -static -o libchipmunk.a *.o
this should work better :)

Re: Compiling...

Posted: Wed Jan 06, 2010 8:06 am
by badday
Hi there,

I did also try to compile it (under Linux) and did what was written above.
But it still seems to do not work.
Here is what i get:
gcc -o chipmunk.a *.o
/usr/lib/gcc/x86_64-redhat-linux/4.4.2/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
cpDampedRotarySpring.o: In function `applyImpulse':
cpDampedRotarySpring.c:(.text+0x175): undefined reference to `exp'
cpDampedSpring.o: In function `applyImpulse':
cpDampedSpring.c:(.text+0x1fc): undefined reference to `exp'
cpSpace.o: In function `cpSpaceStep':
cpSpace.c:(.text+0x375): undefined reference to `pow'
cpVect.o: In function `cpvforangle':
cpVect.c:(.text+0x5f): undefined reference to `sincos'
cpVect.o: In function `cpvslerp':
cpVect.c:(.text+0xb9): undefined reference to `acos'
cpVect.c:(.text+0xed): undefined reference to `sin'
cpVect.c:(.text+0x11e): undefined reference to `sin'
cpVect.c:(.text+0x14d): undefined reference to `sin'
cpVect.o: In function `cpvslerpconst':
cpVect.c:(.text+0x1f9): undefined reference to `acos'
cpVect.c:(.text+0x241): undefined reference to `sin'
cpVect.c:(.text+0x276): undefined reference to `sin'
cpVect.c:(.text+0x2a9): undefined reference to `sin'
cpVect.o: In function `cpvtoangle':
cpVect.c:(.text+0x3d): undefined reference to `atan2'
collect2: ld gab 1 als Ende-Status zurück
Last line is German, English Version should be something like: ld returned 1 exit status

However: Are there any suggestions for solving it?
By the way: Using "cmake . " I get:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GLUT_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/badday/Desktop/Chipmunk-5.0.0/Demo

-- Configuring incomplete, errors occurred!
This is my first post, I hope this is the right place...

Thanks a lot.

badday

Re: Compiling...

Posted: Wed Jan 06, 2010 9:43 am
by viblo
The first problem is because I forgot the -static argument in my first post, sorry for the confusion. I did a followup post and now Ive edited it so if you try with -static it should work.

The second one has to do with glut, it looks like it cant find glut when it compiles the Demos. You can compile chipmunk without the demos if you like, you just need to tell cmake to skip it:

Code: Select all

> cmake -D BUILD_DEMOS=OFF .
(you can see the available options in CMakeLists.txt)

Re: Compiling...

Posted: Wed Jan 06, 2010 10:06 am
by slembcke
badday wrote:Hi there,

I did also try to compile it (under Linux) and did what was written above.
But it still seems to do not work.
Here is what i get:
...

Last line is German, English Version should be something like: ld returned 1 exit status

However: Are there any suggestions for solving it?
By the way: Using "cmake . " I get:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GLUT_INCLUDE_DIR (ADVANCED)
used as include directory in directory /home/badday/Desktop/Chipmunk-5.0.0/Demo

-- Configuring incomplete, errors occurred!
This is my first post, I hope this is the right place...

Thanks a lot.

badday
The first set of errors is trying to compile without CMake? Looks like you need to include the math library. -lm

As for the CMake error, do you have GLUT installed?

Re: Compiling...

Posted: Wed Jan 06, 2010 11:08 am
by badday
Well, I tried to compile it without the Demo-files what worked fine.
But you seem to be right, however I have what I wanted, so thanks a lot.

badday