Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to use Newton in Linux?

  1. #1

    How to use Newton in Linux?

    I'm creating a crossplataform game engine, and I decided to use Newton to do the game physics. Its all ok in Windows, but I started porting it to windows. My only problem now is with Newton, when compiling I get linker erros. The linux SDK distributed only have a .a file, not a .so file, its possible to link a .a file or convert it to a .so file?
    www.pascalgameengine.com - Crossplatform 3D game engine

  2. #2

    How to use Newton in Linux?

    You could try the following but I don't know if it will really work. There are probaby subtleties that I'm missing.

    1. Extract the object files from the static library by doing this:

    Code:
    ar x libblah.a
    This will create a number of object files, *.o.

    2. Compile these object files into a shared library with gcc (or g++?):

    Code:
    gcc -shared -o libblah.so *.o
    I think one possible problem is that if the original object files weren't compiled with the -fpic switch, the above will not work because code that goes into a shared library needs to be position-independent, which is what the -fpic switch does.
    [size=10px]"In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it's the exact opposite." -- Paul Dirac[/size]

  3. #3

    How to use Newton in Linux?

    Anyway, I thought that over a year ago the author of Newton said he would distribute a shared library for Linux in the next release. Well, we've had several next releases and it seems we're still stuck on a static library. Damn these closed-source projects!
    [size=10px]"In science one tries to tell people, in such a way as to be understood by everyone, something that no one ever knew before. But in poetry, it's the exact opposite." -- Paul Dirac[/size]

  4. #4

    How to use Newton in Linux?

    Thanks for the answer, I'll try that.
    I also found something similar in the Newton forums, altough this solution is for MacOS.
    you can create one easily yourself with the help of 'ar'

    mkdir sometmpdir && cd sometmpdir
    ar x libnewton64.a
    gcc -dynamiclib -flat_namespace *.o -o libnewton64.dylib

    thats it ... what you get is a mac os x shared library ... hope this is allowed...
    www.pascalgameengine.com - Crossplatform 3D game engine

  5. #5

    How to use Newton in Linux?

    Quote Originally Posted by Relfos
    Thanks for the answer, I'll try that.
    I also found something similar in the Newton forums, altough this solution is for MacOS.
    you can create one easily yourself with the help of 'ar'

    mkdir sometmpdir && cd sometmpdir
    ar x libnewton64.a
    gcc -dynamiclib -flat_namespace *.o -o libnewton64.dylib

    thats it ... what you get is a mac os x shared library ... hope this is allowed...
    I tried that, the g3 lib is the only one that decompiles, but the dylib is only 64k so i doubt it compiled again properly

  6. #6

    How to use Newton in Linux?

    I tried cragwolf method and it compiled and linked without problems. The program also runned without errors, altough it was a OpenGL test program and it didnt use the physics engine.
    I'll try porting another demo, one that uses some physics stuff to see if it really works
    www.pascalgameengine.com - Crossplatform 3D game engine

  7. #7

    How to use Newton in Linux?

    I followed the suggestion as well but I get a

    Linking SDLNewtonBasicDemo
    /usr/bin/lb: cannot find -lnewton

    even though I am using the -Fl switch with the path to the libNewton.a and libNewton.so

    any ideas? what arguments did you use to compile your app under linux?

    Dean
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  8. #8

    How to use Newton in Linux?

    Hi people, still no joy on linking newton under free pascal.

    anyone got any ideas? This is holding up my testing of JEDI-SDL 1.0 :cry:
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  9. #9

    How to use Newton in Linux?

    I have made some progress.

    It seems that the linker is very case sensitive, it doesn not rely on the NewtonDLL declaration but it seems to use the name of the unit (in this case newton) to locate the libraries, since the sdk ships with libNewton.a rather than libnewton.a this causes a problem, so we either need to rename the lib (which i did) or rename the unit to Newton.pas to get this to work.

    That said I now get the following errors on linking.

    Code:
    Linking SDLNewtonBasicDemo
    /usr/lib/libnewton.so&#58; undefined reference to `vtable for __cxxabiv1&#58;&#58;__si_class_type_info`
    /usr/lib/libnewton.so&#58; undefined reference to `operator delete&#40;void*&#41;`
    /usr/lib/libnewton.so&#58; undefined reference to `__gxx_personality_v0`
    /usr/lib/libnewton.so&#58; undefined reference to `__cxa_pure_virtual`
    /usr/lib/libnewton.so&#58; undefined reference to `vtable for __cxxabiv1&#58;&#58;__si_class_type_info`
    /usr/lib/libnewton.so&#58; undefined reference to `__cxa_guard_release`
    /usr/lib/libnewton.so&#58; undefined reference to `vtable for __cxxabiv1&#58;&#58;__si_class_type_info`
    /usr/lib/libnewton.so&#58; undefined reference to `__cxa_guard_abort`
    /usr/lib/libnewton.so&#58; undefined reference to `operator new&#40;unsigned int&#41;`
    /usr/lib/libnewton.so&#58; undefined reference to `_cxa_guard_acquire
    now I am a bit stumped on this one it appears to be missing something but I have no idea what. Any ideas anyone?

    Dean
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

  10. #10

    How to use Newton in Linux?

    I figured out how to get this working.

    For some reason I can't post the code here so here it the link to the topic on the Newton forum.

    http://www.newtondynamics.com/forum/...pic.php?t=2758

    You need to be a member of the forum to read it I'm afraid.

    Dean
    <A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
    <br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
    <br /></A>

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •