cpython icon indicating copy to clipboard operation
cpython copied to clipboard

Should ./configure script alert of ALL missing packages that python needs before compiling?

Open osergioabreu opened this issue 1 year ago • 8 comments

Bug report

Bug description:

I was installing python, and noticed that ./configure script does NOT alert about ALL missing packages that python needs before compiling. Shouldn't it WARN clearly about all missing packages that SSL module depends?

Sometimes the compiler throws a RED ERROR too fast in the scrolling terminal console but I saw it, it was a C header file missing. So I recompiled with attention to discover "what is this red thing (error)?" and was a header from libffi-dev that I had to install.

Is there a way that the compiler STOPS when a critical error occur at least ? I think using EXIT would be a good approach, as the error would be in the screen doing what I expected.

CPython versions tested on:

3.10

Operating systems tested on:

Linux

osergioabreu avatar May 06 '24 20:05 osergioabreu

yes, I once created https://github.com/python/cpython/issues/116461

Agent-Hellboy avatar May 07 '24 08:05 Agent-Hellboy

Do you want it to warn or error?

eli-schwartz avatar May 07 '24 18:05 eli-schwartz

It would be friendly to list them: "ERROR: These packages are required by python to compile but they were not found in your system:

  • package one
  • package foo
  • package bar Please install them and retry.

osergioabreu avatar May 07 '24 18:05 osergioabreu

Reporting on exact package names to install is a hard problem to solve since there are many different linux distros and suggesting:

build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

will not work since e.g. my distro doesn't have any such packages.

Listing software components like "needs OpenSSL, Readline, ncurses, SQLite, Tk, GDBM, bzip2" could work.

The real trick here is deciding whether they are needed or intentionally omitted. This could be done using autoconf --enable-ssl / --disable-ssl and failing if not found, but you also want a "check" option for the current autodetection...

You can do:

export PYTHONSTRICTEXTENSIONBUILD=1

and make will error out at the end if it failed to build any modules it expected to create -- even if those modules failed for reasons other than a missing configure dependency.

eli-schwartz avatar May 07 '24 18:05 eli-schwartz

Let me explain better: Sometimes the compiler throws a RED ERROR too fast in the scrolling terminal console but I saw it, it was a C header file missing. So I recompiled with attention to discover "what is this red thing (error)?" and was a header from libffi-dev that I had to install

Is there a way that the compiler STOPS when a critical error occur at least ? I think using EXIT would be a good approach, as the error would be in the screen doing what I expected.

osergioabreu avatar May 07 '24 19:05 osergioabreu

Let me explain better: Sometimes the compiler throws a RED ERROR too fast in the scrolling terminal console but I saw it, it was a C header file missing. So I recompiled with attention to discover "what is this red thing (error)?" and was a header from libffi-dev that I had to install

pipe the output to grep the missing headers

Agent-Hellboy avatar May 10 '24 05:05 Agent-Hellboy

It's a nice suggestion! Instead of the user have to do this, python installation could have a sh script that does that and more, making it more efficient and the python installer admired.

Em sex, 10 de mai de 2024 02:43, Prince Roshan @.***> escreveu:

Let me explain better: Sometimes the compiler throws a RED ERROR too fast in the scrolling terminal console but I saw it, it was a C header file missing. So I recompiled with attention to discover "what is this red thing (error)?" and was a header from libffi-dev that I had to install

pipe the output to grep the missing headers

— Reply to this email directly, view it on GitHub https://github.com/python/cpython/issues/118670#issuecomment-2103909670, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIFZGK3BYU36ZTZWJGEBYGLZBRNAHAVCNFSM6AAAAABHJVDTHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBTHEYDSNRXGA . You are receiving this because you authored the thread.Message ID: @.***>

osergioabreu avatar May 10 '24 07:05 osergioabreu

Well, as I noted you can already tell CPython to emit a make error if a failure occurred.

I guess running make twice could result in the error bubbling up in a much more readable manner. It's a trick I often use to collect build errors:

make -j8 -k # keep going and build everything possible
make -k # print errors for anything that failed the first time

eli-schwartz avatar May 20 '24 18:05 eli-schwartz