Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build for bluespec-compiler #293

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion pycheribuild/projects/bluespec_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,20 @@ def __init__(self, config: CheriConfig):
self.add_required_system_tool("cabal", apt="cabal-install", homebrew="cabal-install")
for i in ("autoconf", "gperf", "bison", "flex"):
self.add_required_system_tool(i, homebrew=i)
self.add_required_system_header("tcl/tcl.h", apt="tcl-dev")
self.make_args.set(PREFIX=self.install_dir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove build_in_source_dir = True, the following might be sufficient:

Suggested change
self.make_args.set(PREFIX=self.install_dir)
self.make_args.set(PREFIX=self.install_dir, BUILDDIR=self.build_dir)

Copy link
Contributor Author

@tmarkettos tmarkettos Jul 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out their out-of-tree build is broken. bsc/src/Libraries sets its own BUILDDIR, to be [sourcetree]/build/bsvlib, which is overriden by ours, and then Libraries' wildcarded calls to the 'install' command fail because they're trying to install directories (from the wrong place). I think that's fixable upstream but somewhat messy, so perhaps in-tree is good enough for now? In which case we need to prevent cheribuild calling 'make distclean'

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I should just remove the distclean workaround and always use git clean for in-source clean. For now using this seems fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it works if you set BUILDIR in the environment instead of on the make command line?


def clean(self, **kwargs):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like latest version support out-of-source builds, if we can use that instead we can avoid changing clean().

Copy link
Contributor Author

@tmarkettos tmarkettos Jul 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no 'make clean' target in the upstream source - can we make sure that an out-of-source build won't try to call it?

Edit: correction, there is. Let me see why that wasn't working...

try:
self.run_make("full_clean")
except Exception:
self.info("Cleaning failed, continuing anyway")

def compile(self, **kwargs):
try:
self.run_make("all")
# a full install includes documentation which drags in
# lots of Latex dependencies, so just build the tools
self.run_make("install-src")
except Exception:
self.info("Compilation failed. If it complains about missing packages try running:\n"
"\tcabal install regex-compat syb old-time split\n"
Expand All @@ -61,3 +70,6 @@ def compile(self, **kwargs):
self.info("Alternatively, try running:",
self.source_dir / ".github/workflows/install_dependencies_ubuntu.sh")
raise

def install(self, **kwargs):
pass # compile and install is a single target in toplevel GNUmakefile