cc1plus out of menory error when compiling pcl for RasPI3

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

cc1plus out of menory error when compiling pcl for RasPI3

Mr.Giskard
Greetings,

I am trying to compile PCL library on a RasPi3 but every time it fails at
64% when working on pcl_recognition.dir/src/cg/geometric_consistency.cpp.The
error "cc1plus: out of memory allocating 4456508 bytes after a total of
46592000 bytes" is displayed

I have checked my memory and at the point of error I still have one GB free
so I cannot understand why this is happening.

Any help would be welcome.

Regards



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Stephen McDowell
I can't say for sure, but when I've encountered out of memory errors during compilation in the past (not for PCL but other projects) it was because of a compiler bug. The code itself was valid, but the template instantiations caused memory errors (and PCL has a lot of instantiations).

If you can use a different compiler or possibly upgrade to a newer version of the same compiler you may get lucky. For example the compiler bug may have already been found and fixed in a newer version.

On Sat, Mar 24, 2018, 11:35 AM Mr.Giskard <[hidden email]> wrote:
Greetings,

I am trying to compile PCL library on a RasPi3 but every time it fails at
64% when working on pcl_recognition.dir/src/cg/geometric_consistency.cpp.The
error "cc1plus: out of memory allocating 4456508 bytes after a total of
46592000 bytes" is displayed

I have checked my memory and at the point of error I still have one GB free
so I cannot understand why this is happening.

Any help would be welcome.

Regards



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Mr.Giskard
Hi,

Thanks for the feedback

Thing is I have compiled several libraries from source using this compiler (gcc) such as opencv and I had not encountered any such problems. Wouldn't these problems have appeared then as well?

On 24 Mar 2018 22:39, "Stephen McDowell" <[hidden email]> wrote:
I can't say for sure, but when I've encountered out of memory errors during compilation in the past (not for PCL but other projects) it was because of a compiler bug. The code itself was valid, but the template instantiations caused memory errors (and PCL has a lot of instantiations).

If you can use a different compiler or possibly upgrade to a newer version of the same compiler you may get lucky. For example the compiler bug may have already been found and fixed in a newer version.

On Sat, Mar 24, 2018, 11:35 AM Mr.Giskard <[hidden email]> wrote:
Greetings,

I am trying to compile PCL library on a RasPi3 but every time it fails at
64% when working on pcl_recognition.dir/src/cg/geometric_consistency.cpp.The
error "cc1plus: out of memory allocating 4456508 bytes after a total of
46592000 bytes" is displayed

I have checked my memory and at the point of error I still have one GB free
so I cannot understand why this is happening.

Any help would be welcome.

Regards



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Mr.Giskard
Following up on that, I have checked and I appear to have the newest version
of the compiler on the RasPi.



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Stephen McDowell
In reply to this post by Mr.Giskard
Not necessarily (unfortunately)! I don't remember what I was compiling, but it was using GCC 5.3 which I had also used to compile opencv and many others. I can't find the original bug but the report basically talked about this stack overflow happening in the compiler after getting too many template instantiations deep. 

I got off easy, when I discovered this was a compiler specific bug I decided to upgrade to Fedora 25 since cuda 9 had finally been released. This gave me GCC 6.4 and the problem magically went away.

But I don't think that really helps you because you're targeting an embedded system and ideally you use the default system compiler :/

You may be able to home in on the actual bug by littering the affected files with #warning pragmas to see how far it actually gets before the error.  This may help us determine whether it actually is a compiler bug, or if there is something in PCL that can change to avoid the conditions that lead to the bug?

On Sat, Mar 24, 2018, 1:52 PM The Passenger <[hidden email]> wrote:
Hi,

Thanks for the feedback

Thing is I have compiled several libraries from source using this compiler (gcc) such as opencv and I had not encountered any such problems. Wouldn't these problems have appeared then as well?

On 24 Mar 2018 22:39, "Stephen McDowell" <[hidden email]> wrote:
I can't say for sure, but when I've encountered out of memory errors during compilation in the past (not for PCL but other projects) it was because of a compiler bug. The code itself was valid, but the template instantiations caused memory errors (and PCL has a lot of instantiations).

If you can use a different compiler or possibly upgrade to a newer version of the same compiler you may get lucky. For example the compiler bug may have already been found and fixed in a newer version.

On Sat, Mar 24, 2018, 11:35 AM Mr.Giskard <[hidden email]> wrote:
Greetings,

I am trying to compile PCL library on a RasPi3 but every time it fails at
64% when working on pcl_recognition.dir/src/cg/geometric_consistency.cpp.The
error "cc1plus: out of memory allocating 4456508 bytes after a total of
46592000 bytes" is displayed

I have checked my memory and at the point of error I still have one GB free
so I cannot understand why this is happening.

Any help would be welcome.

Regards



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Stephen McDowell
In reply to this post by Mr.Giskard
DAMN. Ok try the #warning approach mentioned above and hopefully we can glean what's actually happening


On Sat, Mar 24, 2018, 2:02 PM Mr.Giskard <[hidden email]> wrote:
Following up on that, I have checked and I appear to have the newest version
of the compiler on the RasPi.



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Mr.Giskard
The cpp file only has a couple of lines so I guess I will have to add the pragmas to the header files?

On Sat, 24 Mar 2018 23:05 Stephen McDowell, <[hidden email]> wrote:
DAMN. Ok try the #warning approach mentioned above and hopefully we can glean what's actually happening


On Sat, Mar 24, 2018, 2:02 PM Mr.Giskard <[hidden email]> wrote:
Following up on that, I have checked and I appear to have the newest version
of the compiler on the RasPi.



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Stephen McDowell
Correct, it may get a little bloody but you’ll need to track down where exactly the memory error comes from before anything can be done about it (fix or avoid by skipping).  Assuming you are able to identify the culprit, it smells like a compiler bug to me in which case the following two things would probably be your best course of action:

1. Submit a bug report to the RasPI3 compiler team so they know what leads to this scenario, hopefully a future release will fix it.
2. Since you now know where this problem comes from, there might be a way to either patch PCL to avoid it altogether, or at the very least comment out code that causes it.  This means that the code you comment out will not be available in your installation, and selecting what is / is not OK to remove may be a very challenging process.

As a side note, I don’t know what module of PCL enables the compilation of geometric_consistency.cpp, but instead of trying to track down this bug it may be easier for you to just skip that module (if you don’t actually need it).

The only other helpful cheat besides #warning is if you need to put messages inside of a macro you cannot do #warning there, but there’s a convenient little way to get around this by using “DO_PRAGMA”:

- - - - - - - - -

#define DO_PRAGMA(p) _Pragma(#p)

template <typename T> struct SomeClass { };

#define MakeSomeClassDefs \
    DO_PRAGMA(message "Before instantiations") \
    template <> struct SomeClass< float >; \
    DO_PRAGMA(message "after float") \
    template <> struct SomeClass< double >; \
    DO_PRAGMA(message "after double") \
    template <> struct SomeClass< int >; \
    DO_PRAGMA(message "after int") \
    template <> struct SomeClass< bool >; \
    DO_PRAGMA(message "after bool")

MakeSomeClassDefs

- - - - - - - - -

gcc -c file_this_code_is_in.cpp

That’ll print all of these messages, but it will also include where the #pragma message came from which gets kind of annoying.

I hope some of this is helpful for you :S


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Mr.Giskard
In reply to this post by Mr.Giskard
The compiler appears to move through the include statements in the cpp file

It hangs after stepping into the following line in
geometric_consistency.cpp:

PCL_INSTANTIATE_PRODUCT(GeometricConsistencyGrouping,
(PCL_XYZ_POINT_TYPES)(PCL_XYZ_POINT_TYPES))



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Mr.Giskard
Given my limited experience with debugging c++ issues I believe the most efficient way forward for me is to disable the compilation of the recognition module. When I do this however the cmake command informs me that I will not be able to compile the tools module as well which is a problem for me.

The reason for compiling PCL is because I have a project that requires visualisation of PCD or other point cloud data - no other processing is required which is why I think I can get by without the recognition module. I believe I will need some of the command line tools such as pcd2png etc. Is there a way to compile these either by some manual change in the makefile or after the libraries have been compiled?

On Sun, 25 Mar 2018 00:16 Mr.Giskard, <[hidden email]> wrote:
The compiler appears to move through the include statements in the cpp file

It hangs after stepping into the following line in
geometric_consistency.cpp:

PCL_INSTANTIATE_PRODUCT(GeometricConsistencyGrouping,
(PCL_XYZ_POINT_TYPES)(PCL_XYZ_POINT_TYPES))



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: cc1plus out of menory error when compiling pcl for RasPI3

Mr.Giskard
Hello,

For anyone reading this I just wanted to say that the workaround was to
remove the recognition module from the PCL Cmakelists file and also remove
the relevant module references from the Tools module Cmakelists file. PCL
was compiled successfully (other than a couple of warnings during the
tools/octree viewer executable compilation) thus allowing me to use the
visualisation executables that I required.

If anyone has any updates on the problem I've encountered with regards to
the cause of it please share as I will still keep an eye on the post

Thanks



--
Sent from: http://www.pcl-users.org/
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users