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

Building error #2

Open
soomin-kim opened this issue Jun 20, 2024 · 2 comments
Open

Building error #2

soomin-kim opened this issue Jun 20, 2024 · 2 comments

Comments

@soomin-kim
Copy link

Hi, I'm interested in this project, but I encountered a building error while trying to install it.

Specifically, when I tried to build STP for fuzzball, I got the following error message:

ASTNode.h: At global scope:
ASTNode.h:89:21: error: friend declaration of ‘std::ostream& LispPrintVec(std::ostream&, const ASTVec&, int)’ specifies default arguments and isn’t a definition [-fpermissive]
   89 |     friend ostream &LispPrintVec(ostream &os,
      |                     ^~~~~~~~~~~~
ASTNode.h:94:21: error: friend declaration of ‘std::ostream& LispPrintVecSpecial(std::ostream&, const std::vector<const BEEV::ASTNode*>&, int)’ specifies default arguments and isn’t a definition [-fpermissive]
   94 |     friend ostream &LispPrintVecSpecial(ostream &os,
      |                     ^~~~~~~~~~~~~~~~~~~
In file included from ../STPManager/../sat/SATSolver.h:5,
                 from ../STPManager/STPManager.h:16,
                 from ArrayTransformer.h:14,
                 from ArrayTransformer.cpp:16:
../STPManager/../sat/core/SolverTypes.h:50:16: error: friend declaration of ‘Minisat::Lit mkLit(Minisat::Var, bool)’ specifies default arguments and isn’t a definition [-fpermissive]
   50 |     friend Lit mkLit(Var var, bool sign = false);
      |                ^~~~~
../STPManager/../sat/core/SolverTypes.h:58:14: error: friend declaration of ‘Minisat::Lit Minisat::mkLit(Minisat::Var, bool)’ specifies default arguments and isn’t the only declaration [-fpermissive]
   58 | inline  Lit  mkLit     (Var var, bool sign) { Lit p; p.x = var + var + (int)sign; return p; }
      |              ^~~~~
../STPManager/../sat/core/SolverTypes.h:50:16: note: previous declaration of ‘Minisat::Lit Minisat::mkLit(Minisat::Var, bool)’
   50 |     friend Lit mkLit(Var var, bool sign = false);
      |                ^~~~~
make[1]: *** [<builtin>: ArrayTransformer.o] Error 1

It looks like a kind of C++ error, and I have no idea how to fix it. Could you let me know how to fix it?

Additionally, do you have any plans to make a Dockerfile or something else that makes using this project easier?

Thank you in advance!

@smcc
Copy link
Collaborator

smcc commented Jul 29, 2024

Sorry we didn't see this question in time to respond promptly, but I hope a later answer is better than nothing.

I agree that these are C++ errors. Since this is relatively old code, a likely cause is an incompatibility with the C++ compiler version you're using being newer than the one this code was previously developed with. Mentioning what C++ compiler version or Linux distribution you're using might be helpful if you'd like us to try to reproduce the failure or test fixes. The fact that the errors are labeled with "[-fpermissive]" is also consistent with this. I believe the G++ developers use this flag when they add new checks that are not required for code generation. If you're only interested in compiling the code, and not further developing it, adding -fpermissive to the compiler options should turn these errors into warnings that you can then ignore. This is probably the least-effort workaround if it works.

Related to your Docker suggestion, compiling the code in a VM or container with an older Linux might work around these kinds of problems, perhaps at the expense of some multi-level-virtualization issues. Based on the time this repo was last updated, Ubuntu 18.04 would be my first suggestion of an older environment.

STP is an external project that we don't require major changes from, and it is maintained more actively, so I think it is very likely that this issue has already been fixed in the upstream STP, though I don't know how easy it would be to cherry-pick just that fix. Upstream FuzzBALL recommends a branch of the upstream STP repo that is newer than the patch that these instructions recommend, but is itself now also not up to date.

I agree that a Dockerfile or something similar would make the code easier to build, especially if one was only interested in the user-space FuzzBALL/Bochs/QEMU parts. (The KVM part is harder to deal with because it's based on a kernel patch and is itself a level of virtualization.) Based on the level of interest we've seen recently, I don't know if this would be a priority for us, but I'll talk to Qiuchen about it.

@smcc
Copy link
Collaborator

smcc commented Jul 30, 2024

A small update on this: after talking with Qiuchen, she reminded me that the Linux version we previously tested Fast PokeEMU with was Ubuntu 16.04, so that would probably be the safest version to set up in a VM or container if you you want to try building there. Looking back at my old files I can see that I also tested the instructions using an Ubuntu 16.04 QEMU VM, but unfortunately that VM image is too large to easily share.

I also reproduced the compiler errors you mention using G++ 9.4 on Ubuntu 20.04, and confirmed that I could work around them with -fpermissive. I did

CFLAGS=-fpermissive make

and then make install after the failure, though based on some warnings CXXFLAGS likely have been more appropriate. However I didn't retest beyond running the STP binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants