Newton 2.0x Archemedia Open Beta

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Newton 2.0 Archemedia Open Beta

Postby Aphex » Sat Jan 24, 2009 9:41 am

No I'm using the CustomJoint with the physical wheels. Investigating what's happening now...
Aphex
 
Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

Re: Newton 2.0 Archemedia Open Beta

Postby Julio Jerez » Sat Jan 24, 2009 2:02 pm

when I add this command to teh make file I get these error

gcc -shared -o libNewton.so libNewton.a
nm -u libNewton.so
w _Jv_RegisterClasses
w __cxa_finalize@@GLIBC_2.2.5
w __gmon_start__
cp libNewton.a ../newtonSDK/sdk/libNewton.a
cp libNewton.so ../newtonSDK/sdk/libNewton.so
cp newton/Newton.h ../newtonSDK/sdk/Newton.h
julio@julio-desktop:~/NewtonLinux64/development$


I do not know what that mean and or it id good or bad
Do the w means warning? I can no find any reference or help on the nm utility.

if type nm -? I get the options but no the outputs definitions.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 Archemedia Open Beta

Postby martinsm » Sat Jan 24, 2009 6:04 pm

Try "nm libNewton.so" - without -u flag. It will display all the symbols in library. You should check that it includes publicly visible Newton functions (those that are in header file - NewtonCreate, NewtonDestroy, etc..). Also simply trying to link and run any example that uses Newton functions together with libNewton.so will show if libNewton.so is good or not.

About that "w" symbol - it describes symbol type. "w" means weak type (don't know what actually does it implies). Type in console "man nm" to read more about it.
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Newton 2.0 Archemedia Open Beta

Postby Julio Jerez » Sat Jan 24, 2009 6:07 pm

Ok the linuxs SDKs with shared libraries are up.
They also have simd and muticores options enabled for machine that supports them.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 Archemedia Open Beta

Postby martinsm » Sat Jan 24, 2009 9:04 pm

Julio, are you sure libNewton.so should have only 7743 bytes in size? :D
I think you just made empty so file without any Newton library functionality. At least linking simple NewtonCreate function call like in predaeus post gives me following error:
Code: Select all
$ g++ test.cpp -L. -lNewton
/tmp/cc0pb6rq.o: In function `main':
test.cpp:(.text+0x21): undefined reference to `NewtonCreate'
collect2: ld returned 1 exit status
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Newton 2.0 Archemedia Open Beta

Postby agi_shi » Sun Jan 25, 2009 10:15 am

Hm, any way of telling which the current beta is? Either just post it in the thread or in some readme.txt or version.txt, this way we can know when we need to upgrade and there won't be any confusion during discussions.
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Newton 2.0 Archemedia Open Beta

Postby Julio Jerez » Sun Jan 25, 2009 10:57 am

I am afriad I do no know how to make a shared library in linux
I had try that for years, and every possible permutation of -shared, -W, that I tried had always failed

I am read this article and I using what they say to no abal
http://tldp.org/HOWTO/Program-Library-H ... aries.html

here are some of the option I am passing an dteh all fail

libNewton.a : $(DG_OBJ_FILES)
ar r $@ $?
# strip -g -S -d -v libNewton.a -olibNewton.a
# gcc -shared xxxxx $?
# gcc -shared -o libNewton.so libNewton.a
# gcc -shared -o libNewton.so $?
gcc -shared -Wl,-soname,libNewton.so.1 \
-o libNewton.a -lc
nm libNewton.so
cp libNewton.a ../newtonSDK/sdk/libNewton.a
cp libNewton.so ../newtonSDK/sdk/libNewton.so
cp newton/Newton.h ../newtonSDK/sdk/Newton.h


They all fail an dend up on this
gcc -shared -Wl,-soname,libNewton.so.1 \
-o libNewton.a -lc
nm libNewton.so
nm: 'libNewton.so': No such file
make: *** [libNewton.a] Error 1
julio@julio-desktop:~/development$


the only command that generate something is this
gcc -shared -o libNewton.so $?

but that general several thousand of those alphabet listing.
In visual studio when you make a dynamics link library you place the world __declspec(dllexport) or __declspec(dllimport)
and that is all the is required.
I have no idea how to work that in GCC/Linux

can you make a small project that create a .so file so teh I can see it.
I have search in other occasions in the web and every thing I found is either to complex full of pendant defines and macros, or plain a simple do no work.

for example that link I posted have and example that since very nice
gcc -fPIC -g -c -Wall a.c
gcc -fPIC -g -c -Wall b.c
gcc -shared -Wl,-soname,libmystuff.so.1 \
-o libmystuff.so.1.0.1 a.o b.o -lc


the only problem is that is does now work at all.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 Archemedia Open Beta

Postby Julio Jerez » Sun Jan 25, 2009 11:00 am

Oh yes agi I will ad versions in next updates
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 Archemedia Open Beta

Postby martinsm » Sun Jan 25, 2009 11:10 am

Wll, I created shared.h file:
Code: Select all
extern "C"
{
  void DoSomething();
}

shared.cpp file:
Code: Select all
##include "shared.h"
#include <cstdio>

void DoSomething()
{
    std::printf("Hello world form so file!\n");
}

and also main.cpp file:
Code: Select all
#include "shared.h"

int main()
{
    DoSomething();
}


Now on command line I did:
Code: Select all
$ g++ -c -fpic shared.cpp -o shared.o
$ g++ -shared -Wl,-soname,libShared.so shared.o -o libShared.so
$ g++ main.cpp libShared.so -o main.exe
$ nm libShared.so
...
000004cc T DoSomething    // note that big list of symbols includes DoSomething symbol!
...
$ sudo cp libShared.so /usr/lib
$ ./main.exe
Hello world form so file!


Hope this helps!
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Newton 2.0 Archemedia Open Beta

Postby Julio Jerez » Sun Jan 25, 2009 11:24 am

I still get a huge list of output, here are few of them

U free@@GLIBC_2.2.5
U fseek@@GLIBC_2.2.5
U ftell@@GLIBC_2.2.5
U fwrite@@GLIBC_2.2.5
U logf
U malloc@@GLIBC_2.2.5
U memcpy@@GLIBC_2.2.5
U memmove@@GLIBC_2.2.5
U memset@@GLIBC_2.2.5
U pow
U pthread_create
U pthread_join
U rewind@@GLIBC_2.2.5
U sched_yield@@GLIBC_2.2.5
U setvbuf@@GLIBC_2.2.5
U sincosf
U sinf
U strcpy@@GLIBC_2.2.5
U strlen@@GLIBC_2.2.5
U sysconf@@GLIBC_2.2.5
U ungetc@@GLIBC_2.2.5
U usleep@@GLIBC_2.2.5
julio@julio-desktop:~/development$

it does make a big file, should I ignore those the list
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 Archemedia Open Beta

Postby Julio Jerez » Sun Jan 25, 2009 11:31 am

do I need to copy the .so fule to teh /usr/lib forder?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 Archemedia Open Beta

Postby martinsm » Sun Jan 25, 2009 11:46 am

Those symbols xxx@@GLIBC_2.2.5 are imports from other shared library, its ok. Try: "nm libNewton.so | grep Newton". It will display only lines that contain string Newton in them.
I was copying libShared.so file to /usr/lib folder so that main.exe executable can load it. By default so files are loaded from special directories in system. They are not loaded from current directory (unlike dll files in Windows). There is way how to force also load them from current directory, but I did not used it.
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Newton 2.0 Archemedia Open Beta

Postby Julio Jerez » Sun Jan 25, 2009 11:57 am

It worked :mrgreen: :mrgreen:

This is cool because now I can debug apps in linux.
Even for me is easier d to debug in linux now, because will will no have to rebuild each time. awesome

I cannot figure out how to automatically copy the .so file to the /usr/lib
I guess this is why people have to make those dreafull ./config mombo jumbo
I will copy the .so to the same directory that I put the .a file I will let the end user to do the coping to the /user/lib then self

I will put the two build with so file again.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0 Archemedia Open Beta

Postby martinsm » Sun Jan 25, 2009 12:08 pm

I found on google following way how to run program so that it searches shared library in current directory:
Code: Select all
$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:." ; ./main.exe


But yeah - I agree that you should not force user to put libNewton.so in /usr/lib folder. Because that folder is something like C:\Windows\System32 folder under Windows OS. Games or any software should not require for user to mess with it. Jost create shell script (smth like bat file under Win) with my code line above and instruct user to run this script instead of main executable.
martinsm
 
Posts: 86
Joined: Mon Dec 19, 2005 3:15 pm
Location: Latvia

Re: Newton 2.0 Archemedia Open Beta

Postby Julio Jerez » Sun Jan 25, 2009 1:54 pm

Ok the linux builds with shared libraries are up again.
This time I tested, whowever the make file still uses the static library since it do not install the shared library to any of the system forlders.

the user will have to copy the libNewton.so file to and teh change this line in the make file form this
# this use newton as shared or static library
#NEWTON_LIB = -lNewton
NEWTON_LIB = $(SDK_NEWTON)/libNewton.a

to this
# this use newton as shared or static library
NEWTON_LIB = -lNewton
#NEWTON_LIB = $(SDK_NEWTON)/libNewton.a


this is why I do not like Linux, not matter how simple an application is the end user will always have to deal with this obscures commands.
Please Linux world Fix Linux so that ordinary people can use it. Please add an standardized installation process
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 18 guests