Bug 29113 - Build error for x86_64-w64-mingw32 host since CLOCK_MONOTONIC does not exist
Summary: Build error for x86_64-w64-mingw32 host since CLOCK_MONOTONIC does not exist
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gprofng (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Vladimir Mezentsev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-02 06:26 UTC by cqwrteur
Modified: 2022-06-22 21:47 UTC (History)
1 user (show)

See Also:
Host: x86_64-w64-mingw32
Target: x86_64-ubuntu-linux-gnu
Build: x86_64-linux-gnu
Last reconfirmed: 2022-05-02 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cqwrteur 2022-05-02 06:26:13 UTC
../../../../../../binutils-gdb/gprofng/libcollector/gethrtime.c: In function 'linux_gethrtime':
../../../../../../binutils-gdb/gprofng/libcollector/gethrtime.c:38:11: warning: implicit declaration of function 'clock_gettime' [-Wimplicit-function-declaration]
   38 |   int r = clock_gettime (CLOCK_MONOTONIC, &tp);
      |           ^~~~~~~~~~~~~
../../../../../../binutils-gdb/gprofng/libcollector/gethrtime.c:38:26: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
   38 |   int r = clock_gettime (CLOCK_MONOTONIC, &tp);
      |                          ^~~~~~~~~~~~~~~
../../../../../../binutils-gdb/gprofng/libcollector/gethrtime.c:38:26: note: each undeclared identifier is reported only once for each function it appears in
Comment 1 cqwrteur 2022-05-02 06:31:57 UTC
i do canadian compilation for windows to build linux programs. gprofng simply does not correctly support windows host. Needs to block it in the build script
Comment 2 Vladimir Mezentsev 2022-05-02 17:59:29 UTC
 How do you configure your build ?

gprofng should not be built for x86_64-w64-mingw32.
Only these platforms are supported:

% cat gprofng/configure.ac
...
  case "${target}" in
    x86_64-*-linux*)
      build_src=true
      build_collector=true
      ;;
    i?86-*-linux*)
      build_collector=true
      build_collector=true
      ;;
    aarch64-*-linux*)
      build_src=true
      build_collector=true
      ;;
  esac
Comment 3 cqwrteur 2022-05-03 08:26:40 UTC
(In reply to Vladimir Mezentsev from comment #2)
>  How do you configure your build ?
> 
> gprofng should not be built for x86_64-w64-mingw32.
> Only these platforms are supported:
> 
> % cat gprofng/configure.ac
> ...
>   case "${target}" in
>     x86_64-*-linux*)
>       build_src=true
>       build_collector=true
>       ;;
>     i?86-*-linux*)
>       build_collector=true
>       build_collector=true
>       ;;
>     aarch64-*-linux*)
>       build_src=true
>       build_collector=true
>       ;;
>   esac

I do Canadian compilation for building cross back compiler. (Aka, the compiler is built on linux, hosted on windows, and targeting windows)

Here the bug is that if target is linux but host is windows, your configure script would still build collector.
Comment 4 cqwrteur 2022-05-03 08:27:26 UTC
(In reply to Vladimir Mezentsev from comment #2)
>  How do you configure your build ?
> 
> gprofng should not be built for x86_64-w64-mingw32.
> Only these platforms are supported:
> 
> % cat gprofng/configure.ac
> ...
>   case "${target}" in
>     x86_64-*-linux*)
>       build_src=true
>       build_collector=true
>       ;;
>     i?86-*-linux*)
>       build_collector=true
>       build_collector=true
>       ;;
>     aarch64-*-linux*)
>       build_src=true
>       build_collector=true
>       ;;
>   esac

the compiler runs on WINDOWS. but the compiled program runs on linux.

The build process is again on linux. It is a crossback Canadian toolchain.
Comment 5 cqwrteur 2022-05-03 08:28:01 UTC
(In reply to Vladimir Mezentsev from comment #2)
>  How do you configure your build ?
> 
> gprofng should not be built for x86_64-w64-mingw32.
> Only these platforms are supported:
> 
> % cat gprofng/configure.ac
> ...
>   case "${target}" in
>     x86_64-*-linux*)
>       build_src=true
>       build_collector=true
>       ;;
>     i?86-*-linux*)
>       build_collector=true
>       build_collector=true
>       ;;
>     aarch64-*-linux*)
>       build_src=true
>       build_collector=true
>       ;;
>   esac

case "${target}" in
is clearly wrong. It should be ${host}, not ${target}
Comment 6 Hans-Peter Nilsson 2022-05-03 22:07:08 UTC
(In reply to Vladimir Mezentsev from comment #2)
>  How do you configure your build ?
> 
> gprofng should not be built for x86_64-w64-mingw32.
> Only these platforms are supported:
> 
> % cat gprofng/configure.ac
> ...
>   case "${target}" in
>     x86_64-*-linux*)
>       build_src=true
>       build_collector=true
>       ;;
>     i?86-*-linux*)
>       build_collector=true
>       build_collector=true
>       ;;
>     aarch64-*-linux*)
>       build_src=true
>       build_collector=true
>       ;;
>   esac

Surely unrelated, but what's the effect of the apparent typo in the "i?86-*-linux*)" case?
Comment 7 Sourceware Commits 2022-05-05 17:26:13 UTC
The master branch has been updated by Vladimir Mezentsev <vmezents@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1653ae5b8440e2182ac86974b99b603bc15aa163

commit 1653ae5b8440e2182ac86974b99b603bc15aa163
Author: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Date:   Thu May 5 00:08:19 2022 -0700

    gprofng: use $host instead $target
    
    By mistake, $target was used instead of $host to configure the gprogng build.
    
    gprofng/ChangeLog
    2022-04-28  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
    
            PR gprofng/29113
            PR gprofng/29116
            * configure.ac: Use $host instead $target.
            * libcollector/configure.ac: Likewise.
            * configure: Rebuild.
            * libcollector/configure: Rebuild.
Comment 8 Vladimir Mezentsev 2022-06-07 00:08:41 UTC
Has the problem been fixed in your build ?
Comment 9 Vladimir Mezentsev 2022-06-22 21:47:50 UTC
Update status as resolved/fixed.