simsong / bulk_extractor

This is the development tree. Production downloads are at:
https://github.com/simsong/bulk_extractor/releases
Other
1.04k stars 183 forks source link

Building Error - undefined reference to `pcre_*' #466

Closed D3vil0p3r closed 2 months ago

D3vil0p3r commented 2 months ago

I am building bulk_extractor in Arch Linux by the following PKGBUILD:

pkgname=bulk-extractor
pkgver=2333.6a7da28
pkgrel=1
groups=('athena' 'athena-forensic' 'athena-misc')
pkgdesc='Bulk Email and URL extraction tool.'
arch=('x86_64')
url='https://github.com/simsong/bulk_extractor'
license=('GPL')
depends=('tre' 'flex' 'java-environment' 'openssl' 'exiv2' 'afflib' 'libewf' 'libxml2' 'zlib'
         'ncurses5-compat-libs' 're2')
makedepends=('git' 'autoconf' 'automake')
source=("git+https://github.com/simsong/${pkgname//-/_}.git")
sha512sums=('SKIP')

pkgver() {
  cd "${pkgname//-/_}"

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd ${pkgname//-/_}

  git submodule update --recursive --remote

  #sed -i 's|`dirname $0`|/usr/share/bulk-extractor|' java_gui/BEViewer

  sh bootstrap.sh
}

build() {
  cd ${pkgname//-/_}

  ./configure --prefix=/usr --sysconfdir=/etc

  make

  #make -C java_gui
}

package() {
  cd ${pkgname//-/_}

  install -dm 755 "$pkgdir/usr/share/$pkgname"

  make DESTDIR="$pkgdir" install

  #install -m 644 java_gui/BEViewer.jar "$pkgdir/usr/share/$pkgname"
  #install -m 755 java_gui/BEViewer "$pkgdir/usr/bin"
}

During the building, I get the following error:

      |                                                         ^
/usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function `regex_vector::~regex_vector()':
/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:91:(.text+0x9bb): undefined reference to `pcre_free'
/usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o:/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:93:(.text+0x9d0): undefined reference to `pcre_free_study'
/usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o:/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:94:(.text+0x9da): undefined reference to `pcre_jit_stack_free'
/usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function `regex_vector::search_all(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, unsigned long*, unsigned long*) const':
/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:142:(.text+0x1924): undefined reference to `pcre_exec'
/usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function `regex_vector::push_back(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:63:(.text+0x84f6): undefined reference to `pcre_compile'
/usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:72:(.text+0x8513): undefined reference to `pcre_study'
/usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:73:(.text+0x8526): undefined reference to `pcre_jit_stack_alloc'
/usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:74:(.text+0x8537): undefined reference to `pcre_assign_jit_stack'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1367: bulk_extractor] Error 1
make[2]: Leaving directory '/tmp/makepkg/bulk-extractor/src/bulk_extractor/src'
make[1]: *** [Makefile:527: all-recursive] Error 1
make[1]: Leaving directory '/tmp/makepkg/bulk-extractor/src/bulk_extractor'
make: *** [Makefile:467: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Probably because on building flags there is not -lpcre flag. @simsong can you add it please?

simsong commented 2 months ago

Hi. Why are you bundling the git repo and not the release?

On Apr 20, 2024, at 1:57 PM, D3vil0p3r @.***> wrote:

I am building bulk_extractor in Arch Linux by the following PKGBUILD:

pkgname=bulk-extractor pkgver=2333.6a7da28 pkgrel=1 groups=('athena' 'athena-forensic' 'athena-misc') pkgdesc='Bulk Email and URL extraction tool.' arch=('x86_64') url='https://github.com/simsong/bulk_extractor' license=('GPL') depends=('tre' 'flex' 'java-environment' 'openssl' 'exiv2' 'afflib' 'libewf' 'libxml2' 'zlib' 'ncurses5-compat-libs' 're2') makedepends=('git' 'autoconf' 'automake') source=("git+https://github.com/simsong/${pkgname//-/_}.git") sha512sums=('SKIP')

pkgver() { cd "${pkgname//-/_}"

echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD) }

prepare() { cd ${pkgname//-/_}

git submodule update --recursive --remote

sed -i 's|dirname $0|/usr/share/bulk-extractor|' java_gui/BEViewer

sh bootstrap.sh }

build() { cd ${pkgname//-/_}

./configure --prefix=/usr --sysconfdir=/etc

make

make -C java_gui

}

package() { cd ${pkgname//-/_}

install -dm 755 "$pkgdir/usr/share/$pkgname"

make DESTDIR="$pkgdir" install

install -m 644 java_gui/BEViewer.jar "$pkgdir/usr/share/$pkgname"

install -m 755 java_gui/BEViewer "$pkgdir/usr/bin"

} During the building, I get the following error:

  |                                                         ^

/usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function regex_vector::~regex_vector()': /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:91:(.text+0x9bb): undefined reference topcre_free' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o:/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:93:(.text+0x9d0): undefined reference to pcre_free_study' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o:/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:94:(.text+0x9da): undefined reference topcre_jit_stack_free' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function regex_vector::search_all(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, unsigned long*, unsigned long*) const': /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:142:(.text+0x1924): undefined reference topcre_exec' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function regex_vector::push_back(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:63:(.text+0x84f6): undefined reference topcre_compile' /usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:72:(.text+0x8513): undefined reference to pcre_study' /usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:73:(.text+0x8526): undefined reference topcre_jit_stack_alloc' /usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:74:(.text+0x8537): undefined reference to `pcre_assign_jit_stack' collect2: error: ld returned 1 exit status make[2]: [Makefile:1367: bulk_extractor] Error 1 make[2]: Leaving directory '/tmp/makepkg/bulk-extractor/src/bulk_extractor/src' make[1]: [Makefile:527: all-recursive] Error 1 make[1]: Leaving directory '/tmp/makepkg/bulk-extractor/src/bulk_extractor' make: *** [Makefile:467: all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... Probably because on building flags there is not -lpcre flag. @simsong https://github.com/simsong can you add it please?

— Reply to this email directly, view it on GitHub https://github.com/simsong/bulk_extractor/issues/466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMFHLBUY3DG7DOZ4KFBI3DY6KUAPAVCNFSM6AAAAABGQVHUK2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TINRVGQ2TGNQ. You are receiving this because you were mentioned.

simsong commented 2 months ago

Can you submit a PR? I’m not sure which file you want me to change.

On Apr 20, 2024, at 1:57 PM, D3vil0p3r @.***> wrote:

I am building bulk_extractor in Arch Linux by the following PKGBUILD:

pkgname=bulk-extractor pkgver=2333.6a7da28 pkgrel=1 groups=('athena' 'athena-forensic' 'athena-misc') pkgdesc='Bulk Email and URL extraction tool.' arch=('x86_64') url='https://github.com/simsong/bulk_extractor' license=('GPL') depends=('tre' 'flex' 'java-environment' 'openssl' 'exiv2' 'afflib' 'libewf' 'libxml2' 'zlib' 'ncurses5-compat-libs' 're2') makedepends=('git' 'autoconf' 'automake') source=("git+https://github.com/simsong/${pkgname//-/_}.git") sha512sums=('SKIP')

pkgver() { cd "${pkgname//-/_}"

echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD) }

prepare() { cd ${pkgname//-/_}

git submodule update --recursive --remote

sed -i 's|dirname $0|/usr/share/bulk-extractor|' java_gui/BEViewer

sh bootstrap.sh }

build() { cd ${pkgname//-/_}

./configure --prefix=/usr --sysconfdir=/etc

make

make -C java_gui

}

package() { cd ${pkgname//-/_}

install -dm 755 "$pkgdir/usr/share/$pkgname"

make DESTDIR="$pkgdir" install

install -m 644 java_gui/BEViewer.jar "$pkgdir/usr/share/$pkgname"

install -m 755 java_gui/BEViewer "$pkgdir/usr/bin"

} During the building, I get the following error:

  |                                                         ^

/usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function regex_vector::~regex_vector()': /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:91:(.text+0x9bb): undefined reference topcre_free' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o:/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:93:(.text+0x9d0): undefined reference to pcre_free_study' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o:/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:94:(.text+0x9da): undefined reference topcre_jit_stack_free' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function regex_vector::search_all(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, unsigned long*, unsigned long*) const': /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:142:(.text+0x1924): undefined reference topcre_exec' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function regex_vector::push_back(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:63:(.text+0x84f6): undefined reference topcre_compile' /usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:72:(.text+0x8513): undefined reference to pcre_study' /usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:73:(.text+0x8526): undefined reference topcre_jit_stack_alloc' /usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:74:(.text+0x8537): undefined reference to `pcre_assign_jit_stack' collect2: error: ld returned 1 exit status make[2]: [Makefile:1367: bulk_extractor] Error 1 make[2]: Leaving directory '/tmp/makepkg/bulk-extractor/src/bulk_extractor/src' make[1]: [Makefile:527: all-recursive] Error 1 make[1]: Leaving directory '/tmp/makepkg/bulk-extractor/src/bulk_extractor' make: *** [Makefile:467: all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... Probably because on building flags there is not -lpcre flag. @simsong https://github.com/simsong can you add it please?

— Reply to this email directly, view it on GitHub https://github.com/simsong/bulk_extractor/issues/466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMFHLBUY3DG7DOZ4KFBI3DY6KUAPAVCNFSM6AAAAABGQVHUK2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TINRVGQ2TGNQ. You are receiving this because you were mentioned.

D3vil0p3r commented 2 months ago

Can you submit a PR? I’m not sure which file you want me to change. On Apr 20, 2024, at 1:57 PM, D3vil0p3r @.> wrote: I am building bulk_extractor in Arch Linux by the following PKGBUILD: pkgname=bulk-extractor pkgver=2333.6a7da28 pkgrel=1 groups=('athena' 'athena-forensic' 'athena-misc') pkgdesc='Bulk Email and URL extraction tool.' arch=('x86_64') url='https://github.com/simsong/bulk_extractor' license=('GPL') depends=('tre' 'flex' 'java-environment' 'openssl' 'exiv2' 'afflib' 'libewf' 'libxml2' 'zlib' 'ncurses5-compat-libs' 're2') makedepends=('git' 'autoconf' 'automake') source=("git+https://github.com/simsong/${pkgname//-/_}.git") sha512sums=('SKIP') pkgver() { cd "${pkgname//-/}" echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD) } prepare() { cd ${pkgname//-/} git submodule update --recursive --remote #sed -i 's|dirname $0|/usr/share/bulk-extractor|' javagui/BEViewer sh bootstrap.sh } build() { cd ${pkgname//-/} ./configure --prefix=/usr --sysconfdir=/etc make #make -C javagui } package() { cd ${pkgname//-/} install -dm 755 "$pkgdir/usr/share/$pkgname" make DESTDIR="$pkgdir" install #install -m 644 java_gui/BEViewer.jar "$pkgdir/usr/share/$pkgname" #install -m 755 java_gui/BEViewer "$pkgdir/usr/bin" } During the building, I get the following error: | ^ /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function regex_vector::~regex_vector()': /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:91:(.text+0x9bb): undefined reference topcre_free' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o:/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:93:(.text+0x9d0): undefined reference to pcre_free_study' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o:/usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:94:(.text+0x9da): undefined reference topcre_jit_stack_free' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in function `regex_vector::search_all(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::cxx11::basic_string<char, std::char_traits, std::allocator >, unsigned long, unsigned long) const': /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:142:(.text+0x1924): undefined reference to pcre_exec' /usr/bin/ld: /tmp/ccvwT6pv.ltrans4.ltrans.o: in functionregex_vector::push_back(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)': /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:63:(.text+0x84f6): undefined reference to pcre_compile' /usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:72:(.text+0x8513): undefined reference topcre_study' /usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:73:(.text+0x8526): undefined reference to pcre_jit_stack_alloc' /usr/bin/ld: /usr/src/debug/bulk-extractor/bulk_extractor/src/be20_api/regex_vector.cpp:74:(.text+0x8537): undefined reference topcre_assign_jit_stack' collect2: error: ld returned 1 exit status make[2]: ** [Makefile:1367: bulk_extractor] Error 1 make[2]: Leaving directory '/tmp/makepkg/bulk-extractor/src/bulk_extractor/src' make[1]: [Makefile:527: all-recursive] Error 1 make[1]: Leaving directory '/tmp/makepkg/bulk-extractor/src/bulk_extractor' make: *** [Makefile:467: all] Error 2 ==> ERROR: A failure occurred in build(). Aborting... Probably because on building flags there is not -lpcre flag. @simsong https://github.com/simsong can you add it please? — Reply to this email directly, view it on GitHub <#466>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMFHLBUY3DG7DOZ4KFBI3DY6KUAPAVCNFSM6AAAAABGQVHUK2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TINRVGQ2TGNQ. You are receiving this because you were mentioned.

It should be added in configure.ac. I'm trying to add on it:

## pcre lib usage
AC_CHECK_LIB([pcre])

but, during the ./configure I don't still see -lpcre in the output in "LIBS=` variable.

D3vil0p3r commented 2 months ago

Oh... I saw the solution I proposed fixed the issue... Here the PR: https://github.com/simsong/bulk_extractor/pull/467

UPDATE: in reality, not needed. I added pcre dependency and seems to work.