[1.10.11] RTSS Fails to Compile Due to OGRE_NEW Definition Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
gmm
Gnoblar
Posts: 3
Joined: Wed Apr 11, 2018 8:39 pm

[1.10.11] RTSS Fails to Compile Due to OGRE_NEW Definition

Post by gmm »

Hi all,

I’ve been trying to build Ogre statically with a memory tracker and can’t seem to get the RTShaderSystem component to compile successfully without changing the OGRE_NEW macro.

The error occurs on lines 172 and 183 within the OgreShaderSubRenderState source file.

Error given:

Code: Select all

'operator new': none of the 4 overloads could convert all the argument types
The OGRE_NEW macro is being defined on line 420 within the OgreMemoryAllocatorConfig header file.

Which is activated due to the conditional located on line 368 within that same header.

It looks like the OGRE_NEW macro is only present to provide file and other location information for debugging allocations. In fact, within the 1.10.11 documentation for the OgreMemoryAllocatorConfig header file it explicitly states that the OGRE_NEW macro can be substituted for the regular new operator at the cost of losing this debugging information. I redefined the OGRE_NEW macro with the regular new operator and the RTSS compiled successfully, but I’d sooner leave that capability in place if there is a way to circumnavigate replacing OGRE_NEW with 'new'.
The documentation details for OGRE_NEW can be viewed here.

This passage in particular:
OGRE_NEW - use to allocate an object which have custom new/delete operators to handle custom allocations, usually this means it's derived from Ogre::AllocatedObject. Free the memory using OGRE_DELETE. You can in fact use the regular new/delete for these classes but you won't get any line number debugging if you do. The memory category is automatically derived for these classes; for all other allocations you have to specify it.

Lastly, is this a bug? I can’t see how any of my build settings could have caused this error from occurring outside of my decision to build with the options that made the conditional in the OgreMemoryAllocatorConfig header file on line 368 resolve to true. The OgreShaderSubRenderState source file is the only place this error occurs at when I leave the OGRE_NEW macro untouched. My only guess is that the SubRenderStateAccessor class can't find the correct overload for OGRE_NEW because it doesn't inherit from the AllocatedObject class which is where the OGRE_NEW overload is defined.

My OgreBuildSettings header is provided below.

Thanks.

- George

paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: [1.10.11] RTSS Fails to Compile Due to OGRE_NEW Definition

Post by paroj »

this is likely a bug, however the memory tracker is deprecated, so this will not be fixed. The preferable alternative is the AddressSanitizer.
gmm
Gnoblar
Posts: 3
Joined: Wed Apr 11, 2018 8:39 pm

Re: [1.10.11] RTSS Fails to Compile Due to OGRE_NEW Definition

Post by gmm »

Thanks for the quick reply.

Would it be best to mark the memory tracker option as deprecated within the CMake configuration files? If the memory tracker option was labeled as deprecated I wouldn't have even bothered trying to build with that option enabled.

This is also the first I've heard that the LLVM/GCC address sanitizer is preferred.

After reading your reply, I searched through the following sources trying to find information regarding the deprecation of the memory tracker feature, but could not find anything:
  • The 1.10.11 Documentation
  • The 1.10 Notes on GitHub
  • The Ogre Wiki
  • The Build Instructions on GitHub
  • The CMake Configuration files
  • The Source Files
Where should I have been looking for this information?
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: [1.10.11] RTSS Fails to Compile Due to OGRE_NEW Definition

Post by paroj »

it should have been in the CMake feature summary (what you see after configure). However it is indeed missing. I guess you are the first one to enable the memory tracker with 1.10
gmm
Gnoblar
Posts: 3
Joined: Wed Apr 11, 2018 8:39 pm

Re: [1.10.11] RTSS Fails to Compile Due to OGRE_NEW Definition

Post by gmm »

Are there any other build options that are missing the "[DEPRECATED]" description in the feature summary? (I feel the need to ask this because I'd really hate to bother you with another thread like this one.)

Would adding [DEPRECATED] to said options make a suitable pull request?
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: [1.10.11] RTSS Fails to Compile Due to OGRE_NEW Definition

Post by paroj »

yes and yes. However I already added the missing deprecated flags. See here:
https://github.com/OGRECave/ogre/blob/s ... #L211-L216
Post Reply