Bug 268302 - astro/cfitsio: fix build with clang 15
Summary: astro/cfitsio: fix build with clang 15
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-10 18:06 UTC by Dimitry Andric
Modified: 2022-12-18 17:48 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments
astro/cfitsio: fix build with clang 15 (1.51 KB, patch)
2022-12-10 18:07 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2022-12-10 18:06:53 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that astro/cfitsio failed to build with clang 15:

  drvrnet.c:3887:23: warning: call to undeclared function 'gethostbyname'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
              hostent = gethostbyname(localhost);
                        ^
  drvrnet.c:3887:21: error: incompatible integer to pointer conversion assigning to 'struct hostent *' from 'int' [-Wint-conversion]
              hostent = gethostbyname(localhost);
                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~
  1 warning and 1 error generated.

This is because the configure script defines _XOPEN_SOURCE=700, for unclear reasons, and this hides the gethostbyname() declaration in /usr/include/netdb.h. Fix it by removing the line that adds the define.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-10 18:07:15 UTC
Created attachment 238697 [details]
astro/cfitsio: fix build with clang 15
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-12-18 17:44:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7eda11c87c30c735058e9393d54b631a74cf566a

commit 7eda11c87c30c735058e9393d54b631a74cf566a
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-10 18:03:37 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-12-18 17:32:40 +0000

    astro/cfitsio: fix build with clang 15

    During an exp-run for llvm 15 (see bug 265425), it turned out that
    astro/cfitsio failed to build with clang 15:

      drvrnet.c:3887:23: warning: call to undeclared function 'gethostbyname'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                  hostent = gethostbyname(localhost);
                            ^
      drvrnet.c:3887:21: error: incompatible integer to pointer conversion assigning to 'struct hostent *' from 'int' [-Wint-conversion]
                  hostent = gethostbyname(localhost);
                          ^ ~~~~~~~~~~~~~~~~~~~~~~~~
      1 warning and 1 error generated.

    This is because the configure script defines _XOPEN_SOURCE=700, for
    unclear reasons, and this hides the gethostbyname() declaration in
    /usr/include/netdb.h. Fix it by removing the line that adds the define.

    PR:             268302
    Approved by:    portmgr (tcberner)
    MFH:            2022Q4

 astro/cfitsio/Makefile | 1 +
 1 file changed, 1 insertion(+)