homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: On macOS Sierra, warning: implicit declaration of function 'getentropy'
Type: compile error Stage: resolved
Components: Build, macOS Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gdr@garethrees.org, ned.deily, python-dev, ronaldoussoren
Priority: normal Keywords: patch

Created on 2016年11月12日 19:30 by gdr@garethrees.org, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
getentropy.patch gdr@garethrees.org, 2016年11月12日 19:30 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017年03月31日 16:36
Messages (3)
msg280669 - (view) Author: Gareth Rees (gdr@garethrees.org) * (Python triager) Date: 2016年11月12日 19:30
On macOS Sierra (OSX 10.12.1):
 $ ./configure --with-pydebug && make
 [... lots of output omitted ...]
 gcc -c -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -I. -I./Include -DPy_BUILD_CORE -o Python/random.o Python/random.c
 Python/random.c:97:19: warning: implicit declaration of function 'getentropy' is
 invalid in C99 [-Wimplicit-function-declaration]
 res = getentropy(buffer, len);
 ^
 1 warning generated.
This is because OSX 10.12.1 has getentropy() but does not have
getrandom(). You can see this in pyconfig.h:
 /* Define to 1 if you have the `getentropy' function. */
 #define HAVE_GETENTROPY 1
 /* Define to 1 if the getrandom() function is available */
 /* #undef HAVE_GETRANDOM */
and this means that in Python/random.c the header <sys/random.h> is
not included:
 # ifdef HAVE_GETRANDOM
 # include <sys/random.h>
 # elif defined(HAVE_GETRANDOM_SYSCALL)
 # include <sys/syscall.h>
 # endif
It's necessary include <sys/random.h> if either HAVE_GETRANDOM or
HAVE_GETENTROPY is defined.
msg280672 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016年11月12日 21:40
New changeset 828251c2bccf by Ned Deily in branch '2.7':
Issue #28676: Prevent missing 'getentropy' declaration warning on macOS.
https://hg.python.org/cpython/rev/828251c2bccf
New changeset 0efd48d4c47c by Ned Deily in branch '3.5':
Issue #28676: Prevent missing 'getentropy' declaration warning on macOS.
https://hg.python.org/cpython/rev/0efd48d4c47c
New changeset e2faa8a22b69 by Ned Deily in branch '3.6':
Issue #28676: merge from 3.5
https://hg.python.org/cpython/rev/e2faa8a22b69
New changeset b31a7efd8b31 by Ned Deily in branch 'default':
Issue #28676: merge from 3.6
https://hg.python.org/cpython/rev/b31a7efd8b31 
msg280674 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016年11月12日 21:43
Thanks for the patch, Gareth! Pushed for release in 2.7.13, 3.5.3, 3.6.0b4, and 3.7.0.
History
Date User Action Args
2022年04月11日 14:58:39adminsetgithub: 72862
2017年03月31日 16:36:38dstufftsetpull_requests: + pull_request1105
2016年11月12日 21:43:39ned.deilysetstatus: open -> closed
versions: + Python 2.7, Python 3.5, Python 3.6
messages: + msg280674

resolution: fixed
stage: resolved
2016年11月12日 21:40:41python-devsetnosy: + python-dev
messages: + msg280672
2016年11月12日 19:30:20gdr@garethrees.orgcreate

AltStyle によって変換されたページ (->オリジナル) /