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

pthread_t is not portable; can't build on certain systems #3

Open
vapronva opened this issue Feb 18, 2022 · 0 comments
Open

pthread_t is not portable; can't build on certain systems #3

vapronva opened this issue Feb 18, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@vapronva
Copy link

What?

As described by @hatkidchan:

pthread_t is not portable and should not be used as it is like unsigned int

Building

Successfully built on a regular Linux machine. Tried building on macOS — got the error shown below.

[email protected] ~/Documents/GitHub/copperhammer-scanner-c  [master]  
$ make clean all
( cd src/extras/cjson; make clean )
rm -f cJSON.o cJSON_Utils.o #delete object files
rm -f libcjson.dylib libcjson.dylib.1.7.15 libcjson.dylib.1 libcjson.a #delete cJSON
rm -f libcjson_utils.dylib libcjson_utils.dylib.1.7.15 libcjson_utils.dylib.1 libcjson_utils.a #delete cJSON_Utils
rm -f cJSON_test  #delete test
rm -f lib/sockio.o lib/mcping.o lib/utils.o lib/mcproto.o lib/stb_ds.o lib/logging.o bin/main || true
( cd src/extras/cjson; make )
gcc -std=c89 -c -fPIC -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default -Wconversion -fstack-protector cJSON.c
gcc -std=c89 -shared -o libcjson.dylib.1.7.15 cJSON.o "" 
ln -s libcjson.dylib.1.7.15 libcjson.dylib.1
ln -s libcjson.dylib.1 libcjson.dylib
gcc -std=c89 -c -fPIC -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default -Wconversion -fstack-protector cJSON_Utils.c
gcc -std=c89 -shared -o libcjson_utils.dylib.1.7.15 cJSON_Utils.o cJSON.o "" 
ln -s libcjson_utils.dylib.1.7.15 libcjson_utils.dylib.1
ln -s libcjson_utils.dylib.1 libcjson_utils.dylib
ar rcs libcjson.a cJSON.o
ar rcs libcjson_utils.a cJSON_Utils.o
gcc -std=c89 -fPIC -pedantic -Wall -Werror -Wstrict-prototypes -Wwrite-strings -Wshadow -Winit-self -Wcast-align -Wformat=2 -Wmissing-prototypes -Wstrict-overflow=2 -Wcast-qual -Wc++-compat -Wundef -Wswitch-default -Wconversion -fstack-protector cJSON.c test.c  -o cJSON_test -lm -I.
cc -Wall -Wextra -Werror -pedantic -Wno-pointer-arith -c src/sockio.c -o lib/sockio.o
cc -Wall -Wextra -Werror -pedantic -Wno-pointer-arith -c src/mcping.c -o lib/mcping.o
cc -Wall -Wextra -Werror -pedantic -Wno-pointer-arith -c src/utils.c -o lib/utils.o
cc -Wall -Wextra -Werror -pedantic -Wno-pointer-arith -c src/mcproto.c -o lib/mcproto.o
cc -Wall -Wextra -Werror -pedantic -Wno-pointer-arith -c src/stb_ds.c -o lib/stb_ds.o
cc -Wall -Wextra -Werror -pedantic -Wno-pointer-arith -c src/logging.c -o lib/logging.o
src/logging.c:19:31: error: format specifies type 'unsigned long' but the argument has type 'pthread_t _Nonnull' (aka 'struct _opaque_pthread_t *') [-Werror,-Wformat]
      get_loglevel_name(lvl), pthread_self(), file, line, buf);
                              ^~~~~~~~~~~~~~
1 error generated.
make: *** [lib/logging.o] Error 1
@vapronva vapronva added the bug Something isn't working label Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant