classification
Title: Python 3.7.0b5 build error
Type: compile error Stage: resolved
Components: Build Versions: Python 3.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: Manjusaka, ned.deily
Priority: normal Keywords:

Created on 2018-06-03 14:51 by Manjusaka, last changed 2018-06-04 04:31 by Manjusaka. This issue is now closed.

Messages (11)
msg318555 - (view) Author: Manjusaka (Manjusaka) * Date: 2018-06-03 14:51
When I build 3.70.b5 in Mac , the compiler raise an error show that 

"./Modules/posixmodule.c:6018:11: error: implicit declaration of function 'forkpty' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    pid = forkpty(&master_fd, NULL, NULL, NULL);"

the makefile was generated by './configuration" command without no argument.
msg318584 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-03 20:34
Have you run "xcode-select --install" to ensure system header files are installed?  If so, what compiler are you using from what source?  What version of macOS are you using?

https://devguide.python.org/setup/#macos
msg318601 - (view) Author: Manjusaka (Manjusaka) * Date: 2018-06-04 02:19
Sure, I already set "xcode-select --install" in terminal

Python 3.6.5 build success with a default setting when running ./configuration" command

Xcode version is 9.3

System version 10.13.4
msg318602 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-04 02:28
Sorry, I can't reproduce it and I do not recall every seeing a failure like that.

Just to be sure, you do mean ".configure" and not "./configuration"?

Perhaps you are picking up an old, third-party version of libutil from /usr/local/lib and/or /usr/local/include?  You have tried building from a clean directory?  It looks like the library is searched for at the following section of configure.ac (which is used to generate configure):

https://github.com/python/cpython/blob/v3.7.0b5/configure.ac#L3772
msg318606 - (view) Author: Manjusaka (Manjusaka) * Date: 2018-06-04 02:59
Actually, I found some interesting problem.

In Python 3.6.5 has declared the `extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);`  in here https://github.com/python/cpython/blob/3.6/Include/pyport.h#L532

and I add it into the Python 3.7.0b5's pyport.h, It builds success!
msg318607 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-04 03:09
That change should not have affected the macOS build.  Now that you have a working python, can you please run:

./python.exe -m test.pythoninfo

and report the results here?
msg318615 - (view) Author: Manjusaka (Manjusaka) * Date: 2018-06-04 03:52
The result in here 

https://gist.github.com/Zheaoli/86b04395748b998ad7d870a927a95aea
msg318616 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-04 04:04
The only really suspicious thing I see is that your shell PATH is *gigantic*. pulling things in from all over the place including Homebrew.  If you want to pursue further, suggest you try a clean build from the tarball without the modification and use a simple PATH like:

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

I'm willing to bet that some old versions of headers and/or libs are being picked up somewhere.  You probably should go through and permanently clean up that PATH.  Also make sure your Homebrew installation is up-to-date.  Rather than pulling in things from various places, consider pulling everything you need from Homebrew; it looks like you may have run various binary installers of various things in the past.  I'm going to close this issue.  Feel free to re-open if you discover something that appears to be a bug in Python.  Good luck!
msg318618 - (view) Author: Manjusaka (Manjusaka) * Date: 2018-06-04 04:11
it seems like what you say

but I think that you can't ensure everyone has a clean path especially when people use some tools such as pyenv or others to build Python from source code, but not get the binary package directly.

Anyway, it's just a personal idea. Thanks for what you do.
msg318619 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-06-04 04:17
As I said, I do not recall ever seeing a failure like this before and I regularly build and test Python on macOS in many different versions and environments.  It would be very time-consuming to try to debug your environment remotely, time that would be better spent on other problems, I'm afraid.  If you can demonstrate that the problem is with a clean version of pyenv, for example, then that's something to pursue with the pyenv project or here.  But, as it stands, there are so many ways things could have gone wrong for you that it would be foolish for me to try to guess.  Sorry!
msg318621 - (view) Author: Manjusaka (Manjusaka) * Date: 2018-06-04 04:31
Finally, I must say when I first build the Python 3.7.0b5, I don't use Pyenv or others tools.

As you say, It should be a PATH problem. I build success without no patch in a  clean Mac. I think I will figure out what's wrong.

But just as what I say, You can't ensure everyone has a clean PATH.

Anyway, Thanks for your helping!
History
Date User Action Args
2018-06-04 04:31:27Manjusakasetmessages: + msg318621
2018-06-04 04:17:01ned.deilysetmessages: + msg318619
2018-06-04 04:11:41Manjusakasetmessages: + msg318618
2018-06-04 04:04:57ned.deilysetstatus: open -> closed
resolution: works for me
messages: + msg318616

stage: resolved
2018-06-04 03:52:41Manjusakasetmessages: + msg318615
2018-06-04 03:09:28ned.deilysetmessages: + msg318607
2018-06-04 02:59:41Manjusakasetmessages: + msg318606
2018-06-04 02:28:31ned.deilysetmessages: + msg318602
2018-06-04 02:19:13Manjusakasetmessages: + msg318601
2018-06-03 20:34:51ned.deilysetnosy: + ned.deily
messages: + msg318584
2018-06-03 14:51:12Manjusakacreate