You are not logged in.

#1 2019-10-13 10:50:47

crate
Member
Registered: 2019-10-13
Posts: 4

[SOLVED] Cannot install Snort - throws gettid error

Last day and night, around 20 hours straight, I kept getting an error along this line when installing Snort on a newly installed Arch Linux box, with base and base-devel (and all dependencies double-checked installed):

In file included from ../../src/decode.h:56,
                 from ../../src/spo_plugbase.h:31,
                 from ../../src/snort.h:36,
                 from sfcontrol.c:37:
../../src/util.h: At top level:
../../src/util.h:377:21: error: static declaration of gettid follows non-static declaration
  377 | static inline pid_t gettid(void)
      |                     ^~~~~~
In file included from /usr/include/unistd.h:1170,
                 from /usr/include/daq_common.h:25,
                 from /usr/include/daq.h:26,
                 from ../../src/decode.h:48,
                 from ../../src/spo_plugbase.h:31,
                 from ../../src/snort.h:36,
                 from sfcontrol.c:37:
/usr/include/bits/unistd_ext.h:34:16: note: previous declaration of gettid was here
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~
make[3]: *** [Makefile:351: sfcontrol.o] Error 1
make[3]: Leaving directory '/usr/local/build/snort-nfqueue/src/snort-2.9.14.1/src/control'
make[2]: *** [Makefile:547: all-recursive] Error 1
make[2]: Leaving directory '/usr/local/build/snort-nfqueue/src/snort-2.9.14.1/src'
make[1]: *** [Makefile:505: all-recursive] Error 1
make[1]: Leaving directory '/usr/local/build/snort-nfqueue/src/snort-2.9.14.1'
make: *** [Makefile:370: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

I don't understand the error, and thus cannot fix - Google was useless the whole day. (I don't know if this is related to Snort itself, like some install script lines that are mismatching or some tool used to build snort that is missing some lib or the like)

The same error if I use AUR packages or compile manually from Snort provided source files.

A few months ago, I succeeded in installing on Arch, I just can't remember how...! I (think) remember that I used the --ignore-errors when making and installing, but now when using that argument I end up without a snort "executable" file - no snort in my bins or sbins, only support files are installed. I looked up my command history, but unfortunately those commands are not there)

Snort released a new version, and the AUR package is not up to date, but easily to fix. Both new and AUR version throw same error.

I'm using Snort in inline mode with nfqueue daq and openappid, but even the AUR without nfqueue gives me the same error..

If someone could please help

Last edited by crate (2019-10-20 10:05:38)

Offline

#2 2019-10-13 11:10:23

loqs
Member
Registered: 2014-03-06
Posts: 9,074

Re: [SOLVED] Cannot install Snort - throws gettid error

Please use code tags for commands and their output.  See http://cgit.openembedded.org/meta-opene … h?h=master

Offline

#3 2019-10-13 11:48:35

crate
Member
Registered: 2019-10-13
Posts: 4

Re: [SOLVED] Cannot install Snort - throws gettid error

I changed to code tags.

Maybe this post should have been in Technical Issues and Assistance -> System Administration instead? I can't move it myself, I think

Offline

#4 2019-10-13 11:53:13

loqs
Member
Registered: 2014-03-06
Posts: 9,074

Re: [SOLVED] Cannot install Snort - throws gettid error

What was the result after you applied the patch I linked in the PKGBUILD along with running autoreconf -fi ?
Those changes allowed the package to build successfully on this system.
Edit:
The System Administration Forum is closed see https://bbs.archlinux.org/viewtopic.php?id=218234

diff of PKGBUILD that I used

diff --git a/PKGBUILD b/PKGBUILD
index ebdd52a..9b71012 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,7 +6,7 @@
 # Contributor: Gregor Ibic <gregor.ibic@intelicom.si>
 
 pkgname=snort
-pkgver=2.9.14.1
+pkgver=2.9.15
 pkgrel=1
 pkgdesc='A lightweight network intrusion detection system.'
 arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64' 'arm')
@@ -23,8 +23,15 @@ options=('!makeflags' '!libtool')
 install='snort.install'
 source=("https://www.snort.org/downloads/snort/${pkgname}-${pkgver}.tar.gz"
        "http://rules.emergingthreats.net/open/${pkgname}-2.9.0/emerging.rules.tar.gz"
+       http://cgit.openembedded.org/meta-openembedded/plain/meta-networking/recipes-connectivity/snort/snort/0001-chdeck-for-gettid-API-during-configure.patch
 'snort@.service')
 
+prepare() {
+       cd $pkgname-$pkgver
+       patch -p1 -i ../0001-chdeck-for-gettid-API-during-configure.patch
+       autoreconf -fi
+}
+
 build() {
        cd "${srcdir}/${pkgname}-${pkgver}"
        ./configure --prefix=/usr --sysconfdir=/etc/snort --with-libpcap-includes=/usr/include/pcap \
@@ -54,6 +61,7 @@ package() {
        cp ${srcdir}/rules/* "${pkgdir}/etc/snort/rules"
 }
 
-md5sums=('009254a9797ec93321c5936b99dcd6c8'
-       'SKIP'
-'a847030a34396e6b2d1cacd272ad42da')
+md5sums=('b56cadfa840f706ff67d4df0256c03eb'
+         'a137e7510bf8449f07f114d72840ffa8'
+         '639e6bc5c8fba1d7d78f9bd7bc8292cd'
+         'a847030a34396e6b2d1cacd272ad42da')

The above does not address other issues with the PKGBUILD such as updating to use hooks instead of a .install file.

Last edited by loqs (2019-10-13 12:02:56)

Offline

#5 2019-10-13 12:22:37

crate
Member
Registered: 2019-10-13
Posts: 4

Re: [SOLVED] Cannot install Snort - throws gettid error

loqs ! This patch is a huge success, thanks a ton!

Offline

#6 2019-10-13 12:23:07

crate
Member
Registered: 2019-10-13
Posts: 4

Re: [SOLVED] Cannot install Snort - throws gettid error

Where could I have found it myself?

Offline

#7 2019-10-13 12:31:28

loqs
Member
Registered: 2014-03-06
Posts: 9,074

Re: [SOLVED] Cannot install Snort - throws gettid error

I found it from a search engine query for "snort gettid"

Offline

#8 2019-10-20 05:36:22

amish
Member
Registered: 2014-05-10
Posts: 414

Re: [SOLVED] Cannot install Snort - throws gettid error

I shortened the patch as follows.

Basically it does not modify configure.in file to check for gettid() but instead checks for GLIBC version (i.e. 2.30 or higher)

--- a/src/util.h
+++ b/src/util.h
@@ -374,6 +374,7 @@ static inline int IsEmptyStr(const char *str)
     return 0;
 }
 
+#if !defined(__GLIBC__) || !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 30)
 static inline pid_t gettid(void)
 {
 #if defined(LINUX) && defined(SYS_gettid)
@@ -382,5 +383,6 @@ static inline pid_t gettid(void)
     return getpid();
 #endif
 }
+#endif
 
 #endif /*__UTIL_H__*/

AUR: https://aur.archlinux.org/cgit/aur.git/ … rt-nfqueue

then autoreconf in prepare() function of PKGBUILD is not required.

Last edited by amish (2019-10-20 05:41:01)


Forum signature: I discuss. I put my thoughts strongly. But I definitely respect all developers and time they put in.

Offline

#9 2019-10-20 09:08:10

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 9,140
Website

Re: [SOLVED] Cannot install Snort - throws gettid error

Crate, please remember to mark your thread as solved by editing the first post and amending the topic title.

https://wiki.archlinux.org/index.php/Co … ow_to_post


Sakura:-
Mobo: MSI X299 TOMAHAWK ARCTIC // Processor: Intel Core i7-7820X 3.6GHz // GFX: nVidia GeForce GTX 970 // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 5x 1TB HDD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB