FSX / momoko

Wraps (asynchronous) Psycopg2 for Tornado.
http://momoko.61924.nl/
Other
364 stars 73 forks source link

Fix tcproxy build error #167

Closed nkonin closed 6 years ago

nkonin commented 6 years ago

Got error

(venv6) nkonin@Mac-mini-Nikita:~/projects/momoko$ make -C tcproxy
cd src && /Library/Developer/CommandLineTools/usr/bin/make all
    CC tcproxy.o
    CC ae.o
    CC util.o
    CC policy.o
policy.c:222:18: error: unused variable 'policy_parser_first_final'
      [-Werror,-Wunused-const-variable]
static const int policy_parser_first_final = 99;
                 ^
policy.c:223:18: error: unused variable 'policy_parser_error'
      [-Werror,-Wunused-const-variable]
static const int policy_parser_error = 0;
                 ^
policy.c:225:18: error: unused variable 'policy_parser_en_main'
      [-Werror,-Wunused-const-variable]
static const int policy_parser_en_main = 1;
                 ^
3 errors generated.
make[1]: *** [policy.o] Error 1
make: *** [all] Error 2

Remove unsed variables from error message

(venv6) nkonin@Mac-mini-Nikita:~/projects/momoko$ git diff
diff --git a/tcproxy/src/policy.c b/tcproxy/src/policy.c
index 0b590da..abcd6ff 100644
--- a/tcproxy/src/policy.c
+++ b/tcproxy/src/policy.c
@@ -219,10 +219,6 @@ static const char _policy_parser_eof_actions[] = {
 };

 static const int policy_parser_start = 1;
-static const int policy_parser_first_final = 99;
-static const int policy_parser_error = 0;
-
-static const int policy_parser_en_main = 1;

 #line 95 "policy.rl"

And now it's ok

(venv6) nkonin@Mac-mini-Nikita:~/projects/momoko$ make -C tcproxy
cd src && /Library/Developer/CommandLineTools/usr/bin/make all
    CC policy.o
    CC zmalloc.o
    CC anet.o
    LINK tcproxy

Make Complete. Read README for how to use.

Having problems with it? Send complains and bugs to dccmx@dccmx.com

(venv6) nkonin@Mac-mini-Nikita:~/projects/momoko$
haizaar commented 6 years ago

Interesting. It didn't happen to me locally, and also compiles fine in Travis CI. Do you have any special compiler flags enabled by default like -Werror?

nkonin commented 6 years ago

The -Werror flag is present in the Makefile, and for several years already. https://github.com/FSX/momoko/blob/9d6476dee365e862d5a4d1e1c0f00b26391e2bae/tcproxy/src/Makefile#L5 I just ran make -C tcproxy as written in the readme.

haizaar commented 6 years ago

Can you post output of gcc -v on your system please?

nkonin commented 6 years ago
$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.25.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
haizaar commented 6 years ago

Oh, it's Mac. I guess that's the difference. I wonder why the native gcc does not break on that. Anyways, I've forked tcpproxy from other project and the origin was not updated since then. It's used only for testing and tests pass after your patch. Though I don't understand the reason for failure fully, it does not seem to be of much importance here. Therefore I'm merging it.