Skip to content

Conversation

@fanquake
Copy link
Member

@fanquake fanquake commented Dec 24, 2019

clock_gettime(), CLOCK_MONOTONIC and CLOCK_REALTIME are all available for use on
macOS (now that we require macOS >=10.12 and build against 10.14). Use them rather than the deprecated mach_timespec_t time API.

I mentioned the possibility for this change in #17270.

master:

2019-12-23T20:49:43Z Feeding 216 bytes of dynamic environment data into RNG
2019-12-23T20:50:43Z Feeding 216 bytes of dynamic environment data into RNG

This PR:

2019-12-23T20:32:41Z Feeding 232 bytes of dynamic environment data into RNG
2019-12-23T20:33:42Z Feeding 232 bytes of dynamic environment data into RNG

Depends on #16392. Merged.

@sipa
Copy link
Member

sipa commented Dec 24, 2019

Concept ACK

@fanquake
Copy link
Member Author

Note that the build failure in the macOS 10.12 build is because we are still building against the 10.11 SDK, which doesn't contain the required clock functions. Bumping to the 10.14 SDK is being done in #16392.

randomenv.cpp:240:21: error: unused variable 'ts' [-Werror,-Wunused-variable]
    struct timespec ts = {};
                    ^
1 error generated.
Makefile:9345: recipe for target 'libbitcoin_util_a-randomenv.o' failed

@sanjaykdragon
Copy link
Contributor

ACK 4738d99: good change, but would this cause issues for backwards compatibility?

@laanwj
Copy link
Member

laanwj commented Jan 4, 2020

MacOS 10.12: oh, so this depends on #16392, good to know, added to OP

/usr/bin/ccache /home/travis/build/bitcoin/bitcoin/depends/x86_64-apple-darwin16/native/bin/clang++ -target x86_64-apple-darwin16 -mmacosx-version-min=10.12 --sysroot /home/travis/build/bitcoin/bitcoin/depends/SDKs/MacOSX10.11.sdk -mlinker-version=253.9 -stdlib=libc++ -std=c++11 -DHAVE_CONFIG_H -I. -I../src/config   -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -I.  -DBOOST_SP_USE_STD_ATOMIC -DBOOST_AC_USE_STD_ATOMIC -pthread -I/home/travis/build/bitcoin/bitcoin/depends/x86_64-apple-darwin16/share/../include -I./leveldb/include -I./leveldb/helpers/memenv -I./secp256k1/include -I./univalue/include -Qunused-arguments -I/home/travis/build/bitcoin/bitcoin/depends/x86_64-apple-darwin16/share/../include/  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0  -Wstack-protector -fstack-protector-all   -Werror=vla -Werror=switch -Werror=thread-safety-analysis -Werror=unused-variable    -pipe -O2  -fvisibility=hidden -c -o libbitcoin_util_a-randomenv.o `test -f 'randomenv.cpp' || echo './'`randomenv.cpp

randomenv.cpp:240:21: error: unused variable 'ts' [-Werror,-Wunused-variable]

    struct timespec ts = {};

                    ^

1 error generated.

@laanwj
Copy link
Member

laanwj commented Feb 5, 2020

Restarted Travis now that #16392 is in.

but would this cause issues for backwards compatibility?

Luckily, that tends to not really an issue for MacOS users.

clock_gettime(), CLOCK_MONOTONIC and CLOCK_REALTIME are all available for use on
macOS (now that we require macOS >=10.12). Use them rather than the deprecated
mach_timespec_t time API.

master:
2019-12-23T20:49:43Z Feeding 216 bytes of dynamic environment data into RNG
2019-12-23T20:50:43Z Feeding 216 bytes of dynamic environment data into RNG

this commit:
2019-12-23T20:32:41Z Feeding 232 bytes of dynamic environment data into RNG
2019-12-23T20:33:42Z Feeding 232 bytes of dynamic environment data into RNG
@fanquake fanquake force-pushed the random_macos_clocks branch from 4738d99 to dc9305b Compare February 6, 2020 01:47
@fanquake
Copy link
Member Author

fanquake commented Feb 6, 2020

The macOS builds looked ok, but I've rebased to fix two unrelated Travis errors. Should be all green shortly.

@DrahtBot
Copy link
Contributor

Gitian builds

File commit 2a2631f
(master)
commit 068842a90b80b2cf09cd764f37e20f300f9a8892
(master and this pull)
bitcoin-0.19.99-aarch64-linux-gnu-debug.tar.gz 51392e3413128845... a67e8e35111fdd9e...
bitcoin-0.19.99-aarch64-linux-gnu.tar.gz 9c68060f909b176a... 1c2f351a67e49c90...
bitcoin-0.19.99-arm-linux-gnueabihf-debug.tar.gz a4c6bc9d98b02c39... 063e024ae4f2ac86...
bitcoin-0.19.99-arm-linux-gnueabihf.tar.gz 91c276c85c6ea8f0... 4f311d98ebd0f77f...
bitcoin-0.19.99-osx-unsigned.dmg 71c8478f6158f433... 15d05fd11ac521c5...
bitcoin-0.19.99-osx64.tar.gz e9f498c9b0694e08... a2a45cbfb530f19b...
bitcoin-0.19.99-riscv64-linux-gnu-debug.tar.gz e53b974b60b018a7... 07e22acff6843c58...
bitcoin-0.19.99-riscv64-linux-gnu.tar.gz 3ae4b4f4bf44d8ed... cd3ec14377490b08...
bitcoin-0.19.99-win64-debug.zip 88fc928933abadaf... 3bdaa28ca467642a...
bitcoin-0.19.99-win64-setup-unsigned.exe 78c96ebfdbda69a3... d8808da2ebc9c5d3...
bitcoin-0.19.99-win64.zip be3e701005cfa682... dcb36a978a3b0fa7...
bitcoin-0.19.99-x86_64-linux-gnu-debug.tar.gz bdbbb809f6569067... 1418700e7c348fc9...
bitcoin-0.19.99-x86_64-linux-gnu.tar.gz 185e77d19a57404c... 2cd1930aceed0923...
bitcoin-0.19.99.tar.gz bd8f4dff76b14fe8... 7bdf831bdf018172...
bitcoin-core-linux-0.20-res.yml c3a41885d43ad9c1... 77c98388238cc921...
bitcoin-core-osx-0.20-res.yml 2ea28d851bd7def3... d53a6cba9dc61463...
bitcoin-core-win-0.20-res.yml db5c46d54aa23a95... 79fd45237150c4a6...
linux-build.log 67c5b5639d5edc84... 8da29ad907b7ac2c...
osx-build.log 635adff0cbd384f3... 924396cfb5f03fe2...
win-build.log f9061ed05f12c5c0... 96e602189eb0613e...
bitcoin-core-linux-0.20-res.yml.diff 000127fd53902ea0...
bitcoin-core-osx-0.20-res.yml.diff 706ff787ca84c901...
bitcoin-core-win-0.20-res.yml.diff 039f57a3c4ef7c12...
linux-build.log.diff 0613df3736b31f9d...
osx-build.log.diff 090a6bcd3af0d7dc...
win-build.log.diff 6efca77f01f918c5...

@laanwj
Copy link
Member

laanwj commented Feb 28, 2020

ACK dc9305b

@laanwj laanwj merged commit 1a51cd1 into bitcoin:master Feb 28, 2020
@fanquake fanquake deleted the random_macos_clocks branch February 28, 2020 21:56
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 29, 2020
dc9305b random: don't special case clock usage on macOS (fanquake)

Pull request description:

  `clock_gettime()`, `CLOCK_MONOTONIC` and `CLOCK_REALTIME` are all available for use on
  macOS (now that we require macOS >=10.12 and build against 10.14). Use them rather than the [deprecated](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/Mach/Mach.html) `mach_timespec_t` time API.

  I mentioned the possibility for this change [in bitcoin#17270](bitcoin#17270 (comment)).

  [master](1dbf335):
  ```bash
  2019-12-23T20:49:43Z Feeding 216 bytes of dynamic environment data into RNG
  2019-12-23T20:50:43Z Feeding 216 bytes of dynamic environment data into RNG
  ```

  This PR:
  ```bash
  2019-12-23T20:32:41Z Feeding 232 bytes of dynamic environment data into RNG
  2019-12-23T20:33:42Z Feeding 232 bytes of dynamic environment data into RNG
  ```

  ~~Depends on bitcoin#16392.~~ Merged.

ACKs for top commit:
  laanwj:
    ACK dc9305b

Tree-SHA512: 18c2f336ea628f9cf7339b817381d230a18893fd9c0351bf99a39ca6f45c5b0a20af9d599d48d6c09515627d5edafa91337c17f9f790264251d2cdcb3763bbd5
fanquake added a commit that referenced this pull request Feb 29, 2020
d361460 Drop unused mach time headers (Ben Woosley)

Pull request description:

  Now that we're no longer special-casing clock usage for MacOS (see #17800), we're
  not referencing anything defined in these headers.

  Incidentally, this removes our last reference to the `__MACH__` system def. 🎉

ACKs for top commit:
  jonasschnelli:
    utACK d361460
  fanquake:
    ACK d361460 - thanks.

Tree-SHA512: 246045b0683a705ad034416e8ace2024e652026a6c0517b6797320e52fc18a6e111ec2e405ca40653bd1d6421bb7755232e8fec22651fff8e448eb7d5646a954
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Feb 29, 2020
d361460 Drop unused mach time headers (Ben Woosley)

Pull request description:

  Now that we're no longer special-casing clock usage for MacOS (see bitcoin#17800), we're
  not referencing anything defined in these headers.

  Incidentally, this removes our last reference to the `__MACH__` system def. 🎉

ACKs for top commit:
  jonasschnelli:
    utACK d361460
  fanquake:
    ACK d361460 - thanks.

Tree-SHA512: 246045b0683a705ad034416e8ace2024e652026a6c0517b6797320e52fc18a6e111ec2e405ca40653bd1d6421bb7755232e8fec22651fff8e448eb7d5646a954
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
dc9305b random: don't special case clock usage on macOS (fanquake)

Pull request description:

  `clock_gettime()`, `CLOCK_MONOTONIC` and `CLOCK_REALTIME` are all available for use on
  macOS (now that we require macOS >=10.12 and build against 10.14). Use them rather than the [deprecated](https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/Mach/Mach.html) `mach_timespec_t` time API.

  I mentioned the possibility for this change [in bitcoin#17270](bitcoin#17270 (comment)).

  [master](1dbf335):
  ```bash
  2019-12-23T20:49:43Z Feeding 216 bytes of dynamic environment data into RNG
  2019-12-23T20:50:43Z Feeding 216 bytes of dynamic environment data into RNG
  ```

  This PR:
  ```bash
  2019-12-23T20:32:41Z Feeding 232 bytes of dynamic environment data into RNG
  2019-12-23T20:33:42Z Feeding 232 bytes of dynamic environment data into RNG
  ```

  ~~Depends on bitcoin#16392.~~ Merged.

ACKs for top commit:
  laanwj:
    ACK dc9305b

Tree-SHA512: 18c2f336ea628f9cf7339b817381d230a18893fd9c0351bf99a39ca6f45c5b0a20af9d599d48d6c09515627d5edafa91337c17f9f790264251d2cdcb3763bbd5
sidhujag pushed a commit to syscoin-core/syscoin that referenced this pull request Nov 10, 2020
d361460 Drop unused mach time headers (Ben Woosley)

Pull request description:

  Now that we're no longer special-casing clock usage for MacOS (see bitcoin#17800), we're
  not referencing anything defined in these headers.

  Incidentally, this removes our last reference to the `__MACH__` system def. 🎉

ACKs for top commit:
  jonasschnelli:
    utACK d361460
  fanquake:
    ACK d361460 - thanks.

Tree-SHA512: 246045b0683a705ad034416e8ace2024e652026a6c0517b6797320e52fc18a6e111ec2e405ca40653bd1d6421bb7755232e8fec22651fff8e448eb7d5646a954
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 4, 2021
Summary:
clock_gettime(), CLOCK_MONOTONIC and CLOCK_REALTIME are all available for use on
macOS (now that we require macOS >=10.12). Use them rather than the deprecated
mach_timespec_t time API.

master:
2019-12-23T20:49:43Z Feeding 216 bytes of dynamic environment data into RNG
2019-12-23T20:50:43Z Feeding 216 bytes of dynamic environment data into RNG

this commit:
2019-12-23T20:32:41Z Feeding 232 bytes of dynamic environment data into RNG
2019-12-23T20:33:42Z Feeding 232 bytes of dynamic environment data into RNG

Note: ABC dropped support for MacOS < 10.12 in 0.21.3

This is a backport of Core [[bitcoin/bitcoin#17800 | PR17800]]

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8774
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants