From a823cd4e26ef36a1f17290d140908affb52defc6 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 9 Nov 2019 11:32:37 +0200 Subject: [PATCH 1/3] Compile on Rasbian (buster). * GCC 8.3.0 * armv7l * introduce ON_RUNTIME_LINUX_ARM * need to link to both uuid and atomic libraries * ON_CLANG_CONSTRUCTOR_BUG needs to be defined --- makefile | 4 +++- opennurbs_dimension.h | 6 +++--- opennurbs_lock.h | 2 +- opennurbs_system_compiler.h | 8 +++++++- opennurbs_system_runtime.h | 11 ++++++++++- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/makefile b/makefile index 3a48e468..2e560368 100644 --- a/makefile +++ b/makefile @@ -35,7 +35,7 @@ ON_GNU_WARNING_FLAGS = -Wall \ -Wno-overloaded-virtual \ -Wno-switch \ -Wno-unknown-pragmas \ - -Wno-unused-private-field +# -Wno-unused-private-field // didn't work on Rasbian with GCC 8.3.0 # -Wno-inconsistent-missing-override \ @@ -62,6 +62,8 @@ LINK = $(CCC) LINKFLAGS = # below necessary LINKFLAGS on Linux for the UUID library #LINKFLAGS = -luuid +# below necessary LINKFLAGS on Linux / Raspberry Pi 4 for UUID and atomic libraries +LINKFLAGS = -luuid -latomic ############################################################### diff --git a/opennurbs_dimension.h b/opennurbs_dimension.h index 4d71c71b..8058cbb3 100644 --- a/opennurbs_dimension.h +++ b/opennurbs_dimension.h @@ -888,9 +888,9 @@ class ON_CLASS ON_DimRadial : public ON_Dimension // | // | // + kinkpt2 -// \ -// \ kinkoffset2 -// \ +// - +// - kinkoffset2 +// - // + kinkpt1 // | // | kinkoffset1 diff --git a/opennurbs_lock.h b/opennurbs_lock.h index a428c857..a30c6469 100644 --- a/opennurbs_lock.h +++ b/opennurbs_lock.h @@ -112,7 +112,7 @@ class ON_CLASS ON_Lock // needs to have dll-interface to be used by clients of class 'ON_Lock' // m_lock_value is private and all code that manages m_lock_value is explicitly implemented in the DLL. private: -#if defined(ON_COMPILER_CLANG) +#if defined(ON_COMPILER_CLANG) || defined (ON_RUNTIME_LINUX_ARM) std::atomic m_lock_value; #else std::atomic m_lock_value = ON_Lock::UnlockedValue; diff --git a/opennurbs_system_compiler.h b/opennurbs_system_compiler.h index c03e7694..dc1d2a25 100644 --- a/opennurbs_system_compiler.h +++ b/opennurbs_system_compiler.h @@ -357,7 +357,6 @@ // ON_COMPILER_GNU // */ - #define ON_COMPILER_GNU #if !defined(_GNU_SOURCE) #define _GNU_SOURCE @@ -389,6 +388,13 @@ #endif +#if defined(__arm__) +// GCC 8.3.0 on Raspbian (Raspberry Pi 4) needs this too +#if !defined(ON_CLANG_CONSTRUCTOR_BUG) +#define ON_CLANG_CONSTRUCTOR_BUG +#endif +#endif + #elif defined(__BORLANDC__) /* diff --git a/opennurbs_system_runtime.h b/opennurbs_system_runtime.h index 83d1b87b..1a408a01 100644 --- a/opennurbs_system_runtime.h +++ b/opennurbs_system_runtime.h @@ -33,6 +33,7 @@ // At most one the ON_RUNTIME_* should be defined // // ON_RUNTIME_APPLE / ON_RUNTIME_WIN / ON_RUNTIME_ANDROID +// ON_RUNTIME_LINUX // */ #if (defined(__APPLE__) || defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR) || defined(__IOS__)) @@ -60,6 +61,7 @@ #define ON_RUNTIME_LINUX #endif + #endif /* // @@ -157,7 +159,14 @@ #elif defined(ON_RUNTIME_LINUX) -#if defined(__x86_64__) +#if defined(__arm__) +#if !defined(ON_RUNTIME_LINUX_ARM) +#define ON_RUNTIME_LINUX_ARM +#endif +// assume 64bit ARM (like Raspberry Pi 4) +#define ON_64BIT_RUNTIME +#define ON_LITTLE_ENDIAN +#elif defined(__x86_64__) #define ON_64BIT_RUNTIME #else #define ON_32BIT_RUNTIME From 1f04d7efd891cb49260878f2d725931bf3c22f84 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 9 Nov 2019 19:19:48 +0200 Subject: [PATCH 2/3] Comment out LINKFLAGS for Raspbian by default. If someone wants to build on this platform they need to uncomment the line. --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index 2e560368..e57ea1e8 100644 --- a/makefile +++ b/makefile @@ -63,7 +63,7 @@ LINKFLAGS = # below necessary LINKFLAGS on Linux for the UUID library #LINKFLAGS = -luuid # below necessary LINKFLAGS on Linux / Raspberry Pi 4 for UUID and atomic libraries -LINKFLAGS = -luuid -latomic +#LINKFLAGS = -luuid -latomic ############################################################### From 244201789ae455a6c231a49cfbba1af0d68a4044 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Sat, 9 Nov 2019 19:31:04 +0200 Subject: [PATCH 3/3] Re-enable original warning flag list. Made note that no-unused-private-field may need to be commented out on certain platforms. --- makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index e57ea1e8..50dba1fe 100644 --- a/makefile +++ b/makefile @@ -35,7 +35,9 @@ ON_GNU_WARNING_FLAGS = -Wall \ -Wno-overloaded-virtual \ -Wno-switch \ -Wno-unknown-pragmas \ -# -Wno-unused-private-field // didn't work on Rasbian with GCC 8.3.0 + -Wno-unused-private-field +# Note that -Wno-unused-private-field may throw unrecognized option +# error. This happened at least on GCC 8.3.0 in Rasbian Buster. # -Wno-inconsistent-missing-override \