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

Openwrt: Compilation error with --enable-redir #200

Closed
drkhosla opened this issue Jan 16, 2016 · 5 comments
Closed

Openwrt: Compilation error with --enable-redir #200

drkhosla opened this issue Jan 16, 2016 · 5 comments
Labels

Comments

@drkhosla
Copy link

I am trying to compile latest coova chilli 06th Jan, 2016 using openwrt r48251. I think it is long pending issue.

libtool: compile:  mips-openwrt-linux-musl-gcc -DHAVE_CONFIG_H -I. -I.. -I/var/firmware/openwrt/staging_dir/target-mips_34kc_musl-1.1.11/usr/include -I/var/firmware/openwrt/staging_dir/target-mips_34kc_musl-1.1.11/include -I/var/firmware/openwrt/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/usr/include -I/var/firmware/openwrt/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include/fortify -I/var/firmware/openwrt/staging_dir/toolchain-mips_34kc_gcc-5.2.0_musl-1.1.11/include -D_GNU_SOURCE -Wall -Werror -fno-builtin -fno-strict-aliasing -O2 -fomit-frame-pointer -funroll-loops -pipe -I../bstring -DDEFCHILLICONF=\"/etc/chilli.conf\" -DDEFPIDFILE=\"/var/run/chilli.pid\" -DDEFSTATEDIR=\"/var/run\" -DSBINDIR=\"/usr/sbin\" -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -MT options.lo -MD -MP -MF .deps/options.Tpo -c options.c  -fPIC -DPIC -o .libs/options.o
options.c: In function 'options_fromfd':
options.c:381:48: error: 'regex_t {aka struct re_pattern_buffer}' has no member named 'allocated'
     if (_options.regex_pass_throughs[i].re_host.allocated)
                                                ^
options.c:383:48: error: 'regex_t {aka struct re_pattern_buffer}' has no member named 'allocated'
     if (_options.regex_pass_throughs[i].re_path.allocated)
                                                ^
options.c:385:46: error: 'regex_t {aka struct re_pattern_buffer}' has no member named 'allocated'
     if (_options.regex_pass_throughs[i].re_qs.allocated)
                                              ^
make[7]: *** [options.lo] Error 1
make[7]: Leaving directory `/var/firmware/openwrt/build_dir/target-mips_34kc_musl-1.1.11/coova-chilli-1.3.0+20160106/src'
make[6]: *** [all-recursive] Error 1
make[6]: Leaving directory `/var/firmware/openwrt/build_dir/target-mips_34kc_musl-1.1.11/coova-chilli-1.3.0+20160106/src'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/var/firmware/openwrt/build_dir/target-mips_34kc_musl-1.1.11/coova-chilli-1.3.0+20160106'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/var/firmware/openwrt/build_dir/target-mips_34kc_musl-1.1.11/coova-chilli-1.3.0+20160106'
make[3]: *** [/var/firmware/openwrt/build_dir/target-mips_34kc_musl-1.1.11/coova-chilli-1.3.0+20160106/.built] Error 2
make[3]: Leaving directory `/var/firmware/drkhosla/coova-chilli'
make[2]: *** [package/feeds/drkhosla/coova-chilli/compile] Error 2
make[2]: Leaving directory `/var/firmware/openwrt'
make[1]: *** [/var/firmware/openwrt/staging_dir/target-mips_34kc_musl-1.1.11/stamp/.package_compile] Error 2
make[1]: Leaving directory `/var/firmware/openwrt'
make: *** [world] Error 2
@CristiCimpianu
Copy link
Contributor

with a little patch 0d523af to work with uclibc the latest git coova compiled for me in openwrt

@xewonder
Copy link

Hi,

Having this problem today...
What files do you have to patch up?

Thanks

@sevan sevan added the bug label May 25, 2016
@nzamps
Copy link
Contributor

nzamps commented Jun 11, 2016

Try:

--- a/system.h
+++ b/system.h
@@ -117,18 +117,6 @@
 #include <inttypes.h>
 #endif

-#if defined(__linux__)
-#include <asm/types.h>
-#include <linux/if.h>
-#include <linux/if_packet.h>
-#include <linux/if_ether.h>
-#include <linux/if_tun.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-#ifndef HAVE_SYS_UN_H
-#include <linux/un.h>
-#endif
-
 #ifdef HAVE_SYS_SYSINFO_H
 #include <sys/sysinfo.h>
 #else
@@ -244,6 +232,20 @@
 #include <unistd.h>
 #include <errno.h>

+#if defined(__linux__)
+#include <asm/types.h>
+#include <linux/if.h>
+#include <linux/if_packet.h>
+#include <linux/if_ether.h>
+#include <linux/if_tun.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <linux/if_vlan.h>
+#include <linux/sockios.h>
+#ifndef HAVE_SYS_UN_H
+#include <linux/un.h>
+#endif
+
 int safe_accept(int fd, struct sockaddr *sa, socklen_t *lenptr);
 int safe_select(int nfds, fd_set *readfds, fd_set *writefds,
        fd_set *exceptfds, struct timeval *timeout);

@drkhosla
Copy link
Author

drkhosla commented Oct 13, 2016

I tried to patch both configure and system.h but error is still persist. Actually musl library missing variable allocated https://fossies.org/dox/musl-1.1.15/structre__pattern__buffer.html.

I tried following patch to compile it successful

+++a/src/options.c
+++ b/src/options.c
@@ -373,7 +373,7 @@

 #ifdef ENABLE_CHILLIREDIR
   for (i = 0; i < MAX_REGEX_PASS_THROUGHS; i++) {
-#if defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
+#if defined (__linux__) || (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
     regfree(&_options.regex_pass_throughs[i].re_host);
     regfree(&_options.regex_pass_throughs[i].re_path);
     regfree(&_options.regex_pass_throughs[i].re_qs);

--- a/src/main-redir.c
+++ b/src/main-redir.c
@@ -510,12 +510,6 @@
   log_dbg("Checking %s =~ %s", s, regex);
 #endif

-#if defined (__FreeBSD__) || defined (__APPLE__) || defined (__OpenBSD__) || defined (__NetBSD__)
-  if (!re->re_g)
-#else
-  if (!re->allocated) 
-#endif
-  {
     if ((ret = regcomp(re, regex, REG_EXTENDED | REG_NOSUB)) != 0) {
       char error[512];
       regerror(ret, re, error, sizeof(error));
@@ -523,7 +517,6 @@
       regex[0] = 0;
       return -1;
     }
-  }

   if ((ret = regexec(re, s, 0, 0, 0)) == 0) { 

@alex-eri
Copy link
Contributor

last patch not working. Have someone built chilli with regex?

@drkhosla drkhosla closed this as completed Mar 6, 2019
sevan pushed a commit that referenced this issue Jul 8, 2019
musl lacks `allocated` member on `struct re_pattern_buffer` (`regex_t`)
(https://fossies.org/dox/musl-1.1.20/structre__pattern__buffer.html).

Patch inspired by drkhosla's comment at issue #200
(#200 (comment))
Karabur pushed a commit to Karabur/coova-chilli that referenced this issue Oct 2, 2019
musl lacks `allocated` member on `struct re_pattern_buffer` (`regex_t`)
(https://fossies.org/dox/musl-1.1.20/structre__pattern__buffer.html).

Patch inspired by drkhosla's comment at issue coova#200
(coova#200 (comment))

(cherry picked from commit b1f359e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants