Repository: pyodide/pyodide

Issue:
No logs when erroring on build package
I'm trying to build a package with Cyhton sources with the "in tree" approach.

When running 

```
pyodide build-recipes sisl --install
```

I get

```
The following packages are already built: boost-cpp, distutils, hashlib, libf2c, liblzma, lzma, micropip, numpy, openblas, openssl, packaging, pydecimal, pydoc_data, pyparsing,  
scipy, setuptools, sqlite3, ssl, test, and tqdm                                                                                                                                   
Building the following packages: sisl                                                                                                                                             
[1/1] (thread 1) building sisl ⠙                                                            
Building packages... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/1   0% Time elapsed: 0:00:09Error building sisl. Printing build logs.                                                                                                                                         
ERROR: No build log found.                                                                                                                                                        
ERROR: cancelling buildall                                                                                                                                                        
[1/1] (thread 1) building sisl ⠹                                                            
Building packages... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0/1   0% Time elapsed: 0:00:09
```

Therefore, I have no clue what's wrong. When does an error without build logs happen? Can I get some more verbose output in some way? Thanks!

I'm running this on the Docker container, after succesfully building all packages, even an old version of the package I'm trying to build.


Discussion:
If you use the old `pyodide-build buildpkg packages/sisl/meta.yaml` then that is more verbose. I think it is getting removed though.
Thank you! That helped! I was able to spot the error, although now I have another one :sweat_smile: 

It's strange because with `pyodide-build buildpkg` I am seeing that `scikit-build` is already building the sources with `cmake`, but if I run `pyodide build-recipes` I get no logs.
@ryanking13 what's the equivalent of `buildpkg` in the new cli?
> @ryanking13 what's the equivalent of buildpkg in the new cli?

Try adding `--no-deps` parameter. This will print build logs to stdout.

```
pyodide build-recipes sisl --no-deps
```
Nice, that works. Thanks!
I'm not sure this issue should be closed though. Even without `--no-deps` it should probably store the build log to a file. Also, isn't it kind of illogical that `--no-deps` makes it print to stdout? You would think we would handle that with a verbosity flag which would be directly discoverable.
Yes, I definitely agree that a verbosity flag would be nice and it is very strange that `--no-deps` writes logs that otherwise are not written.

I closed it because the workaround was enough for me. Feel free to open again :)
Yes, the behavior of `--no-deps` is not very straightforward, as it actually calls a different API. When making `build-recipes` CLI, I tried to reuse existing APIs (buildall and buildpkg) as much as possible so for now the behavior is not very ideal. I think we need to find a way to merge these two APIs for consistency.

Anyway, I think the point of this issue is not about that, so I think we can discuss it in a separate issue.

Resolving patch:
diff --git a/pyodide-build/pyodide_build/buildpkg.py b/pyodide-build/pyodide_build/buildpkg.py
--- a/pyodide-build/pyodide_build/buildpkg.py
+++ b/pyodide-build/pyodide_build/buildpkg.py
@@ -426,13 +426,7 @@ def compile(
         from .pypabuild import build
 
         outpath = srcpath / "dist"
-        try:
-            build(srcpath, outpath, build_env, backend_flags)
-        except BaseException:
-            build_log_path = Path("build.log")
-            if build_log_path.exists():
-                build_log_path.unlink()
-            raise
+        build(srcpath, outpath, build_env, backend_flags)
 
 
 def replace_so_abi_tags(wheel_dir: Path) -> None:


Test patch: