Building Newton

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Building Newton

Postby tanzfisch » Thu Mar 24, 2016 4:48 am

Hi,

it's highly likely that this was asked many times before but when I search for "build" I get too many hit's that have not so much to do with actually building newton.

So I'm using newton for some time now. But I always used some binaries I found in a random places in the internet which I don't remember anymore. Now I'd like to build Newton by my self but the lack of documentation makes it a real chewy task.

Is there any step by step tutorial you can point me to?
I'm using Visual Studio 2015 with Windows 7 and 10.

Thank you!
tanzfisch
 
Posts: 34
Joined: Fri Feb 05, 2016 5:17 am

Re: Building Newton

Postby tanzfisch » Thu Mar 24, 2016 6:13 am

ok as far as I got so far ...

downloaded tag 3.13

run cmake as out of source build
source: newton-dynamics-newton-3.13
build: newton-dynamics-newton-3.13\build

generation fails with: wxwidgets not found

than set NEWTON_DEMOS_SANDBOX to false

generation fails with: ENet not found

remove the following lines from newton-dynamics-newton-3.13\packages\CMakeLists.txt
#find_package(ENet)
#include_directories(${ENet_INCLUDE_DIRS})
#target_link_libraries(dVisualDebuggerServer ${ENet_LIBRARY})

generation works

open newton-dynamics-newton-3.13\build\NewtonSDK.sln^

full build fails

just building Newton

get an compile error

1>------ Rebuild All started: Project: NewtonObj, Configuration: Debug x64 ------
1> dgTypes.cpp
1>C:\Users\relogm\Downloads\newton-dynamics-newton-3.13\newton-dynamics-newton-3.13\coreLibrary_300\source\pthreads.2\pthread.h(320): error C2011: 'timespec': 'struct' type redefinition
1> C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\time.h(39): note: see declaration of 'timespec'
2>------ Rebuild All started: Project: Newton, Configuration: Debug x64 ------
2>LINK : fatal error LNK1104: cannot open file 'C:\Users\relogm\Downloads\newton-dynamics-newton-3.13\newton-dynamics-newton-3.13\build\coreLibrary_300\NewtonObj.dir\Debug\dg.obj'
========== Rebuild All: 0 succeeded, 2 failed, 0 skipped ==========

Is there something I have to configure in order to use pthreads?
tanzfisch
 
Posts: 34
Joined: Fri Feb 05, 2016 5:17 am

Re: Building Newton

Postby tanzfisch » Thu Mar 24, 2016 6:28 am

Just to try out I removed the timespec definition in pthread.h

and Than there cam the next error message

1>------ Build started: Project: NewtonObj, Configuration: Debug x64 ------
1> dgWorld.cpp
1>C:\Users\relogm\Downloads\newton-dynamics-newton-3.13\newton-dynamics-newton-3.13\coreLibrary_300\source\physics\dgWorld.cpp(54): fatal error C1083: Cannot open include file: 'dgAmpInstance.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

So this is not getting anywhere soon. Please help!
tanzfisch
 
Posts: 34
Joined: Fri Feb 05, 2016 5:17 am

Re: Building Newton

Postby tanzfisch » Thu Mar 24, 2016 6:54 am

So after reading some code I added the defines

_TIMESPEC_DEFINED and _DURANGO

now it's compiling and linking ...

Well it would be nice if there was more documentation and even nicer if code would just build after checkout. :-/
tanzfisch
 
Posts: 34
Joined: Fri Feb 05, 2016 5:17 am

Re: Building Newton

Postby d.l.i.w » Thu Mar 24, 2016 7:16 am

I'm using Visual Studio 2015 with Windows 7 and 10.


You can use one of the Visual Studio projects in coreLibrary_300/projects/windows/.

The CMake project has code to deal with Windows, but it is not tested at all. Currently CMake is only an (usually more up to date) alternative to the handwritten makefiles for Linux.
d.l.i.w
 
Posts: 81
Joined: Mon Sep 26, 2011 4:35 am

Re: Building Newton

Postby collerblade » Sun Mar 27, 2016 3:53 pm

Have u compiled a dll, or just static lib?
If it is a dll can u pass it to me? x64 or x86?
collerblade
 
Posts: 88
Joined: Mon Apr 05, 2010 12:09 pm

Re: Building Newton

Postby AntonSynytsia » Sun Mar 27, 2016 5:05 pm

It's easy to build newton if you have visual studio.
  1. Go to newton-dynamics\packages\projects\visualStudio_20XY\
  2. Open build.sln
  3. Set desired configuration to releaseDll, 32 or 64 bit.
  4. Uncomment #define DG_USE_THREAD_EMULATION in core/threading/dgThread.h if threads are unstable.
  5. In the solution explorer, right click on newton project and select build.
  6. Once the build is completed, go to newton-dynamics\coreLibrary_300\projects\windows\project_vs20XY\[Win32 or x64]\newton\ and the newton.dll will be there.

Here is a zip of 3.13 and the latest 3.14 builds: https://drive.google.com/open?id=0B3qg8 ... VpXektnVEU
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Building Newton

Postby tanzfisch » Tue Mar 29, 2016 4:28 am

d.l.i.w wrote:The CMake project has code to deal with Windows, but it is not tested at all.


that explains a lot ...

d.l.i.w wrote:You can use one of the Visual Studio projects


That was my first attempt but it did not compile either. I guess I will give it an other shot because the first time I had not patience to fix what ever was not working.

Thanks Anton I will try that.
tanzfisch
 
Posts: 34
Joined: Fri Feb 05, 2016 5:17 am

Re: Building Newton

Postby tanzfisch » Tue Mar 29, 2016 4:29 am

AntonSynytsia wrote:It's easy to build newton if you have visual studio.
  1. Go to newton-dynamics\packages\projects\visualStudio_20XY\
  2. Open build.sln
  3. Set desired configuration to releaseDll, 32 or 64 bit.
  4. Uncomment #define DG_USE_THREAD_EMULATION in core/threading/dgThread.h if threads are unstable.
  5. In the solution explorer, right click on newton project and select build.
  6. Once the build is completed, go to newton-dynamics\coreLibrary_300\projects\windows\project_vs20XY\[Win32 or x64]\newton\ and the newton.dll will be there.

Here is a zip of 3.13 and the latest 3.14 builds: https://drive.google.com/open?id=0B3qg8 ... VpXektnVEU


Ic see. last time I tried newton-dynamics-newton-3.13\coreLibrary_300\projects\windows
what is the difference?
tanzfisch
 
Posts: 34
Joined: Fri Feb 05, 2016 5:17 am

Re: Building Newton

Postby tanzfisch » Tue Mar 29, 2016 4:34 am

So I just tried as Anton suggested but I still get the build error

3>c:\users\relogm\downloads\newton-dynamics-newton-3.13\newton-dynamics-newton-3.13\corelibrary_300\source\pthreads.2\pthread.h(320): error C2011: 'timespec': 'struct' type redefinition

and after I fixed that I get

2>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\exception(358): error C2220: warning treated as error - no 'object' file generated

Will try once more with the current head version
tanzfisch
 
Posts: 34
Joined: Fri Feb 05, 2016 5:17 am

Re: Building Newton

Postby tanzfisch » Tue Mar 29, 2016 4:47 am

Ok the todays head from master builds.

But still I get at first the build error about the redefinition of timespec.
tanzfisch
 
Posts: 34
Joined: Fri Feb 05, 2016 5:17 am

Re: Building Newton

Postby AntonSynytsia » Tue Mar 29, 2016 5:26 am

tanzfisch wrote:Ic see. last time I tried newton-dynamics-newton-3.13\coreLibrary_300\projects\windows
what is the difference?

By default the projects within the coreLibrary_300 don't have the .sln, which launches all projects at once. The sln is automatically generated once you open the newton.vcproj file, but from my previous experience it doesn't load dependencies, which results in errors when compiling. I suggest compiling from the packages folder as described in my prior post.
tanzfisch wrote:So I just tried as Anton suggested but I still get the build error
I assume you tried building from the packages folder. I compiled with visual studio 2010 and don't get the timespeck error. VS2012 and VS2013 builds might be broken in newton 3.13. Compiling Newton 3.14 with VS2015, I do get the timespec error. To fix it, open pthread.h, scroll to line 316 and enclose the timespec struct with additional _CRT_NO_TIME_T define check. It should look like this:
Code: Select all
#if !defined(HAVE_STRUCT_TIMESPEC)
#define HAVE_STRUCT_TIMESPEC
#if !defined(_TIMESPEC_DEFINED)
#define _TIMESPEC_DEFINED
#if defined(_CRT_NO_TIME_T)
struct timespec {
        time_t tv_sec;
        long tv_nsec;
};
#endif /* _CRT_NO_TIME_T */
#endif /* _TIMESPEC_DEFINED */
#endif /* HAVE_STRUCT_TIMESPEC */

Note that this is not the most optimal way to do it as it might break builds with prior VC versions.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Building Newton

Postby tanzfisch » Tue Mar 29, 2016 6:33 am

Yes my last attempt was to build from the packages folder.
I used the VS2013 and converted it to VS2015.
Except for the redefinition of timespec the build is fine.

After some minor interface adoptions my applications run with it too. :-D
tanzfisch
 
Posts: 34
Joined: Fri Feb 05, 2016 5:17 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron