From owner-freebsd-python@freebsd.org Sat Jan 26 11:36:21 2019 Return-Path: Delivered-To: freebsd-python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7638814BF797 for ; Sat, 26 Jan 2019 11:36:21 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 3E75D75F1A for ; Sat, 26 Jan 2019 11:36:20 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id F095614BF796; Sat, 26 Jan 2019 11:36:19 +0000 (UTC) Delivered-To: python@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDF9414BF795 for ; Sat, 26 Jan 2019 11:36:19 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3C1A175F19 for ; Sat, 26 Jan 2019 11:36:19 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pl1-x62e.google.com with SMTP id e5so5726945plb.5 for ; Sat, 26 Jan 2019 03:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/rBGWn+SCh3JTpJXbodouDUlZ8WZAnBXhFyq9ierN5w=; b=oTnPL/BLKbioqUC1DYOGV5Bcvm/U2MQAA2BPAFLBL0aehGIvNgcuwJwqzZ9RyyjgnZ y2cSSzrndWJV2YB/4covyWXg4JVRHOoe5FAxRlDsf17Ou5/uFXKGiFm5qs2IWW8nVq/1 bt/iUZ0Q4owWd58YCQTi1R0YxXDAlehLZodrwjSdn27c7d28x9pwuae2HT3bV/aaP86p QTcxTVvJK8Crzhr/8N42VriiTX2mYlZPC5Q6oKBkWDGGnKXOjzzGvhKGsTt2MIwJbkTe 3BFh8UD09G8Au0UV9xy4flE1SlENZoABx5Jfr7RDPWuZ3BbZ+0fHYuQyZiIIqtJgkyWt Ysmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=/rBGWn+SCh3JTpJXbodouDUlZ8WZAnBXhFyq9ierN5w=; b=rG+CZWAgkpfms4PGLpP9g0y1+ijQ91AEdDnAWap1r5AVQd9s+FYqu08/QhL29VY+uP gUELv5M+bzYD48fZvCrKs9qM1Cd2d2i+uRwefknom6ZbBWIaimiCOY9cXmSvuaIkmfAM GwTuTm6jVjc8+Yi7OkGfmzALWtZfUVKdKAYR9YNfPv3U9M91cB8gKxVS86qq/5tETIHm xVv2anZkLK5nPu4yRrvR2bFuKkznvXDmV2tM+HFXNsvoFgM/WrZr4km5smibC02XUeah s3W2Z6SwTYDlaPMPPD9avMImTCEtRsVYUIH2PgRNpRmA9qTh5HIqO28x7Oq3lvLuQmrV l+hA== X-Gm-Message-State: AJcUukePwv48k4wm4hWFD6AMDw81ckTIxBulDRSanJfKHpw1aM/M7T6x VEO0/q3ACVZ/Vz/n/v2eMzSXkWbI X-Google-Smtp-Source: ALg8bN6WxMhRkX5NLV63oc3dvkOgIbMfcb73ZBDdZX9vdBpF+K13GQKMK3GPA6EjeThgqXAsw0I0Gw== X-Received: by 2002:a17:902:b592:: with SMTP id a18mr14788339pls.293.1548502577802; Sat, 26 Jan 2019 03:36:17 -0800 (PST) Received: from [192.168.1.105] (119-18-15-55.77120f.syd.nbn.aussiebb.net. [119.18.15.55]) by smtp.gmail.com with ESMTPSA id m67sm45871840pfb.25.2019.01.26.03.36.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Jan 2019 03:36:17 -0800 (PST) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: Problem with pyconfig.h in python36 which is already solved for python27 To: Stefan Metzmacher , python@FreeBSD.org References: From: Kubilay Kocak Message-ID: Date: Sat, 26 Jan 2019 22:36:14 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Thunderbird/65.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 3C1A175F19 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: freebsd-python@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD-specific Python issues List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jan 2019 11:36:21 -0000 On 26/01/2019 10:07 pm, Stefan Metzmacher via freebsd-python wrote: > Hi, > > in Samba we recently switched to use python3 by default. But this breaks > the build on FreeBSD (at least 11.1 and 12.0). In order to be most > portable, we have a policy in Samba to include as the > first header when creating python bindings. It means pyconfig.h and > various system headers are included before our own config.h. > A detailed way to reproduce this can be found at the end of this mail. > > The problem is that pyconfig.h defines > _POSIX_C_SOURCE, __BSD_VISIBLE, _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED. > > This seems to be fixed for python27 in this commit: > https://github.com/freebsd/freebsd-ports/commit/4b17dd9aeb9b28759551f38bf0f6b0edcac88607 > which added lang/python27/files/patch-pr192365. > > Could this be fixed for all python versions? Hi Stefan, The commit was added via: x11-toolkits/py-wxPython30 build fails https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192365 A similar issue (if not the same), reported upstream here: https://bugs.python.org/issue17120 I don't see any issues with carrying the same change in other python ports, *but* we'd all like to see it resolved permanently upstream. In order of preference, to progress we'd need: 1) Upstream patches submitted against master, 3.7, 3.6, 2.7 so upstream can resolve this completely, commits/merges from which we can backport to our python ports. or 2) Patches against lang/pythonXY ports similar to python27, which may not be suitable for upstreaming *as is* (freebsd-specific?) Along with either of those, create a new bug in Bugzilla to track this too, with summary like "lang/python3*: " adding bug 192365 to "See Also" I'm happy to put in the cycles to backport commits from (1) if we can get the root of the issue solved upstream. Thanks for the detailed report. ./koobs > An alternative fix for this specific problem would be > defining __STDC_WANT_LIB_EXT1__ in pyconfig.h, > but I don't know the reason for lang/python27/files/patch-pr192365 > and I guess it's better to have the same fix for all python versions. > > Is this the correct channel to report this problem? > > Thanks in advance! > metze > > This is a standalone way to reproduce the problem: > > $ cat memset_s.c > #include > #include > int main(void) > { > char array[5] = { 1, }; > memset_s(array, 5, 0, 5); > return 0; > } > > $ gcc -o memset_s.exe memset_s.c -I /usr/local/include/python2.7/ > > $ gcc -o memset_s.exe memset_s.c -I /usr/local/include/python3.6m/ > memset_s.c: In function 'main': > memset_s.c:6:2: warning: implicit declaration of function 'memset_s'; > did you mean 'memset'? [-Wimplicit-function-declaration] > memset_s(array, 5, 0, 5); > ^~~~~~~~ > memset > > $ gcc -o memset_s.exe memset_s.c -I ./python3.6m/ > $ diff -Npur /usr/local/include/python3.6m/ ./python3.6m/ > diff -Npur /usr/local/include/python3.6m/pyconfig.h ./python3.6m/pyconfig.h > --- /usr/local/include/python3.6m/pyconfig.h 2019-01-10 > 02:17:29.000000000 +0100 > +++ ./python3.6m/pyconfig.h 2019-01-25 23:14:09.425842000 +0100 > @@ -1478,7 +1478,7 @@ > /* #undef _POSIX_1_SOURCE */ > > /* Define to activate features from IEEE Stds 1003.1-2008 */ > -#define _POSIX_C_SOURCE 200809L > +//#define _POSIX_C_SOURCE 200809L > > /* Define to 1 if you need to in order for `stat' and other things to > work. */ > /* #undef _POSIX_SOURCE */ > @@ -1490,13 +1490,13 @@ > #define _REENTRANT 1 > > /* Define to the level of X/Open that your system supports */ > -#define _XOPEN_SOURCE 700 > +//#define _XOPEN_SOURCE 700 > > /* Define to activate Unix95-and-earlier features */ > -#define _XOPEN_SOURCE_EXTENDED 1 > +//#define _XOPEN_SOURCE_EXTENDED 1 > > /* Define on FreeBSD to activate all library features */ > -#define __BSD_VISIBLE 1 > +//#define __BSD_VISIBLE 1 > > /* Define to 1 if type `char' is unsigned and you are not using gcc. */ > #ifndef __CHAR_UNSIGNED__ > > > > $ gcc -o memset_s.exe memset_s.c -I ./python3.6m.fix2/ > $ diff -Npur /usr/local/include/python3.6m/ ./python3.6m.fix2/ > diff -Npur /usr/local/include/python3.6m/pyconfig.h > ./python3.6m.fix2/pyconfig.h > --- /usr/local/include/python3.6m/pyconfig.h 2019-01-10 > 02:17:29.000000000 +0100 > +++ ./python3.6m.fix2/pyconfig.h 2019-01-25 23:43:59.350194000 +0100 > @@ -1498,6 +1498,8 @@ > /* Define on FreeBSD to activate all library features */ > #define __BSD_VISIBLE 1 > > +#define __STDC_WANT_LIB_EXT1__ 1 > + > /* Define to 1 if type `char' is unsigned and you are not using gcc. */ > #ifndef __CHAR_UNSIGNED__ > /* # undef __CHAR_UNSIGNED__ */ > >