A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by JernejL » Tue May 12, 2020 9:02 am
It might be that mint has a older version of cmake, but that is strange since it is also debian based, unless they do not share common repository sources?
I will try to build newton into a self-contained .so, it seems a bit weird that this is even an issue.
./libnewton.so: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by libdgPhysics.so)
./libnewton.so: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by libdgCore.so)
To solve Glibc incompatibilities i think linux build would need to be linked via -Wl,-Bstatic -libc -Wl,-Bdynamic -
This might work in cmake:
if (NEWTON_STATIC_RUNTIME_LIBRARIES STREQUAL "ON")
# link statically - no libstdc dll dependancies
add_compile_options(-static)
set(NEWTON_GENERATE_DLL "ON" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static" )
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static" )
endif ()
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Corpsman » Tue May 12, 2020 9:14 am
Sorry i do not understand what you expect me todo.
as you can see below i am running cmake 3.5.1
corpsman@corpsman ~ $ cmake --version
cmake version 3.5.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).
-
Corpsman
-
- Posts: 38
- Joined: Mon May 01, 2006 11:42 am
-
by JernejL » Tue May 12, 2020 1:49 pm
I will try to work on this tomorrow and get a new cmake script to try and compile a self-containing .so
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Corpsman » Tue May 12, 2020 2:47 pm
Thank you very much, i appreciate your work.
-
Corpsman
-
- Posts: 38
- Joined: Mon May 01, 2006 11:42 am
-
by JernejL » Fri May 15, 2020 4:37 am
I haven't had much more luck but i managed to link the 3 .so into one libnewton, but it seems like no matter what i do, i cannot make a unified .so that would contain all of libc staticly linked, which means it would have to be compiled in target platform - this could be a issue for distributing newton with a linux game as each linux can have their own libc version and all.
I wonder if libc is even needed in newton at all?
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Corpsman » Sun May 17, 2020 12:11 pm
Well ich you manage to fix the cmake skript i will be happy to compile and test it.
As first step it would be ok if it only works on my plattform

-
Corpsman
-
- Posts: 38
- Joined: Mon May 01, 2006 11:42 am
-
by JernejL » Mon Jun 08, 2020 1:31 am
Actually i might be able to do more in the future, i got a "green light" to build another PC at home which i will use to set up a few more virtual machines as the current home server is the living room TV pc and is unsuitable for this. Then we can pick a few linux releases and i can finally automate compilation.
BTW, for static linking on linux, we could maybe make use of musl:
https://www.musl-libc.org/ - but Julio would need to look into that, if it's suitable for newton.
Or the "glibc-static" idea here:
https://www.systutorials.com/how-to-sta ... -with-gcc/ - this apparently works on red hat linux and it's forks, i could install a vps with centos and try that..
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Corpsman » Mon Jun 08, 2020 1:20 pm
i vote for Linux Mint Mate as testsystem

.
-
Corpsman
-
- Posts: 38
- Joined: Mon May 01, 2006 11:42 am
-
by JernejL » Tue Jun 30, 2020 3:31 am
This is the best i can go with static compiling a linux newton build, what remains are following dependencies that cannot be staticly linked because they are thread api, libmath, string and file:
- Code: Select all
Array
(
[linux-vdso.so.1] => Array
(
[file] => linux-vdso.so.1
)
[libstdc++.so.6] => Array
(
[file] => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
[functions] => Array
(
[] =>
[_ZNSt18condition_variable10notify_oneEv] => _ZNSt18condition_variable10notify_oneEv
[_ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE] => _ZNSt18condition_variable4waitERSt11unique_lockISt5mutexE
[_ZNSt18condition_variableC1Ev] => _ZNSt18condition_variableC1Ev
[_ZNSt18condition_variableD1Ev] => _ZNSt18condition_variableD1Ev
[_ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE] => _ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE
[_ZNSt6thread4joinEv] => _ZNSt6thread4joinEv
[_ZNSt6thread6_StateD2Ev] => _ZNSt6thread6_StateD2Ev
[_ZSt20__throw_system_errori] => _ZSt20__throw_system_errori
[_ZSt9terminatev] => _ZSt9terminatev
[_ZTINSt6thread6_StateE] => _ZTINSt6thread6_StateE
[_ZTVN10__cxxabiv117__class_type_infoE] => _ZTVN10__cxxabiv117__class_type_infoE
[_ZTVN10__cxxabiv120__si_class_type_infoE] => _ZTVN10__cxxabiv120__si_class_type_infoE
[_ZTVN10__cxxabiv121__vmi_class_type_infoE] => _ZTVN10__cxxabiv121__vmi_class_type_infoE
[_ZdaPv] => _ZdaPv
[_ZdlPv] => _ZdlPv
[_Znam] => _Znam
[_Znwm] => _Znwm
[__cxa_guard_abort] => __cxa_guard_abort
[__cxa_guard_acquire] => __cxa_guard_acquire
[__cxa_guard_release] => __cxa_guard_release
[__cxa_pure_virtual] => __cxa_pure_virtual
[__cxa_throw_bad_array_new_length] => __cxa_throw_bad_array_new_length
[__gxx_personality_v0] => __gxx_personality_v0
)
)
[libm.so.6] => Array
(
[file] => /lib/x86_64-linux-gnu/libm.so.6
[functions] => Array
(
[] =>
[acosf] => acosf
[asin] => asin
[asinf] => asinf
[atan2] => atan2
[atan2f] => atan2f
[cos] => cos
[cosf] => cosf
[fabs] => fabs
[floor] => floor
[frexp] => frexp
[ldexp] => ldexp
[powf] => powf
[sin] => sin
[sincosf] => sincosf
[sinf] => sinf
[sqrt] => sqrt
[sqrtf] => sqrtf
)
)
[libgcc_s.so.1] => Array
(
[file] => /lib/x86_64-linux-gnu/libgcc_s.so.1
[functions] => Array
(
[] =>
[_Unwind_Resume] => _Unwind_Resume
)
)
[libc.so.6] => Array
(
[file] => /lib/x86_64-linux-gnu/libc.so.6
[functions] => Array
(
[__cxa_atexit] => __cxa_atexit
[__cxa_finalize] => __cxa_finalize
[__fprintf_chk] => __fprintf_chk
[] =>
[__memcpy_chk] => __memcpy_chk
[__memset_chk] => __memset_chk
[__sprintf_chk] => __sprintf_chk
[clock_gettime] => clock_gettime
[closedir] => closedir
[fclose] => fclose
[feof] => feof
[fgets] => fgets
[fopen] => fopen
[fread] => fread
[free] => free
[frexp] => frexp
[fscanf] => fscanf
[fwrite] => fwrite
[ldexp] => ldexp
[malloc] => malloc
[memcmp] => memcmp
[memcpy] => memcpy
[memset] => memset
[opendir] => opendir
[pthread_mutex_lock] => pthread_mutex_lock
[pthread_mutex_unlock] => pthread_mutex_unlock
[readdir] => readdir
[sched_yield] => sched_yield
[strcasecmp] => strcasecmp
[strcmp] => strcmp
[strlen] => strlen
[strncpy] => strncpy
[strrchr] => strrchr
[strtod] => strtod
[strtol] => strtol
)
)
[/lib64/ld-linux-x86-64.so.2] => Array
(
[file] => /lib64/ld-linux-x86-64.so.2
[functions] => Array
(
[free] => free
[malloc] => malloc
)
)
)
The problem is depending on linux platform you use, it might link to DIFFERENT libstdc versions and / or .so file names, this means i will probably need to compile different newton on each platform - so, i will now try linux mint and see how to compile it there.
Worst case scenario, i will try to provide perhaps 2-3 different libnewton.so files, each for one of major platforms (debian, redhat/centos, mint)
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Corpsman » Tue Jun 30, 2020 12:28 pm
Thank you for all your work.
If you finished the todo for Linux Mint i would love to test it for you.
-
Corpsman
-
- Posts: 38
- Joined: Mon May 01, 2006 11:42 am
-
by JernejL » Thu Jul 02, 2020 1:36 am
Ok, i'll report when it's ready / working.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by JernejL » Fri Jul 03, 2020 3:46 am
Corpsman: i got linux mint installed, mounted file system from my other debian machine and compiled it, then calculated diff of imports - the binary is pretty close, just 1 difference in how fscanf is linked.
The debian ubuntu server .so works in mint - LDD outputs no complaint:
linux-vdso.so.1 (0x00007ffe19fb0000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc853117000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc852fc8000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc852fad000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc852dbb000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc853696000)
Please test libnewton.so here:
https://github.com/JernejL/NewtonBinari ... er/Linux64 - see if it works in your project.
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by JernejL » Tue Jul 07, 2020 12:31 pm
New automatic builds are availible:
https://github.com/JernejL/NewtonBinaries Now got single / double builds (x86_64).
I also added arm 32 & ARM 64 bit - for raspberry pi, should work on android too (in theory)
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by Julio Jerez » Tue Jul 07, 2020 12:57 pm
Wow, you God that going?
This is very good.
-
Julio Jerez
- Moderator

-
- Posts: 12452
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by JernejL » Wed Jul 08, 2020 2:41 am
Yeah, i've set up all the scripts on my always-on pc in some virtual machines, and succeeded with automating this, so i got builds for:
Linux64 (single / double)
LinuxArm32 (single / double)
LinuxArm64 (single / double)
Win32 (single / double, + pdb + .lib + debug)
Win64 (single / double, + pdb + .lib + debug)
I will need to commit my changes to cmake files again - i can have that ready by next week (just need to sort out some things to do with NEWTON_BUILD_SHARED_LIBS define and try to move my changes to another cmake to include ).
-

JernejL
-
- Posts: 1587
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 405 guests