mn416/QPULib

Cannot Compile

Opened this issue · 5 comments

I'm using an updated Archlinux on a Raspberry Pi 1 B+ and compilation attempt is:

[root@SmallPi Tests]# make QPU=1 GCD
Compiling GCD.cpp
In file included from ../Lib/QPULib.h:6,
from GCD.cpp:2:
../Lib/Source/Ptr.h: In copy constructor ‘Ptr::Ptr(Ptr&)’:
../Lib/Source/Ptr.h:63:5: error: there are no arguments to ‘assign’ that depend on a template parameter, so a declaration of ‘assign’ must be available [-fpermissive]
assign(this->expr, x.expr);
^~~~~~
../Lib/Source/Ptr.h:63:5: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../Lib/Source/Ptr.h: In copy constructor ‘Ptr::Ptr(const Ptr&)’:
../Lib/Source/Ptr.h:68:5: error: there are no arguments to ‘assign’ that depend on a template parameter, so a declaration of ‘assign’ must be available [-fpermissive]
assign(this->expr, x.expr);
^~~~~~
../Lib/Source/Ptr.h: In member function ‘Ptr& Ptr::operator=(Ptr&)’:
../Lib/Source/Ptr.h:73:5: error: there are no arguments to ‘assign’ that depend on a template parameter, so a declaration of ‘assign’ must be available [-fpermissive]
assign(this->expr, rhs.expr);
^~~~~~
make: *** [Makefile:121: GCD.o] Error 1

Versions:
[root@SmallPi Tests]# gcc --version
gcc (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@SmallPi Tests]# uname -a
Linux SmallPi 4.14.83-2-ARCH #1 SMP Sat Nov 24 23:09:29 UTC 2018 armv6l GNU/Linux

*** UPDATE ***

I was able to compile it using clang:
[root@SmallPi ~]# clang++ --version
clang version 7.0.0 (tags/RELEASE_700/final)
Target: armv6l-unknown-linux-gnueabihf
Thread model: posix
InstalledDir: /usr/bin

*** UPDATE 2 ***

One of the tests needs fixing:

[root@SmallPi Tests]# make QPU=1 TriFloat
clang++ TriFloat.cpp -o TriFloat
TriFloat.cpp:1:10: fatal error: 'QPULib.h' file not found
#include "QPULib.h"
^~~~~~~~~~
1 error generated.
make: *** [: TriFloat] Error 1

@mn416 I encountered the same issue as @zertyz and was able to resolve by adding "-fpermissive" to the Makefile's CXX_FLAGS (I added as the first flag in list fyi). This may be worth mentioning in the Getting Started Guide, in addition to zertyz workaround! So far the MultiTri and GCD examples work correctly. I am using Raspian Buster & PiZeroW.

m516 commented

I had the same problem as @crmann25 and @zertyz when I was compiling on a laptop running Ubuntu, and the solution above worked for me. Thank you @mn416 for the source code and @crmann25 for the fix!

mn416 commented

Thanks @crmann25, @zertyz, and @m516 for reporting this. I've pushed a commit to include -fpermissive in the default compiler flags as a workaround for now. Sorry I've been so slow to respond (and for not doing a proper fix yet).