Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building error with catin build #16

Open
vschorp opened this issue Mar 21, 2019 · 9 comments
Open

Building error with catin build #16

vschorp opened this issue Mar 21, 2019 · 9 comments

Comments

@vschorp
Copy link

vschorp commented Mar 21, 2019

Hi There,

When trying to build the package I get the following error:

Errors << lidar_align:make /home/vinz/catkin_ws/logs/lidar_align/build.make.001.log In file included from /usr/include/flann/util/serialization.h:9:0, from /usr/include/flann/util/matrix.h:35, from /usr/include/flann/flann.hpp:41, from /usr/include/pcl-1.8/pcl/kdtree/flann.h:50, from /usr/include/pcl-1.8/pcl/kdtree/kdtree_flann.h:45, from /home/vinz/catkin_ws/src/lidar_align/include/lidar_align/sensors.h:8, from /home/vinz/catkin_ws/src/lidar_align/include/lidar_align/loader.h:7, from /home/vinz/catkin_ws/src/lidar_align/src/loader.cpp:5: /usr/include/flann/ext/lz4.h:196:57: error: conflicting declaration ‘typedef struct LZ4_stream_t LZ4_stream_t’ typedef struct { long long table[LZ4_STREAMSIZE_U64]; } LZ4_stream_t; ^~~~~~~~~~~~ In file included from /opt/ros/melodic/include/roslz4/lz4s.h:38:0, from /opt/ros/melodic/include/rosbag/stream.h:46, from /opt/ros/melodic/include/rosbag/chunked_file.h:46, from /opt/ros/melodic/include/rosbag/bag.h:41, from /home/vinz/catkin_ws/src/lidar_align/src/loader.cpp:2: /usr/include/lz4.h:196:57: note: previous declaration as ‘typedef struct LZ4_stream_t LZ4_stream_t’ typedef struct { long long table[LZ4_STREAMSIZE_U64]; } LZ4_stream_t; ^~~~~~~~~~~~ In file included from /usr/include/flann/util/serialization.h:9:0, from /usr/include/flann/util/matrix.h:35, from /usr/include/flann/flann.hpp:41, from /usr/include/pcl-1.8/pcl/kdtree/flann.h:50, from /usr/include/pcl-1.8/pcl/kdtree/kdtree_flann.h:45, from /home/vinz/catkin_ws/src/lidar_align/include/lidar_align/sensors.h:8, from /home/vinz/catkin_ws/src/lidar_align/include/lidar_align/loader.h:7, from /home/vinz/catkin_ws/src/lidar_align/src/loader.cpp:5: /usr/include/flann/ext/lz4.h:249:72: error: conflicting declaration ‘typedef struct LZ4_streamDecode_t LZ4_streamDecode_t’ typedef struct { unsigned long long table[LZ4_STREAMDECODESIZE_U64]; } LZ4_streamDecode_t; ^~~~~~~~~~~~~~~~~~ In file included from /opt/ros/melodic/include/roslz4/lz4s.h:38:0, from /opt/ros/melodic/include/rosbag/stream.h:46, from /opt/ros/melodic/include/rosbag/chunked_file.h:46, from /opt/ros/melodic/include/rosbag/bag.h:41, from /home/vinz/catkin_ws/src/lidar_align/src/loader.cpp:2: /usr/include/lz4.h:249:72: note: previous declaration as ‘typedef struct LZ4_streamDecode_t LZ4_streamDecode_t’ typedef struct { unsigned long long table[LZ4_STREAMDECODESIZE_U64]; } LZ4_streamDecode_t; ^~~~~~~~~~~~~~~~~~ make[2]: *** [CMakeFiles/lidar_align.dir/src/loader.cpp.o] Error 1 make[1]: *** [CMakeFiles/lidar_align.dir/all] Error 2 make: *** [all] Error 2 cd /home/vinz/catkin_ws/build/lidar_align; catkin build --get-env lidar_align | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd -
Do you have any suggestions on how I could fix this?
Thanks

@vschorp
Copy link
Author

vschorp commented Mar 21, 2019

Errors << lidar_align:make /home/vinz/catkin_ws/logs/lidar_align/build.make.001.log
In file included from /usr/include/flann/util/serialization.h:9:0,
from /usr/include/flann/util/matrix.h:35,
from /usr/include/flann/flann.hpp:41,
from /usr/include/pcl-1.8/pcl/kdtree/flann.h:50,
from /usr/include/pcl-1.8/pcl/kdtree/kdtree_flann.h:45,
from /home/vinz/catkin_ws/src/lidar_align/include/lidar_align/sensors.h:8,
from /home/vinz/catkin_ws/src/lidar_align/include/lidar_align/loader.h:7,
from /home/vinz/catkin_ws/src/lidar_align/src/loader.cpp:5:
/usr/include/flann/ext/lz4.h:196:57: error: conflicting declaration ‘typedef struct LZ4_stream_t LZ4_stream_t’
typedef struct { long long table[LZ4_STREAMSIZE_U64]; } LZ4_stream_t;
^~~~~~~~~~~~
In file included from /opt/ros/melodic/include/roslz4/lz4s.h:38:0,
from /opt/ros/melodic/include/rosbag/stream.h:46,
from /opt/ros/melodic/include/rosbag/chunked_file.h:46,
from /opt/ros/melodic/include/rosbag/bag.h:41,
from /home/vinz/catkin_ws/src/lidar_align/src/loader.cpp:2:
/usr/include/lz4.h:196:57: note: previous declaration as ‘typedef struct LZ4_stream_t LZ4_stream_t’
typedef struct { long long table[LZ4_STREAMSIZE_U64]; } LZ4_stream_t;
^~~~~~~~~~~~
In file included from /usr/include/flann/util/serialization.h:9:0,
from /usr/include/flann/util/matrix.h:35,
from /usr/include/flann/flann.hpp:41,
from /usr/include/pcl-1.8/pcl/kdtree/flann.h:50,
from /usr/include/pcl-1.8/pcl/kdtree/kdtree_flann.h:45,
from /home/vinz/catkin_ws/src/lidar_align/include/lidar_align/sensors.h:8,
from /home/vinz/catkin_ws/src/lidar_align/include/lidar_align/loader.h:7,
from /home/vinz/catkin_ws/src/lidar_align/src/loader.cpp:5:
/usr/include/flann/ext/lz4.h:249:72: error: conflicting declaration ‘typedef struct LZ4_streamDecode_t LZ4_streamDecode_t’
typedef struct { unsigned long long table[LZ4_STREAMDECODESIZE_U64]; } LZ4_streamDecode_t;
^~~~~~~~~~~~~~~~~~
In file included from /opt/ros/melodic/include/roslz4/lz4s.h:38:0,
from /opt/ros/melodic/include/rosbag/stream.h:46,
from /opt/ros/melodic/include/rosbag/chunked_file.h:46,
from /opt/ros/melodic/include/rosbag/bag.h:41,
from /home/vinz/catkin_ws/src/lidar_align/src/loader.cpp:2:
/usr/include/lz4.h:249:72: note: previous declaration as ‘typedef struct LZ4_streamDecode_t LZ4_streamDecode_t’
typedef struct { unsigned long long table[LZ4_STREAMDECODESIZE_U64]; } LZ4_streamDecode_t;
^~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/lidar_align.dir/src/loader.cpp.o] Error 1
make[1]: *** [CMakeFiles/lidar_align.dir/all] Error 2
make: *** [all] Error 2
cd /home/vinz/catkin_ws/build/lidar_align; catkin build --get-env lidar_align | catkin env -si /usr/bin/make --jobserver-fds=6,7 -j; cd -

@ZacharyTaylor
Copy link
Contributor

Sorry for late reply. I have hit this issue before and honestly don't really have a good fix.

The problem is that when you install ros you get two separate and incompatible versions of LZ4. One is used by ros for serialization and the other by the flann kdtree in pcl. It seems only some combinations of OS, workspace and ros versions have this issue. I remember when I hit it on one computer I just went in and hack fixed the flann version by commenting out the functions, though this isn't really a suggested solution.

@n-patiphon
Copy link

@ZacharyTaylor Hi, I'm having the same problem here. You mentioned you hack fixed it. Could you please share how you did it?

@KevinLADLee
Copy link

System: Ubuntu 18.04
ROS: melodic
Reason: /usr/include/lz4.h conflict with /usr/include/flann/ext/lz4.h

I thing this will be fixed in next release version of system or ROS.
But you could try these commands to fix this problem.

sudo mv /usr/include/flann/ext/lz4.h /usr/include/flann/ext/lz4.h.bak
sudo mv /usr/include/flann/ext/lz4hc.h /usr/include/flann/ext/lz4.h.bak

sudo ln -s /usr/include/lz4.h /usr/include/flann/ext/lz4.h
sudo ln -s /usr/include/lz4hc.h /usr/include/flann/ext/lz4hc.h

@Eeppii
Copy link

Eeppii commented Jun 25, 2019

a temporary fix that worked for us:
In /usr/include/flann/util/serialization.h at the top change the corresponding lines to:

#include "lz4.h"
#include "lz4hc.h"

@n-patiphon
Copy link

Thank you very much. Got it working!

@gnykumar
Copy link

System: Ubuntu 18.04
ROS: melodic
Reason: /usr/include/lz4.h conflict with /usr/include/flann/ext/lz4.h

I thing this will be fixed in next release version of system or ROS.
But you could try these commands to fix this problem.

sudo mv /usr/include/flann/ext/lz4.h /usr/include/flann/ext/lz4.h.bak
sudo mv /usr/include/flann/ext/lz4hc.h /usr/include/flann/ext/lz4.hc.bak  (correction at .h to .hc)

sudo ln -s /usr/include/lz4.h /usr/include/flann/ext/lz4.h
sudo ln -s /usr/include/lz4hc.h /usr/include/flann/ext/lz4hc.h

and

#16 (comment)

also does works.

thanks to @KevinLADLee @Eeppii

@mcamurri
Copy link

In case you need a solution that does not require modification of system wide files is the following:

#define LZ4_stream_t LZ4_stream_t_deprecated
#define LZ4_resetStream LZ4_resetStream_deprecated
#define LZ4_createStream LZ4_createStream_deprecated
#define LZ4_freeStream LZ4_freeStream_deprecated
#define LZ4_loadDict LZ4_loadDict_deprecated
#define LZ4_compress_fast_continue LZ4_compress_fast_continue_deprecated
#define LZ4_saveDict LZ4_saveDict_deprecated
#define LZ4_streamDecode_t LZ4_streamDecode_t_deprecated
#define LZ4_compress_continue LZ4_compress_continue_deprecated
#define LZ4_compress_limitedOutput_continue LZ4_compress_limitedOutput_continue_deprecated
#define LZ4_createStreamDecode LZ4_createStreamDecode_deprecated
#define LZ4_freeStreamDecode LZ4_freeStreamDecode_deprecated
#define LZ4_setStreamDecode LZ4_setStreamDecode_deprecated
#define LZ4_decompress_safe_continue LZ4_decompress_safe_continue_deprecated
#define LZ4_decompress_fast_continue LZ4_decompress_fast_continue_deprecated
#include <rosbag/bag.h>
#undef LZ4_stream_t
#undef LZ4_resetStream
#undef LZ4_createStream
#undef LZ4_freeStream
#undef LZ4_loadDict
#undef LZ4_compress_fast_continue
#undef LZ4_saveDict
#undef LZ4_streamDecode_t
#undef LZ4_compress_continue
#undef LZ4_compress_limitedOutput_continue
#undef LZ4_createStreamDecode
#undef LZ4_freeStreamDecode
#undef LZ4_setStreamDecode
#undef LZ4_decompress_safe_continue
#undef LZ4_decompress_fast_continue

I know it's ugly, but modifying system wide files is not ideal sometimes.

@WorkManSupor
Copy link

I also see this error, when build my project. completed it as @ KevinLADLee commented on Jun 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants