classification
Title: bluetooth.h on big endian needs GNU C extensions
Type: compile error Stage: resolved
Components: Extension Modules Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder: PPC64 Fedora socket and ssl compile failure
View: 28013
Assigned To: Nosy List: benjamin.peterson, christian.heimes, martin.panter, python-dev
Priority: critical Keywords:

Created on 2016-09-08 09:31 by christian.heimes, last changed 2016-09-10 01:08 by martin.panter. This issue is now closed.

Messages (10)
msg274990 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-08 09:31
PPC Fedora build bot is not able to build the _ssl and _socket module. It looks like bluetooth.h is not compatible with std=c99. It uses some GNU C extensions like __extension__, __attribute__((packed)) and __typeof__. The C99 variant -std=gnu99 should do the trick.

http://buildbot.python.org/all/builders/PPC64%20Fedora%203.x/builds/1527/steps/test/logs/stdio

In file included from /usr/include/bluetooth/bluetooth.h:37:0,
                 from /home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64/build/Modules/socketmodule.h:58,
                 from /home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64/build/Modules/socketmodule.c:321:
/usr/include/bluetooth/bluetooth.h: In function ‘bt_get_le64’:
/usr/include/bluetooth/bluetooth.h:238:18: error: expected specifier-qualifier-list before ‘typeof’
  return bswap_64(bt_get_unaligned((const uint64_t *) ptr));
                  ^
/usr/include/bluetooth/bluetooth.h:238:18: error: called object is not a function or function pointer
  return bswap_64(bt_get_unaligned((const uint64_t *) ptr));
                  ^
/usr/include/bluetooth/bluetooth.h:238:18: error: ‘struct <anonymous>’ has no member named ‘__v’
  return bswap_64(bt_get_unaligned((const uint64_t *) ptr));
msg274991 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-08 09:37
I don’t have access to the buildbot. Are you sure it uses __typeof__? The error message says “typeof” without the underscores. I suspect that it would work with the underscores.
msg274992 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-08 09:39
New changeset b5b2bb56d303 by Christian Heimes in branch 'default':
Issue 28017: Use -std=gnu99 to get C99 with GNU extensions for bluetooth.h on big endian.
https://hg.python.org/cpython/rev/b5b2bb56d303
msg274993 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-08 09:41
Let's give it a try.
msg274996 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-08 09:49
It compiles now. Sorry for the duplicate ticket.
msg275100 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2016-09-08 18:17
Hmm, I prefer to compile with stdc99. I wonder if we should consider
this (presumably quite old) bluetooth.h to not exist if it doesn't work
with c99.

On Thu, Sep 8, 2016, at 02:49, Christian Heimes wrote:
> 
> Christian Heimes added the comment:
> 
> It compiles now. Sorry for the duplicate ticket.
> 
> ----------
> resolution:  -> fixed
> stage: needs patch -> resolved
> status: open -> closed
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue28017>
> _______________________________________
msg275102 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2016-09-08 18:25
I checked my local bluetooth.h. It looks like it won't compile on big endian platforms either.

Python uses some GCC features like __attribute__. Do they all work in C99 mode?
msg275103 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2016-09-08 18:32
stc99 means "C99 + GCC extensions that aren't incompatible with the
standard". gnuc99 means "sort of C99 with whatever GNU weirdness"

On Thu, Sep 8, 2016, at 11:25, Christian Heimes wrote:
> 
> Christian Heimes added the comment:
> 
> I checked my local bluetooth.h. It looks like it won't compile on big
> endian platforms either.
> 
> Python uses some GCC features like __attribute__. Do they all work in C99
> mode?
> 
> ----------
> 
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue28017>
> _______________________________________
msg275354 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-09 17:23
New changeset 91017e2202ae by Benjamin Peterson in branch 'default':
compile with -std=c99 instead of -std=gnu99; use kiddie-gloves with bluetooth/bluetooh.h (#28017)
https://hg.python.org/cpython/rev/91017e2202ae
msg275523 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-09-10 01:08
For the record (and my curiosity) I think the header file was fixed in 2014:
https://git.kernel.org/cgit/bluetooth/bluez.git/commit?id=cf52a40
History
Date User Action Args
2016-09-10 01:08:38martin.pantersetmessages: + msg275523
2016-09-09 17:23:29python-devsetmessages: + msg275354
2016-09-08 18:32:29benjamin.petersonsetmessages: + msg275103
2016-09-08 18:25:22christian.heimessetmessages: + msg275102
2016-09-08 18:17:07benjamin.petersonsetmessages: + msg275100
2016-09-08 09:49:18christian.heimessetstatus: open -> closed
resolution: fixed
messages: + msg274996

stage: needs patch -> resolved
2016-09-08 09:41:07christian.heimessetmessages: + msg274993
2016-09-08 09:39:51python-devsetnosy: + python-dev
messages: + msg274992
2016-09-08 09:37:48martin.pantersetsuperseder: PPC64 Fedora socket and ssl compile failure

messages: + msg274991
nosy: + martin.panter
2016-09-08 09:31:34christian.heimescreate