Question about libraries linking

Hi

I’m a new user of Root (which looks excellent so far). I use VC++ 8 and I compiled a .exe program using Root as a library (on Windows platform). It works fine on my computer, but when I run it on a different computer, an error occurs saying that the libCore.dll library is missing.

I suppose it has to do with the library not being statically linked. Is there a way to make the library static so I can run my program on any computer without installing Root libraries?

I searched the forum but I didn’t see any topic referring to that specific problem. Thanks for your help.

Regards,
Maxime

Hi Maxime,

There is no option to build static libraries on Windows.
And it would not be a good solution anyway, as it would make your application very big, and you would loose the library loading optimization made by ROOT. You would also miss some other files (e.g. configuration files located in $ROOTSYS/etc)
But copying a few dlls should not be a real issue anyway… (you can also ship them with your executable)

Cheers,
Bertrand.

Hi Bertrand

Thanks for your reply.
I copied the 8 needed libraries and I can now launch the program.

However, when the program uses a Root function, an error occurs with the message :

[quote]Error in TPluginManager::FindHandler: Cannot find plugin handler for TVirtualStreamerInfo! Does $ROOTSYS/etc/plugins/TVirtualStreamerInfo exist?

==========================================
=============== STACKTRACE ===============

================ Thread 0 ================

================ Thread 1 ================
ntdll!KiFastSystemCallRet()
kernel32!Sleep()
libCore!TWinNTSystem::TimerThread()

================ Thread 2 ================
ntdll!KiFastSystemCallRet()
libCore!`anonymous namespace’::GetProgramCounter()
0xffffffffff006aec ??

==========================================
============= END STACKTRACE =============
==========================================[/quote]
and of course, the program stops.

To try and solve that problem, I defined the “ROOTSYS” variable and copied the TVirtualStreamerInfo directory at the path specified by the error message. But when I launch the program again, I still get the same error message.

Does that mean I have to install Root (and not just the libraries) on the second computer so that the program will work ?
Or maybe I did something wrong and there is a more simpler way to make it work ?

Thanks in advance for your help.

Regards,
Maxime

Hi Maxime,

Which ones?
ROOT uses a plugin mechanism to dynamically load libraries when needed… so maybe there are more dependencies missing…
You could try to copy the full root directory (or take the tar file) in the target machine and then remove what is not needed (e.g. libraries you are sure to not use)
If you need more help, you can post your project and I’ll take a look.

Cheers,
Bertrand.

The libraries I copied are :
libCore.dll
libCint.dll
libGraf.dll
libGpad.dll
libHist.dll
libMathCore.dll
libMatrix.dll
libRIO.dll

With those ones, I wasn’t getting any “library missing” error message anymore.

A few minutes ago :

  • I copied the other libraries and it wasn’t working (same error message as in the previous post)
  • I then copied the root directory on the computer (as you suggested) but it still wasn’t working (same error message as in the previous post).
  • I then installed Root on the computer and it’s now working correctly.

I think installing Root is the most convenient way to make my program work on another machine. I was hoping I could just send the executable and maybe a few files but installing Root is not complicated anyway, so I guess I’ll do it that way.

Thanks again for your help !

Regards,
Maxime