JamesTheAwesomeDude / pypqc

Attempt to expose Wiggers and Stebila's PQClean via Python CFFI
Other
0 stars 1 forks source link

More user-friendly build-time fatal error messages #13

Open JamesTheAwesomeDude opened 5 months ago

JamesTheAwesomeDude commented 5 months ago

Right now, if some innocent person merely tries to run pip install pypqc, they will be greeted with such inscrutable error messages as

error: command 'gcc' failed: No such file or directory`

`build/temp/pqc._lib.mceliece348864f_clean.c:50:14: fatal error: pyconfig.h: No such file or directory

This is simply unacceptable. Our build system should output meaningful messages, like

Couldn't find a C compiler while building from source.

It looks like you're on Windows; you can get a C compiler from: https://visualstudio.microsoft.com/visual-cpp-build-tools/

Once you have a C compiler, please try again. If it's still not working, let us know the problem at https://github.com/JamesTheAwesomeDude/pypqc/issues/new

Couldn't find Python development headers while building from source.

It looks like you're on Ubuntu; you should be able to get them by running:  apt install python3-dev

Once you have the Python development headers, please try again. If it's still not working, let us know the problem at https://github.com/JamesTheAwesomeDude/pypqc/issues/new

This will be seriously triaged if #9 gets resolved first, but it should still be fixed at some point.

JamesTheAwesomeDude commented 5 months ago

Cross-posted to Stack Overflow: https://stackoverflow.com/q/77686182/1874170

JamesTheAwesomeDude commented 5 months ago

Also, https://github.com/JamesTheAwesomeDude/pypqc/issues/14

LINK : fatal error LNK1104: cannot open file 'build\temp.win-amd64-cpython-311\Release\Modules/PQClean/crypto_sign/sphincs-sha2-128f-simple/clean/../../../common\libsphincs_sha2_128f_simple_clean.exp'

Couldn't complete setup due to a file access error.

This is probably due to https://developercommunity.visualstudio.com/t/clexe-compiler-driver-cannot-handle-long-file-path/975889

Try creating C:\temp, then run  set "TMPDIR=C:\temp"  and try again.

JamesTheAwesomeDude commented 4 months ago

Fw: my own comments on Stack Overflow

Tracing the setuptools spaghetti, it looks like setuptools._distutils.unixccompiler.UnixCCompiler:_compile() (et cetera) is the culprit; it's apparently ultimately called by setuptools.setup itself...

pypa/build ultimately seems to call your "backend"'s build_wheel, which does appear to be in my case setuptools' own.

So now I just need to figure out where and how to inject a try statement. Looks like maybe I'll need to migrate from setuptools-as-default-backend to an explicitly declared pseudo-subclass of build_meta?