Problem to compile after Ubuntu 16.04 upgrade [SOLVED]

Hello,

After the upgrade, I got some trouble when compiling my current audio C++ project. I’ve corrected some errors, but now the remaining ones are all related to ROOT so I’ve decided to remove the version 5.34/30 for the last one (6.06/06). After trying hard, I’ve managed to install it on Ubuntu 16.01 thanks to this thread : Memory leak in ROOT::Math::IntegratorMultiDim
Now I compile again and I get this error :

I’m using Code::Blocks 16.01 with the following compiler settings (the ones used with the old version of ROOT) :

-larmadillo -I/usr/include/root -I/usr/include -L/usr/lib

and these linker settings :

`root-config --cflags` `root-config --libs` `root-config --glibs`

In fact there is nothing in the directory usr/include/root (the directory still exists), there was the version 5.34 but now it’s empty.
Do you now what the settings should be ? Everything seems to be installed in /home/alexandre/ROOT/v6-06-06
I tried to put this instead of usr/include but without success.

Can somebody help ? Thanks !

  1. Make sure that you really “purge” all old Ubuntu ROOT 5 related packages. Execute: sudo apt-get purge root-system* root-plugin* libroot* Afterwards check that the “/usr/lib/i386-linux-gnu/root5.34” and the “/usr/lib/x86_64-linux-gnu/root5.34” subdirectories disappeared completely (I assume that “/usr/include/root” should also be gone).
    If you found that there were some “remnants”, and you “purged” them now, then you will need to build your ROOT 6 version from scratch (i.e. first delete everything) again.

  2. Your compiler settings should be (without manually setting any “-I…” flags): `root-config --cflags` Note also that “-L…” and “-l…” flags belong to linker settings.

  3. Your linker settings should be either: `root-config --cflags --glibs` or: `root-config --ldflags --glibs` You may add “-larmadillo” if you need this library (no need to add “-L/usr/lib”).

  4. Make sure that you “make clean” (or “make distclean”) all of your project (so that there are no object files nor libraries which depend on your old Ubuntu ROOT 5),

Thank you for your reply !

  1. For the installation, I’ve purged root5 with this command and I’ve installed it like this : Memory leak in ROOT::Math::IntegratorMultiDim

  2. & 3. I’ve tried to type these options but this error appears again : error while loading shared libraries: libCore.so.5.34: cannot open shared object file: No such file or directory
    I’m surprised that root-config --cflags is a compiler setting and “-L…” and “-l…” are linker settings because it was set the other way around in code::blocks before this annoying upgrade.
    I probably have to specify the place of the library somewhere ${HOME}/ROOT/v6-06-06 ?
    How come is the compiler still looking for a root5.34 ?

  3. My code::blocks projects don’t have any makefile, so I don’t know how to achieve this make clean…?

Ok for the ‘make clean’, I found “clean” and “rebuild” in Code::Blocks (deletion of all object file and building the project from scratch). After compiling, it’s no more asking for libCor.so.5.34 but instead, it’s not even finding libraries like TCanvas.h (present at these directories : /home/alexandre/Downloads/root-6.06.06/graf2d/gpad/inc and /home/alexandre/ROOT/v6-06-06/include).
It might come from the fixed location installation. I can type source ${HOME}/ROOT/v6-06-06/bin/thisroot.sh in the terminal, but Code::Blocks is not using this terminal to compile.

Errors at compilation have changed a lot since I first compiled after Ubuntu upgrade, I hope I’m on the right way to fix it, thanks for guiding me through these still obscure areas of informatics.

Some more attempt :
Putting this “-I/home/alexandre/ROOT/v6-06-06/include” into compiler options (which seems to be equivalent to putting “/home/alexandre/ROOT/v6-06-06/include” into Search directories->Compiler) give me this warning :

#error This file requires compiler and library support for the forthcoming \ ISO C++ 2014 standard. This support is currently experimental, and must be \ enabled with the -std=c++1y or -std=gnu++1y compiler options.

Then, I ticked the C++14 ISO (instead of C++11) into Compiler flags->General (equivalent to adding -std=c++1y into compiler options) and I get a lot of “undefined reference to …” beginning with :

Here are the compilation options in the Build log :

Here is the piece of code which cause the error : [code]
TH1D* Dessin(vec &V,const char * xtitre,const char * ytitre,double xmin,double xmax,const char * titre, int superp,const char *opt,double ymin, double ymax,int col,int opt_log)
{

//... recherche si il y a deja une fenetre "titre"...
TCanvas *c=(TCanvas*)gROOT->GetListOfCanvases()->FindObject(titre);       // PROBLEM HERE
if (c==0) // il n'y en a pas déjà, crée nouvelle fenetre
{

// cout<<“cree nouvelle fenetre dans vecteur.cc, titre=”<<titre<<endl;
c = new TCanvas(titre,titre,400,400);
c->SetFillColor(0);
superp=0;
}
else
{
// cout<<“fenetre deja existante:”<<titre<<endl;
}

return Dessin(V,xtitre, ytitre,xmin, xmax, titre, c,superp,opt,ymin,ymax,col,opt_log);

}[/code]

Here is the full build log :

g++ -Wall -fexceptions -g -std=c++14 -larmadillo -I/home/alexandre/ROOT/v6-06-06/include -c /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc -o obj/Debug/divers.o /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc: In function ‘int Recherche_indice_du_max(arma::vec&)’: /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc:164:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc: In function ‘arma::vec Permut_circ2(arma::vec&, int)’: /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc:175:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=0;i<V.size();i++) ^ g++ -o bin/Debug/program5 obj/Debug/divers.o obj/Debug/main.o obj/Debug/signal.o obj/Debug/sound2.o obj/Debug/divers.o: In function `Dessin(arma::Col<double>&, char const*, char const*, double, double, char const*, int, char const*, double, double, int, int)': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc:42: undefined reference to `ROOT::GetROOT()' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc:46: undefined reference to `TCanvas::TCanvas(char const*, char const*, int, int)' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc:46: undefined reference to `TObject::operator delete(void*)' obj/Debug/divers.o: In function `Dessin(arma::Col<double>&, char const*, char const*, double, double, char const*, TCanvas*, int, char const*, double, double, int, int)': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc:78: undefined reference to `ROOT::GetROOT()' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc:87: undefined reference to `TH1D::TH1D(char const*, char const*, int, double, double)' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/divers.cc:87: undefined reference to `TObject::operator delete(void*)' obj/Debug/divers.o: In function `__static_initialization_and_destruction_0(int, int)': /home/alexandre/ROOT/v6-06-06/include/TVersionCheck.h:34: undefined reference to `TVersionCheck::TVersionCheck(int)' obj/Debug/divers.o: In function `TObject::operator new(unsigned long)': /home/alexandre/ROOT/v6-06-06/include/TObject.h:158: undefined reference to `TStorage::ObjectAlloc(unsigned long)' obj/Debug/divers.o: In function `TCanvasImp::IsA() const': /home/alexandre/ROOT/v6-06-06/include/TCanvasImp.h:80: undefined reference to `TCanvasImp::Class()' obj/Debug/divers.o: In function `TCanvasImp::ShowMembers(TMemberInspector&) const': /home/alexandre/ROOT/v6-06-06/include/TCanvasImp.h:80: undefined reference to `TCanvasImp::Class()' /home/alexandre/ROOT/v6-06-06/include/TCanvasImp.h:80: undefined reference to `ROOT::Class_ShowMembers(TClass*, void const*, TMemberInspector&)' obj/Debug/divers.o:(.rodata._ZTV10TCanvasImp[_ZTV10TCanvasImp]+0x100): undefined reference to `TCanvasImp::Streamer(TBuffer&)' obj/Debug/main.o: In function `main': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/main.cc:13: undefined reference to `TApplication::TApplication(char const*, int*, char**, void*, int)' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/main.cc:17: undefined reference to `TApplication::Run(bool)' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/main.cc:13: undefined reference to `TApplication::~TApplication()' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/main.cc:13: undefined reference to `TApplication::~TApplication()' obj/Debug/main.o: In function `__static_initialization_and_destruction_0(int, int)': /home/alexandre/ROOT/v6-06-06/include/TVersionCheck.h:34: undefined reference to `TVersionCheck::TVersionCheck(int)' obj/Debug/main.o: In function `TApplicationImp::~TApplicationImp()': /home/alexandre/ROOT/v6-06-06/include/TApplicationImp.h:39: undefined reference to `TString::~TString()' obj/Debug/main.o: In function `TApplicationImp::IsA() const': /home/alexandre/ROOT/v6-06-06/include/TApplicationImp.h:52: undefined reference to `TApplicationImp::Class()' obj/Debug/main.o: In function `TApplicationImp::ShowMembers(TMemberInspector&) const': /home/alexandre/ROOT/v6-06-06/include/TApplicationImp.h:52: undefined reference to `TApplicationImp::Class()' /home/alexandre/ROOT/v6-06-06/include/TApplicationImp.h:52: undefined reference to `ROOT::Class_ShowMembers(TClass*, void const*, TMemberInspector&)' obj/Debug/main.o:(.rodata._ZTV15TApplicationImp[_ZTV15TApplicationImp]+0x80): undefined reference to `TApplicationImp::Streamer(TBuffer&)' obj/Debug/signal.o: In function `Signal::Calcule_Correlation(arma::Col<double>&, double)': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:276: undefined reference to `TLine::TLine(double, double, double, double)' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:280: undefined reference to `TVirtualPad::Pad()' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:276: undefined reference to `TObject::operator delete(void*)' obj/Debug/signal.o: In function `Signal::Dessin_TF()': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:495: undefined reference to `TVirtualPad::Pad()' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:498: undefined reference to `ROOT::GetROOT()' obj/Debug/signal.o: In function `Signal::TF_phases_aleatoires()': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:609: undefined reference to `gRandom' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:609: undefined reference to `gRandom' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:615: undefined reference to `gRandom' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:615: undefined reference to `gRandom' obj/Debug/signal.o: In function `Signal::TF_var_signal()': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:986: undefined reference to `gRandom' obj/Debug/signal.o:/home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/signal.cc:986: more undefined references to `gRandom' follow obj/Debug/signal.o: In function `__static_initialization_and_destruction_0(int, int)': /home/alexandre/ROOT/v6-06-06/include/TVersionCheck.h:34: undefined reference to `TVersionCheck::TVersionCheck(int)' obj/Debug/sound2.o: In function `Com_Sound::Com_Sound()': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:31: undefined reference to `TGClient::Instance()' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:31: undefined reference to `TGClient::GetRoot() const' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:31: undefined reference to `TGMainFrame::TGMainFrame(TGWindow const*, unsigned int, unsigned int, unsigned int)' obj/Debug/sound2.o: In function `Com_Sound::Com_Sound()': /home/alexandre/ROOT/v6-06-06/include/TGButton.h:180: undefined reference to `TGButton::GetDefaultGC()' obj/Debug/sound2.o: In function `Com_Sound::Com_Sound()': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:52: undefined reference to `TGGC::operator()() const' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:52: undefined reference to `TGTextButton::GetDefaultFontStruct()' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:52: undefined reference to `TGTextButton::TGTextButton(TGWindow const*, char const*, int, unsigned long, unsigned long, unsigned int)' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:61: undefined reference to `TGFrame::GetDefaultFrameBackground()' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:61: undefined reference to `TRootEmbeddedCanvas::TRootEmbeddedCanvas(char const*, TGWindow const*, unsigned int, unsigned int, unsigned int, unsigned long)' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:62: undefined reference to `TGCompositeFrame::AddFrame(TGFrame*, TGLayoutHints*)' obj/Debug/sound2.o: In function `Com_Sound::Com_Sound()': /home/alexandre/ROOT/v6-06-06/include/TGButton.h:180: undefined reference to `TGButton::GetDefaultGC()' obj/Debug/sound2.o: In function `Com_Sound::Com_Sound()': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:78: undefined reference to `TGGC::operator()() const' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:78: undefined reference to `TGTextButton::GetDefaultFontStruct()' /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:78: undefined reference to `TGTextButton::TGTextButton(TGWindow const*, char const*, int, unsigned long, unsigned long, unsigned int)' obj/Debug/sound2.o: In function `Com_Sound::Com_Sound()': /home/alexandre/ROOT/v6-06-06/include/TGButton.h:180: undefined reference to `TGButton::GetDefaultGC()' obj/Debug/sound2.o: In function `Com_Sound::Com_Sound()': /home/alexandre/Desktop/MathMusiqueInfo/Stage/program5/sound2.cc:88: undefined reference to `TGGC::operator()() const'

Hi,

Note that if you compile your code in C++14 mode, you also need to compile the ROOT library this way.

The link error are ‘obvious’:

g++ -o bin/Debug/program5 obj/Debug/divers.o obj/Debug/main.o obj/Debug/signal.o obj/Debug/sound2.o I.e. none of the ROOT library are listed on the link line. (However I do not know you IDE tool and do not know what configuration flag you need to update to add libraries to the link line).

Cheers,
Philippe.

Yes indeed, I tried to add the full path before the flags in the linker settings :

`/PATH/root-config --cflags` `/PATH/root-config --cflags --glibs` `/PATH/root-config --ldflags --glibs`

and it works ! Finally :smiley:
Thanks for helping me !