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 build error for macOS. #1960

Closed
wants to merge 1 commit into from
Closed

fix build error for macOS. #1960

wants to merge 1 commit into from

Conversation

mqiezi
Copy link

@mqiezi mqiezi commented Dec 9, 2020

Fix error below when build for macOS version.

~/git/GitHub/scrcpy(master ✗) ninja -Cx
ninja: Entering directory `x'
[0/3] Generating scrcpy-server with a custom command

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 2s
25 actionable tasks: 1 executed, 24 up-to-date
[1/3] Compiling C object app/scrcpy.p/src_sys_unix_command.c.o
FAILED: app/scrcpy.p/src_sys_unix_command.c.o
cc -Iapp/scrcpy.p -Iapp -I../app -I../app/src -I/usr/local/Cellar/ffmpeg/4.3.1_4/include -I/usr/local/include/SDL2 -I/usr/local/opt/llvm/include -I/usr/local/opt/openssl/include -I/usr/local/opt/flex/include -flto -Xclang -fcolor-diagnostics -pipe -Wall -Winvalid-pch -Wextra -std=c11 -O3 -D_THREAD_SAFE -MD -MQ app/scrcpy.p/src_sys_unix_command.c.o -MF app/scrcpy.p/src_sys_unix_command.c.o.d -o app/scrcpy.p/src_sys_unix_command.c.o -c ../app/src/sys/unix/command.c
In file included from ../app/src/sys/unix/command.c:24:
In file included from ../app/src/util/log.h:4:
In file included from /usr/local/include/SDL2/SDL_log.h:40:
/usr/local/include/SDL2/SDL_stdinc.h:426:5: error: implicit declaration of function 'memset_pattern4' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    memset_pattern4(dst, &val, dwords * 4);
    ^
../app/src/sys/unix/command.c:31:12: error: implicit declaration of function 'strdup' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    path = strdup(path);
           ^
../app/src/sys/unix/command.c:31:12: note: did you mean 'strcmp'?
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:77:6: note: 'strcmp' declared here
int      strcmp(const char *__s1, const char *__s2);
         ^
../app/src/sys/unix/command.c:31:10: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
    path = strdup(path);
         ^ ~~~~~~~~~~~~
../app/src/sys/unix/command.c:38:22: error: implicit declaration of function 'strtok_r' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    for (char *dir = strtok_r(path, ":", &saveptr); dir;
                     ^
../app/src/sys/unix/command.c:38:22: note: did you mean 'strtok'?
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/string.h:90:7: note: 'strtok' declared here
char    *strtok(char *__str, const char *__sep);
         ^
../app/src/sys/unix/command.c:38:16: warning: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int' [-Wint-conversion]
    for (char *dir = strtok_r(path, ":", &saveptr); dir;
               ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../app/src/sys/unix/command.c:39:17: warning: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
            dir = strtok_r(NULL, ":", &saveptr)) {
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 warnings and 3 errors generated.
ninja: build stopped: subcommand failed.

@rom1v
Copy link
Collaborator

rom1v commented Dec 10, 2020

Thank you 👍

I just changed the comment to add strdup() and strtok_r(): pr1960

I'll merge it soon :)

rom1v pushed a commit that referenced this pull request Dec 10, 2020
PR #1960 <#1960>

Signed-off-by: Romain Vimont <[email protected]>
rom1v pushed a commit that referenced this pull request Dec 12, 2020
PR #1960 <#1960>

Signed-off-by: Romain Vimont <[email protected]>
@rom1v
Copy link
Collaborator

rom1v commented Dec 12, 2020

Merged d6078cf

@rom1v rom1v closed this Dec 12, 2020
@rom1v rom1v mentioned this pull request Jan 3, 2021
@rom1v
Copy link
Collaborator

rom1v commented Jan 8, 2021

@mqiezi Could you please test/review the feature_test_macro branch, please? (commit 7ad8354)

@mqiezi
Copy link
Author

mqiezi commented Jan 11, 2021

I have tested the feature_test_macro branch. No errors found. @ rom1v

@rom1v
Copy link
Collaborator

rom1v commented Jan 11, 2021

Thank you for your test 👍

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