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

Does not build successfully on OSX El Capitan and earlier due to missing CLOCK_MONOTONIC #1571

Closed
zbentley opened this issue Jun 21, 2018 · 2 comments

Comments

@zbentley
Copy link

On OSX El Capitan, attempting to build Proxysql 1.4.9 results in failures like this:

mkdir obj
clang -fPIC -c -o obj/c_tokenizer.o c_tokenizer.c -I../include -I../deps/jemalloc/jemalloc/include/jemalloc -I../deps/mariadb-client-library/mariadb_client/include -I../deps/libconfig/libconfig-1.4.9/lib -I../deps/re2/re2 -I../deps/sqlite3/sqlite3 -I../deps/pcre/pcre -I/usr/local/include -I../deps/clickhouse-cpp/clickhouse-cpp -I../deps/libmicrohttpd/libmicrohttpd -I../deps/libmicrohttpd/libmicrohttpd/src/include -I../deps/curl/curl/include -I/usr/local/opt/openssl/include -O2 -ggdb  -Wall -DGITVERSION=\"\" -DNOJEM 
clang++ -fPIC -c -o obj/ProxySQL_GloVars.oo ProxySQL_GloVars.cpp -std=c++11 -I../include -I../deps/jemalloc/jemalloc/include/jemalloc -I../deps/mariadb-client-library/mariadb_client/include -I../deps/libconfig/libconfig-1.4.9/lib -I../deps/re2/re2 -I../deps/sqlite3/sqlite3 -I../deps/pcre/pcre -I/usr/local/include -I../deps/clickhouse-cpp/clickhouse-cpp -I../deps/libmicrohttpd/libmicrohttpd -I../deps/libmicrohttpd/libmicrohttpd/src/include -I../deps/curl/curl/include -I/usr/local/opt/openssl/include -O2 -ggdb  -Wall -DGITVERSION=\"\" -DNOJEM  
clang++ -fPIC -c -o obj/network.oo network.cpp -std=c++11 -I../include -I../deps/jemalloc/jemalloc/include/jemalloc -I../deps/mariadb-client-library/mariadb_client/include -I../deps/libconfig/libconfig-1.4.9/lib -I../deps/re2/re2 -I../deps/sqlite3/sqlite3 -I../deps/pcre/pcre -I/usr/local/include -I../deps/clickhouse-cpp/clickhouse-cpp -I../deps/libmicrohttpd/libmicrohttpd -I../deps/libmicrohttpd/libmicrohttpd/src/include -I../deps/curl/curl/include -I/usr/local/opt/openssl/include -O2 -ggdb  -Wall -DGITVERSION=\"\" -DNOJEM  
clang++ -fPIC -c -o obj/debug.oo debug.cpp -std=c++11 -I../include -I../deps/jemalloc/jemalloc/include/jemalloc -I../deps/mariadb-client-library/mariadb_client/include -I../deps/libconfig/libconfig-1.4.9/lib -I../deps/re2/re2 -I../deps/sqlite3/sqlite3 -I../deps/pcre/pcre -I/usr/local/include -I../deps/clickhouse-cpp/clickhouse-cpp -I../deps/libmicrohttpd/libmicrohttpd -I../deps/libmicrohttpd/libmicrohttpd/src/include -I../deps/curl/curl/include -I/usr/local/opt/openssl/include -O2 -ggdb  -Wall -DGITVERSION=\"\" -DNOJEM  
clang++ -fPIC -c -o obj/configfile.oo configfile.cpp -std=c++11 -I../include -I../deps/jemalloc/jemalloc/include/jemalloc -I../deps/mariadb-client-library/mariadb_client/include -I../deps/libconfig/libconfig-1.4.9/lib -I../deps/re2/re2 -I../deps/sqlite3/sqlite3 -I../deps/pcre/pcre -I/usr/local/include -I../deps/clickhouse-cpp/clickhouse-cpp -I../deps/libmicrohttpd/libmicrohttpd -I../deps/libmicrohttpd/libmicrohttpd/src/include -I../deps/curl/curl/include -I/usr/local/opt/openssl/include -O2 -ggdb  -Wall -DGITVERSION=\"\" -DNOJEM  
debug.cpp:25:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        clock_gettime(CLOCK_MONOTONIC, &ts);
                      ^
1 error generated.
make[1]: *** [obj/debug.oo] Error 1

Later versions of OSX build correctly, but not El Cap. Since it's not that old, it would be good to have build support for it.

Since this is debug code, a silly hack is probably possible a la

#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC SYSTEM_CLOCK
#endif // CLOCK_MONOTONIC
@renecannao
Copy link
Contributor

This approach is already used in gen_utils.h, so it makes sense, see https://github.com/sysown/proxysql/blob/v1.4.10/include/gen_utils.h#L197-L199

@renecannao
Copy link
Contributor

Applied to 1.4.10 and 2.0.0 .

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants