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

Fix Compiler Error Android pthread #1700

Closed
wants to merge 1 commit into from
Closed

Conversation

hajoha
Copy link

@hajoha hajoha commented May 15, 2024

Version of iperf3 (or development branch, such as master or
3.1-STABLE) to which this pull request applies:

  • 3.16 and following

Issues fixed (if any):

  • Following Compiler Errors
1.725 /tmp/iperf/src/iperf_client_api.c:61:28: error: incompatible pointer to integer conversion passing 'void *' to parameter of type 'int' [-Wint-conversion]
1.725     pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
1.725                            ^~~~~~~~~~~~~~~~~~~~~
1.725 /tmp/iperf/src/iperf_pthread.h:13:31: note: expanded from macro 'PTHREAD_CANCEL_ENABLE'
1.725 #define PTHREAD_CANCEL_ENABLE NULL
1.725                               ^~~~
1.725 /opt/android-ndk/android-ndk-r26b/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/include/stddef.h:89:16: note: expanded from macro 'NULL'
1.725 #  define NULL ((void*)0)
1.725                ^~~~~~~~~~
1.725 /tmp/iperf/src/iperf_pthread.h:16:32: note: passing argument to parameter 'state' here
1.725 int pthread_setcancelstate(int state, int *oldstate);
1.725                                ^
1.727 1 error generated.
1.730 make: *** [/opt/android-ndk/android-ndk-r26b/build/core/build-binary.mk:413: /tmp/obj/local/arm64-v8a/objs/iperf3.16/src/iperf_client_api.o] Error 1
------
1.615 /tmp/iperf/src/iperf_pthread.c:16:19: error: call to undeclared function 'iperf_set_thread_exit_handler'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1.615     if ((status = iperf_set_thread_exit_handler()) == 0) {
1.615                   ^
1.616 /tmp/iperf/src/iperf_pthread.c:31:5: error: call to undeclared library function 'memset' with type 'void *(void *, int, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1.616     memset(&actions, 0, sizeof(actions)); 
1.616     ^
1.616 /tmp/iperf/src/iperf_pthread.c:31:5: note: include the header <string.h> or explicitly provide a declaration for 'memset'
1.617 2 errors generated.
1.619 make: *** [/opt/android-ndk/android-ndk-r26b/build/core/build-binary.mk:413: /tmp/obj/local/arm64-v8a/objs/iperf3.16/src/iperf_pthread.o] Error 1
------

If I apply the changes, it compiles without a problem.

Brief description of code changes (suitable for use as a commit message):

  • Reordering of functions, so that functions are declared before their usage

If you want to try it out yourself, here.
Building ENV:

ARG API_VERSION=31
ARG SDK_VERSION=4333796
ARG NDK_VERSION=r26b
ARG IPERF_VERSION=iperf-3.17.1

Feel free to close this PR if I made a mistake or missing something.

@hajoha
Copy link
Author

hajoha commented May 15, 2024

I just saw their is already this PR, feel free to close then

@bmah888
Copy link
Contributor

bmah888 commented May 24, 2024

Thanks for the PR! We'll go with #1687 but this looks like a case where great minds think alike. :-)

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

Successfully merging this pull request may close these issues.

2 participants