ON_COMPILER_GNU support for OpenNURBs?


Hi, all:

Is there any support for ON_COMPILER_GNU under Linux ?

I see from opennurbs_defines.h, there is ONLY support for ON_COMPILER_MSC and ON_COMPILER_CLANG ?

#if defined(ON_COMPILER_MSC)
/* compiling OpenNurbs as a Windows DLL - export classes, functions, templates, and globals */
#define ON_CLASS __declspec(dllexport)
#define ON_DECL __declspec(dllexport)
#define ON_EXTERN_DECL __declspec(dllexport)

#elif defined(ON_COMPILER_CLANG)
/* compiling opennurbs as an Apple shared library */
#define ON_CLASS attribute ((visibility (“default”)))
#define ON_DECL attribute ((visibility (“default”)))
#define ON_EXTERN_DECL attribute ((visibility (“default”)))

#error fill in your compiler dynamic linking decorations


(jesterKing) #2

If you are looking to compile on Linux you may want to check this branch used for the rhino3dm modules:



I checked this branch out this morning. It definitely appears like it’s working better, but it still gives the following error:

In file included from opennurbs.h:52:0,
from opennurbs_3dm_attributes.cpp:17:
opennurbs_lock.h:118:44: error: use of deleted function ‘std::atomic::atomic(const std::atomic&)’
std::atomic m_lock_value = ON_Lock::UnlockedValue;
In file included from opennurbs_system.h:594:0,
from opennurbs.h:29,
from opennurbs_3dm_attributes.cpp:17:
/usr/include/c++/5/atomic:612:7: note: declared here
atomic(const atomic&) = delete;
/usr/include/c++/5/atomic:616:17: note: after user-defined conversion: constexpr std::atomic::atomic(std::atomic::__integral_type)
constexpr atomic(__integral_type __i) noexcept : __base_type(__i) { }

(jesterKing) #4

This compiles fine with GNU 7.3.0 (tested on my Linux Mint 18.3).

Could you tell more about your dev environment? GCC version, OS version…


I’m still on gcc 5.2.1 (Ubuntu), let me try updating a bit and see if it helps matters.

(jesterKing) #6

If updating to later GCC doesn’t work you could try modifying the source

```std::atomic m_lock_value = ON_Lock::UnlockedValue;``

should then become

std::atomic m_lock_value { ON_Lock::UnlockedValue };

And similarly for cases where the same error message happens. Let me know how that works.


Hmmm, yes. Updated to Ubuntu 18.04 and GCC 7.3.0, still get the same error. Guess I’ll try changing the code as you suggest next…


Latest issue:

opennurbs_statics.cpp:424:21: error: uninitialized const ‘ONX_ModelTest::Unset’ [-fpermissive]
const ONX_ModelTest ONX_ModelTest::Unset ON_CLANG_CONSTRUCTOR_BUG_INIT(ONX_ModelTest);
In file included from opennurbs.h:164:0,
from opennurbs_statics.cpp:1:
opennurbs_extensions.h:1631:16: note: ‘const class ONX_ModelTest’ has no user-provided default constructor
class ON_CLASS ONX_ModelTest
opennurbs_extensions.h:1634:3: note: constructor is not user-provided because it is explicitly defaulted in the class body
ONX_ModelTest() = default;
opennurbs_extensions.h:2037:43: note: and the implicitly-defined constructor does not initialize ‘unsigned int ONX_ModelTest::m_model_3dm_file_version [3]’
unsigned int m_model_3dm_file_version[3];


Now trying


(edited to add) That worked, now the only issue seems to be missing uuid_generate, and that one I’ve solved before, even if I don’t quite remember how.