[Dcmlib] Problème pour compiler la librairie gdcm pour VTK

Mathieu Malaterre mathieu.malaterre at gmail.com
Fri Jul 13 09:13:06 CEST 2007


Sorry I get sometime angree at windoze devlopment.

If you take a quick look at VTK/Common/vtkWin3éHeader.h you'll
understand right away what happened here. Basically if you select a
static build of VTK (as you did). Then VTK_EXPORT is defined to ...
nothing.
therefore when you decided to built GDCM as shared lib, the VTK_EXPORT
was also set to ... nothing (without the declspec dllexport thingy).

So the *correct* solution AFAIK is not to mix library type. You should
either rebuild VTK as shared lib (you'll see in the end it is much
faster do develop this way). And then build GDCM as shared too.
If you are unfamiliar with Windowze developmenet and runtime PATH, you
should not use shared lib, and instead build *everything* as static.

HTH
-Mathieu

On 7/13/07, Alfredo Gourbish <the.answer3 at libertysurf.fr> wrote:
> I don't understand what you said...
>
> ----- Original Message -----
> From: "Mathieu Malaterre" <mathieu.malaterre at gmail.com>
> To: <the.answer3 at libertysurf.fr>; "dcmlib" <dcmlib at creatis.insa-lyon.fr>
> Sent: Thursday, July 12, 2007 9:22 PM
> Subject: Re: [Dcmlib] Problème pour comp iler la librairie gdcm pour VTK
>
>
> dude! You built VTK as static and then you build GDCM as shared !
> That's why declspec was set as dllimport... You need to be consistant.
>
> As a side note, I would suggest building GDCM as static, i have never
> tried mixing shared and static esp on Win32 I do not think you can
> link a static lib inside a shared one (same problem on 64bits
> machine).
>
> stupid cristal ball does not work all the time ;)
>
> -Mathieu
>
> On 7/12/07, the.answer3 at libertysurf.fr <the.answer3 at libertysurf.fr> wrote:
> > I tried to change 3 files of the gdcm librairie and it works !
> >
> > In "..\gdcm\src\gdcmCommon.h"
> > I add le following lines :
> > <<
> > #if defined(_WIN32) && defined(BUILD_SHARED_LIBS)
> >   #ifdef vtkgdcm_EXPORTS
> >     #define VTKGDCM_EXPORT __declspec( dllexport )
> >   #else
> >     #define VTKGDCM_EXPORT __declspec( dllimport )
> >   #endif
> > #else
> >   #define VTKGDCM_EXPORT
> > #endif
> > >>
> >
> > In "...\gdcm\vtk\vtkGdcmReader.h" and "...\gdcm\vtk\vtkGdcmWriter.h"
> > I change :
> > VTK_EXPORT
> > to
> > VTKGDCM_EXPORT
> >
> > And now all the projects compile since the vtkgdcm.lib is built.
> >
> > I think it's not cleen to add the previous lines in "gdcmCommon.h", but it
> > was to try my idea. In fact I don't understand why there is "class
> > VTK_EXPORT vtkGdcmWriter : public vtkImageWriter" in "vtkGdcmWriter.h" and
> > not "class VTKGDCM_EXPORT vtkGdcmWriter : public vtkImageWriter" as
> > "VTK_EXPORT" doesn't deal with vtkgcdm.lib. That's why I tried these
> > changes.
> >
> > You didn't have this problem ? It's crazy !
> >
> >
> > Finally, I tried these examples : vtkgdcmViewer.exe and
> > vtkgdcmViewer2.exe. But the dicom image I tested (from gdcmData) doesn't
> > work as the image appears as all black. Moreover, for the
> > vtkgdcmViewer2.exe, I have this error :
> > <<
> > ERROR: In .\vtkDemandDrivenPipeline.cxx, line 799
> > vtkStreamingDemandDrivenPipeline (010AEFC0): Input for connection index 0
> > on input port index 0 for algorithm
> > vtkImageMapToWindowLevelColors(010AE708) is NULL, but a vtkImageData is
> > required.
> > >>
> >
> > Greetz
> >
> > Gourbish.
> >
> >
> > ---------- Initial Header -----------
> >
> > From      : "Mathieu Malaterre" <mathieu.malaterre at gmail.com>
> > To          : "the.answer3 at libertysurf.fr" <the.answer3 at libertysurf.fr>
> > Cc          : dcmlib <dcmlib at creatis.insa-lyon.fr>
> > Date      : Thu, 12 Jul 2007 18:11:08 +0200
> > Subject : Re: [Dcmlib] Problème pour comp  iler la librairie gdcm pour VTK
> >
> > I have to say I am kindda stuck here. I really have no clue why it
> > would not work for VS8 (which is for me really only VSExpress + MFC
> > AFAIK).
> >
> > The VCExpress build of gdcm CVS + VTK CVS seems to be working for me,
> > see bender entry at:
> >
> > http://public.kitware.com/dashboard.php?name=gdcm
> >
> > in particular I used the following ctest script:
> >
> > http://public.kitware.com/GDCM/Testing/Sites/bender/Win32-VS08-Debug/20070712-0100-Nightly/Notes.html
> >
> > Are you willing to try out a little work using the console (either
> > cygwin, rxvt or cmd).
> >
> > Simply save the attached file. Edit the txt file. You will need to
> > change the path to VTK. CTEST_DASHBOARD_ROOT should have been simply
> > "C:/" but you should changed to whatever you root path point to gdcm.
> > Since you are using VS8, you might need to change VCExpress.exe to
> > devenv.com
> >
> >
> > The on the shell simply run:
> >
> > ctest -S gourbish.txt -V
> >
> > (ctest is located in c:\Program Files\Cmake 2.4\bin\ctest)
> >
> > If this does not work, please send me your version of the file.
> >
> > Thanks
> > -Mathieu
> >
> >
> >
> > On 7/12/07, the.answer3 at libertysurf.fr <the.answer3 at libertysurf.fr> wrote:
> > > Hi Mathieu,
> > >
> > > Thank's for trying to help me...
> > > I have Microsoft Visual Studio 2005, not VC++ express.
> > > I can't install the librairies in C:\ as I'm working on a computer which
> > > is not mine.
> > > I already installed ITK and VTK without problem, and a project combining
> > > the two librairies without problem too.
> > >
> > > In fact, I find that the small project called vtkgdcm build a DLL
> > > (vtkgdcm.dll) but no .lib nor .exp. It is odd since the other small
> > > projects build DLL, .lib and .exp.
> > >
> > > Moreover, I tried the installation on another PC and I have the same
> > > problem... vtkgdcm.lib isn't built !
> > >
> > > Finally, after searches in google, I found that a few users had the same
> > > problem or a problem near the mine, but no solution in all
> > > discussions...
> > >
> > > Here the installation I did :
> > > - compilation of VTK in debug and release with CMake generated projects
> > > - install of GDCM
> > > - run CMake for generate GDCM projects with Micrisoft Visual Studio 2005
> > > (not express version)
> > > -> option GDCM_VTK set to ON
> > > -> VTK_DIR is good (for example ...\vtk-bin)
> > > -> configure and OK
> > >
> > > And while compiling the projects, errors occur as vtkgdcm.lib is not
> > > built.
> > >
> > > You don't have anymore idea ?
> > >
> > >
> > > Gourbish.
> > >
> > >
> > > ---------- Initial Header -----------
> > >
> > > From      : "Mathieu Malaterre" <mathieu.malaterre at gmail.com>
> > > To          : "the.answer3 at libertysurf.fr" <the.answer3 at libertysurf.fr>
> > > Cc          : dcmlib <dcmlib at creatis.insa-lyon.fr>
> > > Date      : Thu, 12 Jul 2007 17:03:52 +0200
> > > Subject : Re: [Dcmlib] Problème pour comp iler la librairie gdcm pour
> > > VTK
> > >
> > > Hi Gourbish,
> > >
> > >   Since you are the first one to report this issue, I would be tempted
> > > to say you misconfigured something.
> > >
> > >   Since you seems familiar with building with CMake I would suggest
> > > you do the following:
> > >
> > >   Get VTK source in C:\VTK
> > >   Create VTK binary in c:\VTK-bin (select debug in VS2005)
> > >   Get gdcm source in c:\gdcm
> > >   Create gdcm binary in c:\gdcm-bin (select debug in VS2005). You'll
> > > need to check CMake is actually picking c:\VTK-bin and nothing else.
> > >
> > >   If an error (not a warning) occurs, please send the first one.
> > >
> > >   Obvisouly if you are building VTK in debug, you will only be allowed
> > > to build gdcm in debug mode (duh!).
> > >
> > > HTH
> > > -Mathieu
> > > Ps: You have read the following, right ?
> > > http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
> > >
> > > On 7/12/07, the.answer3 at libertysurf.fr <the.answer3 at libertysurf.fr>
> > > wrote:
> > > > Bonjour à tous !
> > > >
> > > > Voilà mon soucis, lors de la compilation du projet visual studio, j'ai
> > > > 8 erreurs de ce type :
> > > > << LINK : fatal error LNK1104: impossible d'ouvrir le fichier
> > > > 'vtkgdcm.lib' >> que cela soit en debug ou en release.
> > > >
> > > > Voici ma configuration :
> > > > - VTK-5.1 installée (version en cours de développement, le problème
> > > > viendrait-il de là ?).
> > > > - Visual studio 2005
> > > > - GDCM-1.3.1
> > > > - CMake 2.4.6
> > > > - Pour CMake, j'ai mis l'option GDCM_VTK à ON, et le chemin trouvé
> > > > pour VTK est le bon.
> > > >
> > > > Merci d'avance pour vos réponses...
> > > >
> > > > Bonne journée.
> > > >
> > > > Gourbish
> > > >
> > > > ------------------------ ALICE C'EST ENCORE MIEUX AVEC CANAL+ LE
> > > > BOUQUET ! ---------------
> > > > Découvrez vite l'offre exclusive ALICEBOX et CANAL+ LE BOUQUET, en
> > > > cliquant ici http://alicebox.fr
> > > > Soumis à conditions.
> > > >
> > > >
> > > > _______________________________________________
> > > > Dcmlib mailing list
> > > > Dcmlib at creatis.insa-lyon.fr
> > > > http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib
> > > >
> > >
> > >
> > > --
> > > Mathieu
> > >
> > >
> > > ------------------------ ALICE C'EST ENCORE MIEUX AVEC CANAL+ LE BOUQUET
> > > ! ---------------
> > > Découvrez vite l'offre exclusive ALICEBOX et CANAL+ LE BOUQUET, en
> > > cliquant ici http://alicebox.fr
> > > Soumis à conditions.
> > >
> > >
> > >
> >
> >
> > --
> > Mathieu
> >
> >
> > ------------------------ ALICE C'EST ENCORE MIEUX AVEC CANAL+ LE BOUQUET
> > ! ---------------
> > Découvrez vite l'offre exclusive ALICEBOX et CANAL+ LE BOUQUET, en
> > cliquant ici http://alicebox.fr
> > Soumis à conditions.
> >
> >
> >
>
>
> --
> Mathieu
>
>
>


-- 
Mathieu



More information about the Dcmlib mailing list