2

I've recently set up Arch linux on my desktop PC as a project over the summer, and I'm trying to figure out how to install programs from source. From what I've gathered I have to get the tarball file, extract it, run ./configure, then make, and make-install. I can get past the ./configure, but when I try to run the make command for a codeblocks install I get what looks like a whole bunch of compiler errors.

According to the guide on the codeblocks wiki I have to install wxGTK2-2.8.12 before I can install codeblocks itself, and it tells me to run

../configure --prefix=/opt/wx/2.8 --enable-xrc --enable-monolithic --enable-unicode

Which to me seems to work alright, here is the terminal output.

I then try to run make from the same folder, and the output is really extensive, so sorry if it a pain to read, but the errors are at the end, just not sure whether you will need to see the previous outputs, so here is the entire make output.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
  • Your problem concerns a C++ compilation failure. To attract the readers most likely to help with a C++ problem always tag your question **C++**. Similarly for any other programming language. – Mike Kinghan Jul 01 '17 at 18:56
  • For some reason I didn't think of that, thanks for pointing it out :) –  Jul 01 '17 at 22:06

1 Answers1

0

All of the compile errors in your build log are of the form:

error: narrowing conversion of ‘ddd’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]

There are a great many other compiler diagnostics but they are all warnings - not errors - that you can live with.

The errors arise from the fact that wxGTK2-2.8.12 - released March, 2011 - was written to be compiled to an earlier C++ standard (C++98, i.e. C++ 1998) than the standard that is the default for your g++ compiler, now in July 2017. Your compiler I assume is g++ 6 or later, which defaults to C++14 (C++ 2014). Since the C++11 standard, the narrowing conversion that is breaking your build has been ruled ill-formed, which previously it was not.

You can direct g++ to compile according to the C++ standard of your choice by passing it the option -std={c++98|c++03|c++11|c++14|c++17}, and you can pass your choice to the wxGTK2-2.8.12 configure script by including it in the value of the CXXFLAGS parameter for ./configure. Either of -std=c++98 or -std=c++03 will remove the narrowing conversion errors, e.g.

../configure CXXFLAGS=-std=c++03 --prefix=/opt/wx/2.8 --enable-xrc --enable-monolithic --enable-unicode

Alternatively you might simply direct g++ to suppress the diagnostics denoted by -Wnarrowing:

../configure CXXFLAGS=-Wno-narrowing --prefix=/opt/wx/2.8 --enable-xrc --enable-monolithic --enable-unicode

The ./configure script of any GNU autotools package (such as you are trying to build) will have parameters including:

CC          C compiler command
CFLAGS      C compiler flags
LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
          nonstandard directory <lib dir>
CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
          headers in a nonstandard directory <include dir>
CPP         C preprocessor
CXX         C++ compiler command
CXXFLAGS    C++ compiler flags

that are there to help you correct for deviations between your toolchain and the defaults that were expected by the package maintainers when they released the package. See ./configure --help.

Mike Kinghan
  • 116
  • 1