Patches for Opennurbs 6 under gcc-5.2 in linux

linux

(Elisa Friebel) #1

Hey,
I recently downloaded opennurbs_6.1.18014.22401 and patched it to work under linux to work with gcc-5.2. I thought you may be interested in my changes.

  • in ON_ObjectArray& ON_ObjectArray::operator=( ON_ObjectArray&& src ) [opennurbs_array_defs.h:968]:
    attributes of the base class (m_a, m_count, …) cannot be referred directly, use e.g. this->m_a, this->m_count etc.
  • in opennurbs_defines.cpp:506 fcloseall() works
  • in a bunch of cases gcc can be handled as clang, see [1] at the bottom
  • the clang behaviour for initialisation of const members is the same in gcc, see comment in opennurbs_system_compiler.h:~278. So, ON_CLANG_CONSTRUCTOR_BUG needs to be also defined in the ON_COMPILER_GNU case
  • since their is no RUNTIME_LINUX macro, I used the hotfix RUNTIME_ANDROID which works fine for me
  • there is a name collision in the class ON_Locale between the enum WindowsLCID and the function ON__UINT32 WindowsLCID() [both in opennurbs_locale.h]. For gcc-5.2 the compiler throws an error, although newer gcc versions compile it just fine. Nevertheless I would suggest to rename the function
  • opennurbs_subd_heap.cpp:663 raises an error, which clang does not notice (cp. https://stackoverflow.com/questions/46815821/assigned-nullptr-to-bool-type-which-compiler-is-correct), but it suffices to change the line to: return ON_SUBD_RETURN_ERROR(false);
    This is also consistent to the coding style in other functions returning a bool (e.g. ON_SubDHeap::GrowVertexEdgeArray)
  • as in the clang case the uuid library should be included in opennurbs_system.h:~506
  • as a consequence in the makefile the uuid library needs be linked
  • opennurbs_unicode_cpsb.cpp/.o are missing in the makefile

And in my case ON_SIZEOF_WCHAR_T could not be figured out automatically, so I ended up defining it manually for my case. The ON_NEED_UTF*_WCHAR_T_TYPEDEF did not work in my case, since wchar_t is already defined …

Hope, this is helpful,
Elisa

[1] replace #if/#elif defined(ON_COMPILER_CLANG) with …(defined(ON_COMPILER_CLANG) || defined(ON_COMPILER_GNU)) at
opennurbs_file_utilities.cpp in line 2627 and 2667
opennurbs_locale.cpp in lines 1304, 1323, 1348, 1385, 1402, 1427 and 1582
opennurbs_string_format.cpp in lines 555, 606, 700, 809 and 870
opennurbs_string_scan.cpp in lines 88, 151, 400 and 642
opennurbs_uuid.cpp in line 226


(jesterKing) #2

If possible you should create a personal fork of the opennurbs on github, create a branch and commit your changes in that. Then create a pull request to the original repository.

See also Hacktoberfest: Contribute to open source projects! by @fraguada

Also last night I happened to be adding some Linux support too. See

for some further inspiration. Note that I worked with Clang on Linux Mint to do so.

Anyway great to see some effort here!


(Elisa Friebel) #3

Thank you,
now also in my case ON_SIZEOF_WCHAR_T is chosen correctly.

I forked the git and commit the additional changes for gcc.
And I hope for a nice hacktoberfest :wink:


(Luis Fraguada) #4

I see your PR: https://github.com/mcneel/opennurbs/pull/1 I’ve added @dalelear as reviewer.
Thanks!