3

I am trying to install QCL-0.6.4 from this source, but I keep getting errors, when I try it with the make command in the terminal.

I came along this thread about installing QCL on OSX, but when trying to adjust the Makefile I always come across this errors:

extern.cc:84:18: error: variable length array of non-POD element type     'tComplex'
  (aka 'complex<double>')
 tComplex u[dim][dim];
             ^
extern.cc:193:9: error: variable length array of non-POD element type 'term'
 term t[dim];
    ^
extern.cc:224:9: error: variable length array of non-POD element type 'term'
 term t[dim];

Any help on this would be highly appreciated.

Community
  • 1
  • 1
Julian
  • 33
  • 3
  • Hi @Julian. If any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – Matt Dunn Mar 02 '16 at 10:08

1 Answers1

2

There are a few issues at play here which you need to overcome to get this compiling on OSX. My instructions below assume that you are running on El Capitan (10.11.1 in my instance), but you may get some milage out of them for different versions.

Firstly, Xcode currently uses Apple's LLVM Compiler as the default C++ compiler. However, this doesn't support some of GCC's extensions, such as support for non-POD variable length arrays.

To get around this, I installed and compile with GCC: if you haven't already, install Homebrew, and then install the latest GCC compiler with:

$ brew install gcc

At the time of writing, this will install GCC v5.2.0. That should fix your initial problem, but you will instantly hit others!

The next issue is that the included libqc.a will need recompiling for x86_64. So you will need to modify the file <base_dir>/qc/Makefile with the following changes:

...
# Add:
CXX = /usr/local/Cellar/gcc/5.2.0/bin/g++-5
CXXFLAGS = $(ARCHOPT) -c -pedantic -Wall $(DEBUG) $(PRGOPT)
...

Then rebuild libqc.a:

$ cd qc; make clean; make

If all goes well, you should have a shiny new libqc.a.

Finally, modify the main Makefile <base_dir>/Makefile with the following changes:

...
# Comment out:
#PLOPT = -DQCL_PLOT
#PLLIB = -L/usr/X11/lib -lplotter
...
# Comment out:
#RLOPT = -DQCL_USE_READLINE
#RLLIB = -lreadline
#RLLIB = -lreadline -lncurses
...
# Comment out:
#CXX = g++
#CPP = $(CC) -E
#CXXFLAGS = -c $(ARCHOPT) $(DEBUG) $(PLOPT) $(RLOPT) $(IRQOPT) $(ENCOPT) -I$(QCDIR) -DDEF_INCLUDE_PATH="\"$(QCLDIR)\""
#LDFLAGS = $(ARCHOPT) -L$(QCDIR) $(DEBUG) $(PLLIB) -lm -lfl -lqc $(RLLIB) 

# Add:
CXX = /usr/local/Cellar/gcc/5.2.0/bin/g++-5
CPP = $(CC) -E
CXXFLAGS = -c $(ARCHOPT) $(DEBUG) $(PLOPT) $(RLOPT) $(IRQOPT) $(ENCOPT) -I$(QCDIR) -DDEF_INCLUDE_PATH="\"$(QCLDIR)\""
LDFLAGS = $(ARCHOPT) -L$(QCDIR) $(DEBUG) $(PLLIB) -lm -ll -lqc $(RLLIB) -lc++
...

This should now allow you to build the main application as per the instructions:

$ make clean; make; make install
Matt Dunn
  • 5,106
  • 6
  • 31
  • 55
  • Thx for your answer Dunnie, but I still receive an error. When I try to execute the main Makefile, it says: /scratch/ppham/local/bin/flex: No such file or directory. Should I change this path in the Makefile? Additionally it says *** [lex.cc] Error 1, I don't know what that means. – Julian Mar 14 '16 at 22:17
  • Do you know if you have flex installed? I believe it is part of the Xcode command line tools. Try installing them with the command `xcode-select --install` if you don't already have them. – Matt Dunn Mar 14 '16 at 22:57
  • I installed the command line tools and after a restart it still won't work. It says: bison -t -d -o yacc.cc qcl.y mv yacc.*?h yacc.h /scratch/ppham/local/bin/flex -olex.cc qcl.lex make: /scratch/ppham/local/bin/flex: No such file or directory make: *** [lex.cc] Error 1 – Julian Mar 20 '16 at 23:16