[bionic] Program fails to compile when using flann and LZ4

Bug #1786543 reported by Kartik Mohta
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
flann (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

On Ubuntu 18.04, when trying to use the system version of LZ4 with flann in the same C++ code, it causes compile errors.

$ apt-cache policy libflann-dev
libflann-dev:
  Installed: 1.9.1+dfsg-2
  Candidate: 1.9.1+dfsg-2
  Version table:
 *** 1.9.1+dfsg-2 500
        500 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status

$ apt-cache policy liblz4-dev
liblz4-dev:
  Installed: 0.0~r131-2ubuntu3
  Candidate: 0.0~r131-2ubuntu3
  Version table:
 *** 0.0~r131-2ubuntu3 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

$ cat test.cpp
#include <lz4.h>
#include <flann/flann.hpp>

int main()
{
  return 0;
}

$ g++ test.cpp
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 test.cpp:2:
/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 test.cpp:1:0:
/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 test.cpp:2:
/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 test.cpp:1:0:
/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;
                                                                        ^~~~~~~~~~~~~~~~~~

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in flann (Ubuntu):
status: New → Confirmed
Revision history for this message
Andre Phu-Van Nguyen (anguyenara) wrote :

I believe this is affecting compilation of PCL's kdtree flann. So basically flann has it's own copy of lz4.h and it collides with the system package lz4.h?

What's the cleanest workaround? Namespace flann's lz4??

Revision history for this message
Jochen Sprickerhof (v-launchpad-jochen-sprickerhof-de) wrote :

I have removed the LZ4 symbols in 1.9.1+dfsg-6 (in Debian unstable). So this should be fixed in the next Ubuntu version.

Changed in flann (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.