A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by inquisitor » Thu Jan 22, 2015 1:00 am
I'm trying to compile Newton from source using cmake to generate a makefile and mingw 64 to compile. It gets to 50% but fails when linking:
- Code: Select all
[ 50%] Built target NewtonObj
Linking CXX shared library ..\bin\libNewton.dll
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x2f): undefined reference to `__imp_sched_yield'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0xbe): undefined reference to `__imp_pthread_create'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0xf3): undefined reference to `__imp_sem_init'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x103): undefined reference to `__imp_sem_destroy'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x113): undefined reference to `__imp_sem_post'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x123): undefined reference to `__imp_sem_wait'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x153): undefined reference to `__imp_pthread_create'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x18f): undefined reference to `__imp_pthread_join'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x1c7): undefined reference to `__imp_pthread_getschedparam'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x216): undefined reference to `__imp_pthread_getschedparam'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x23c): undefined reference to `__imp_pthread_setschedparam'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x253): undefined reference to `__imp_sem_wait'
CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj):dgThread.cpp:(.text+0x271): undefined reference to `__imp_sem_wait'
f:/custom/tentacle/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\Newton.dir/objects.a(dgThread.cpp.obj
): bad reloc address 0x0 in section `.pdata'
collect2.exe: error: ld returned 1 exit status
coreLibrary_300\CMakeFiles\Newton.dir\build.make:233: recipe for target `bin/libNewton.dll' failed
mingw32-make[2]: *** [bin/libNewton.dll] Error 1
CMakeFiles\Makefile2:78: recipe for target `coreLibrary_300/CMakeFiles/Newton.dir/all' failed
mingw32-make[1]: *** [coreLibrary_300/CMakeFiles/Newton.dir/all] Error 2
makefile:116: recipe for target `all' failed
mingw32-make: *** [all] Error 2
But pthread's code appears to be present amongst the source files. It shouldn't have this problem.... I'm a little confused. I've tried grabbing pthreads-win32, but I don't know how to tell it where pthreads is.
I'm currently downloading the entire repo again (should be done tonight) and I'll try again from scratch.
Does this compile under Mingw at all, or do I absolutely need to use Microsoft's tools?
Last edited by
inquisitor on Sun Feb 01, 2015 9:08 pm, edited 1 time in total.
-
inquisitor
-
- Posts: 5
- Joined: Thu Jan 22, 2015 12:41 am
by Julio Jerez » Thu Jan 22, 2015 1:32 am
The linux build should exclude pthread.
pThread is only for windows.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by inquisitor » Thu Jan 22, 2015 2:11 am
Thanks for the quick comeback!
No, not building on Linux. Building on Windows. I just started again from scratch (in case I maybe messed something up). Same result, but this time I captured all output. I can't attach it here; I can't figure out what file extensions are allowed (not .txt or .log, tried those, FAQ says moderator decide these things). Posting it would make this post too big.
Not to worry, it's the same link error. Before the link error, there are dozens and dozens of warnings, all of which are "x redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]" where x is some function call. They all look like pthreads calls (like sem_wait or pthread_detach for example). Hmmmmmm...
It's getting pretty late in my neck of the woods and I'm heading to bed. I'll look through this tomorrow and see if I can't find the problem.
-
inquisitor
-
- Posts: 5
- Joined: Thu Jan 22, 2015 12:41 am
by manny » Thu Jan 22, 2015 4:39 am
You could also try to compile with THREAD EMULATION enabled, however you'll loose all multi threading features then.
-
manny
- Site Admin

-
- Posts: 131
- Joined: Tue Feb 11, 2014 6:49 pm
by d.l.i.w » Thu Jan 22, 2015 5:30 am
The cmake files currently don't support / aren't tested on Windows. Instead Visual Studio solutions are provided. AFAIK there are makefiles for mingw, too. But these might be outdated.
I tried to improve the cmake files in the past, but I don't have Windows to test; see
pull request for reference.
It would be awesome if you could figure out, what needs to be done...
-
d.l.i.w
-
- Posts: 81
- Joined: Mon Sep 26, 2011 4:35 am
by Julio Jerez » Thu Jan 22, 2015 10:49 am
d.l.i.w
was that pull request integrated?
as I remember the posit Make file exclude the pThread open source project and the xwidget for Linux
the posit makefile sould work on mwing, I have no tested because of all the hazel of installing wing in windows, there are some many version and they are all different.
last time I did it I have window 7, but after I update to window 8 started fresh and I did no installed mwing.
-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by d.l.i.w » Thu Jan 22, 2015 12:49 pm
Yes, you merged it (
commit)
Don't know the status of the makefile in "coreLibrary_300/projects/mingw32", but I assume it meanwhile became outdated.
As far as CMake (on Linux) and the *nix makefiles are concerned, pthreads definitely is *not* included in there.
The biggest part of the cmake files should be ready for Windows, only linking needs to be fixed (together with the 3rd party libraries).
If - by chance - I will need a Windows development system later this year, I may be able to fix this up.
This would have the big advantage, that cmake (in theorie - never actually tested) shoud be able to create appropriate VS solutions.
-
d.l.i.w
-
- Posts: 81
- Joined: Mon Sep 26, 2011 4:35 am
by Julio Jerez » Thu Jan 22, 2015 1:41 pm
d.l.i.w wrote:This would have the big advantage, that cmake (in theory - never actually tested) should be able to create appropriate VS solutions.
that's the dirty little secret of open source development, It promise cross compatibility but it rarely deliver it. At best you get a convoluted set if conditional sameness all over the places.

-
Julio Jerez
- Moderator

-
- Posts: 12426
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by inquisitor » Thu Jan 22, 2015 7:55 pm
Oh wow. I didn't expect this much help. Thanks guys!
I just got home from work now.... I'll look at what the makefile is doing tonight if I can. Maybe maybe I can fix this...
And here I thought I was losing my mind.

-
inquisitor
-
- Posts: 5
- Joined: Thu Jan 22, 2015 12:41 am
by inquisitor » Tue Jan 27, 2015 11:38 pm
Ok, to speed things up a bit I used the makefile from coreLibrary_300/projects/mingw32 which built a static libnewton.a just fine. That should be enough for me to start picking through tutorials. If it works fine, I'll mark this thread as solved.
If I have time, I'll look at what the generated cmake is doing wrong and try to fix it. For now, I've got a lot of work to do.
-
inquisitor
-
- Posts: 5
- Joined: Thu Jan 22, 2015 12:41 am
by inquisitor » Sun Feb 01, 2015 9:07 pm
The mingw makefile I used didn't seem to produce a usable file. Functions like creating a new Newton world were missing. Don't know why.
I've refactored my computer to accomodate VisualStudio and that works perfectly.
I have a lot of work to do. I won't have time to look at cmake, sorry. Maybe later when I've got some work out of the way.
Thanks for the help. I appreciate it very much.
-
inquisitor
-
- Posts: 5
- Joined: Thu Jan 22, 2015 12:41 am
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 0 guests