Bug 246975 - comms/scrcpy: fix build on GCC architectures
Summary: comms/scrcpy: fix build on GCC architectures
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Hiroki Tagato
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-04 10:30 UTC by Piotr Kubaj
Modified: 2020-06-06 09:32 UTC (History)
1 user (show)

See Also:
tagattie: maintainer-feedback+


Attachments
patch (859 bytes, patch)
2020-06-04 10:30 UTC, Piotr Kubaj
tagattie: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer freebsd_triage 2020-06-04 10:30:42 UTC
Created attachment 215223 [details]
patch

When building on head (on powerpc64) with Clang the following warnings happen:
../app/src/sys/unix/command.c: In function 'cmd_search':
../app/src/sys/unix/command.c:31:12: warning: implicit declaration of function 'strdup'; did you mean 'strcmp'? [-Wimplicit-function-declaration]
   31 |     path = strdup(path);
      |            ^~~~~~
      |            strcmp
../app/src/sys/unix/command.c:31:10: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   31 |     path = strdup(path);
      |          ^
../app/src/sys/unix/command.c:38:22: warning: implicit declaration of function 'strtok_r'; did you mean 'strtok'? [-Wimplicit-function-declaration]
   38 |     for (char *dir = strtok_r(path, ":", &saveptr); dir;
      |                      ^~~~~~~~
      |                      strtok
../app/src/sys/unix/command.c:38:22: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
../app/src/sys/unix/command.c:38:5: error: declaration of non-variable 'strtok_r' in 'for' loop initial declaration
   38 |     for (char *dir = strtok_r(path, ":", &saveptr); dir;
      |     ^~~
../app/src/sys/unix/command.c:39:17: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   39 |             dir = strtok_r(NULL, ":", &saveptr)) {
      |                 ^

Incidentally, they are fatal when building with GCC (on 12.1, powerpc64):
../app/src/sys/unix/command.c: In function 'cmd_search':
../app/src/sys/unix/command.c:31:12: warning: implicit declaration of function 'strdup'; did you mean 'strcmp'? [-Wimplicit-function-declaration]
   31 |     path = strdup(path);
      |            ^~~~~~
      |            strcmp
../app/src/sys/unix/command.c:31:10: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   31 |     path = strdup(path);
      |          ^
../app/src/sys/unix/command.c:38:22: warning: implicit declaration of function 'strtok_r'; did you mean 'strtok'? [-Wimplicit-function-declaration]
   38 |     for (char *dir = strtok_r(path, ":", &saveptr); dir;
      |                      ^~~~~~~~
      |                      strtok
../app/src/sys/unix/command.c:38:22: warning: initialization of 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
../app/src/sys/unix/command.c:38:5: error: declaration of non-variable 'strtok_r' in 'for' loop initial declaration
   38 |     for (char *dir = strtok_r(path, ":", &saveptr); dir;
      |     ^~~
../app/src/sys/unix/command.c:39:17: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   39 |             dir = strtok_r(NULL, ":", &saveptr)) {
      |                 ^

Undefine _POSIX_SOURCE to fix it.
Comment 1 commit-hook freebsd_committer freebsd_triage 2020-06-06 09:31:33 UTC
A commit references this bug:

Author: tagattie
Date: Sat Jun  6 09:31:30 UTC 2020
New revision: 538080
URL: https://svnweb.freebsd.org/changeset/ports/538080

Log:
  Fix build on GCC architectures

  PR:		246975
  Submitted by:	pkubaj
  Approved by:	mentors (implicit)

Changes:
  head/comms/scrcpy/files/
  head/comms/scrcpy/files/patch-app_src_sys_unix_command.c
Comment 2 Hiroki Tagato freebsd_committer freebsd_triage 2020-06-06 09:32:55 UTC
Committed, thanks!