PCRE2Project / pcre2

PCRE2 development is now based here.
Other
922 stars 194 forks source link

PCRE2 doesn't build when acquired through conan #296

Closed luthor112 closed 1 year ago

luthor112 commented 1 year ago

When trying to install pcre2/10.42 using conan v1.5x, using --build missing, build fails with the same error on both Windows and Linux:

<...>\src\src\pcre2grep.c(99,10): fatal  error C1083: Cannot open include file: 'bzlib.h': No such file or directory
<...>/src/src/pcre2grep.c:99:10: fatal error: bzlib.h: No such file or directory
   99 | #include <bzlib.h>
      |          ^~~~~~~~~
compilation terminated.

This happens even if bzip2 is explicitly included in the conanfile.

luthor112 commented 1 year ago

When trying on Linux only, after installing libbz2-dev, the header file is found, but now a linking error comes up:

/usr/bin/ld: CMakeFiles/pcre2grep.dir/src/pcre2grep.c.o: in function `pcre2grep':
pcre2grep.c:(.text+0x2a1a): undefined reference to `BZ2_bzread'
/usr/bin/ld: pcre2grep.c:(.text+0x363b): undefined reference to `BZ2_bzread'
/usr/bin/ld: pcre2grep.c:(.text+0x3fe0): undefined reference to `BZ2_bzread'
/usr/bin/ld: CMakeFiles/pcre2grep.dir/src/pcre2grep.c.o: in function `grep_or_recurse.part.0.isra.0':
pcre2grep.c:(.text+0x4892): undefined reference to `BZ2_bzopen'
/usr/bin/ld: pcre2grep.c:(.text+0x4922): undefined reference to `BZ2_bzclose'
/usr/bin/ld: pcre2grep.c:(.text+0x4a87): undefined reference to `BZ2_bzerror'
/usr/bin/ld: pcre2grep.c:(.text+0x4b69): undefined reference to `BZ2_bzclose'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/pcre2grep.dir/build.make:106: pcre2grep] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:104: CMakeFiles/pcre2grep.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2

Even if this worked, it would be a Linux-only solution.

luthor112 commented 1 year ago

For anyone who finds this, the solution has been found!

You have to delete bzip2 from your Conan cache (the data directory) to force Conan to redownload a newer version, and that fixes it.

With this, I'll close this Issue.