64-bit compile issue?

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
peer9802
Posts: 15
Joined: Mon, 2007-05-21, 02:17

64-bit compile issue?

#1 Post by peer9802 »

I have been using DCMTK 3.5.4, on a Mac OS X 10.5 32-bit system, without any issue for some time. I am now receiving errors while trying to run my code on a 64-bit Apple workstation (DCMTK appears to compile fine but the code fails when I use it). What compiler flags do I need to use when compiling DCMTK on a 64-bit system (I am very ignorant with this compiler)? I am still unsuccessful after trying the suggestions in several posts. Any help would be greatly appreciated.
Eric

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

In theory DCMTK should run fine on 64-bit platforms, but to my knowledge nobody has ever tried this on a 64-bit MacOS X, which may or may not require specific tweaks in the code. Without in-depth knowlege of platform and compiler you are most probably out of luck. Since we do not have access to any 64-bit Mac hardware, we won't be able to provide much help - that is, unless somebody is willing to donate such a machine :)

peer9802
Posts: 15
Joined: Mon, 2007-05-21, 02:17

#3 Post by peer9802 »

I have made a little progress. I can now execute some code if I use the CXXFLAGS=-m64 compiler flag (e.g. manipulate DICOM header). The issue remaining is the jpeg library does not build. I get the following compiler error when running the "make all" script:

Code: Select all

c++ -O -I/usr/include/libxml2 -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -m64 -L/Volumes/DATA/ProgrammingResources/zlib-1.2.3/lib  -L../libsrc -L../../dcmjpeg/libsrc -L../../dcmjpeg/libijg8 -L../../dcmjpeg/libijg12 -L../../dcmjpeg/libijg16 -L../../dcmimage/libsrc -L../../dcmimgle/libsrc -L../../dcmdata/libsrc -L../../ofstd/libsrc -o dcmdjpeg dcmdjpeg.o  -ldcmjpeg -lijg8 -lijg12 -lijg16 -ldcmimage -ldcmimgle -ldcmdata -lofstd   -lz -lm -lpthread 
ld: warning in ../../dcmjpeg/libijg8/libijg8.a, file is not of required architecture
ld: warning in ../../dcmjpeg/libijg12/libijg12.a, file is not of required architecture
ld: warning in ../../dcmjpeg/libijg16/libijg16.a, file is not of required architecture
Undefined symbols:
  "_jpeg8_stdio_dest", referenced from:
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
  "_jpeg8_start_compress", referenced from:
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
  "_jpeg12_destroy_decompress", referenced from:
      DJDecompressIJG12Bit::cleanup()      in libdcmjpeg.a(djdijg12.o)
  "_jpeg16_destroy_decompress", referenced from:
      DJDecompressIJG16Bit::cleanup()      in libdcmjpeg.a(djdijg16.o)
  "_jpeg8_finish_compress", referenced from:
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
  "_jpeg8_write_scanlines", referenced from:
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
  "_jpeg16_resync_to_restart", referenced from:
      DJDecompressIJG16Bit::init()      in libdcmjpeg.a(djdijg16.o)
  "_jpeg8_set_defaults", referenced from:
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
  "_jpeg8_read_scanlines", referenced from:
      DJDecompressIJG8Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg8.o)
  "_jpeg8_resync_to_restart", referenced from:
      DJDecompressIJG8Bit::init()      in libdcmjpeg.a(djdijg8.o)
  "_jpeg12_std_error", referenced from:
      DJDecompressIJG12Bit::init()      in libdcmjpeg.a(djdijg12.o)
  "_jpeg8_CreateDecompress", referenced from:
      DJDecompressIJG8Bit::init()      in libdcmjpeg.a(djdijg8.o)
  "_jpeg8_std_error", referenced from:
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
      DJDecompressIJG8Bit::init()      in libdcmjpeg.a(djdijg8.o)
  "_jpeg16_read_header", referenced from:
      DJDecompressIJG16Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg16.o)
  "_jpeg8_destroy_decompress", referenced from:
      DJDecompressIJG8Bit::cleanup()      in libdcmjpeg.a(djdijg8.o)
  "_jpeg16_finish_decompress", referenced from:
      DJDecompressIJG16Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg16.o)
  "_jpeg8_start_decompress", referenced from:
      DJDecompressIJG8Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg8.o)
  "_jpeg12_resync_to_restart", referenced from:
      DJDecompressIJG12Bit::init()      in libdcmjpeg.a(djdijg12.o)
  "_jpeg8_finish_decompress", referenced from:
      DJDecompressIJG8Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg8.o)
  "_jpeg16_read_scanlines", referenced from:
      DJDecompressIJG16Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg16.o)
  "_jpeg12_CreateDecompress", referenced from:
      DJDecompressIJG12Bit::init()      in libdcmjpeg.a(djdijg12.o)
  "_jpeg12_read_header", referenced from:
      DJDecompressIJG12Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg12.o)
  "_jpeg16_CreateDecompress", referenced from:
      DJDecompressIJG16Bit::init()      in libdcmjpeg.a(djdijg16.o)
  "_jpeg12_start_decompress", referenced from:
      DJDecompressIJG12Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg12.o)
  "_jpeg12_finish_decompress", referenced from:
      DJDecompressIJG12Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg12.o)
  "_jpeg8_set_quality", referenced from:
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
  "_jpeg16_start_decompress", referenced from:
      DJDecompressIJG16Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg16.o)
  "_jpeg8_read_header", referenced from:
      DJDecompressIJG8Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg8.o)
  "_jpeg8_destroy_compress", referenced from:
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
  "_jpeg8_CreateCompress", referenced from:
      DiJPEGPlugin::write(DiImage*, __sFILE*, unsigned long) constin libdcmjpeg.a(dipijpeg.o)
  "_jpeg12_read_scanlines", referenced from:
      DJDecompressIJG12Bit::decode(unsigned char*, unsigned int, unsigned char*, unsigned int, bool)in libdcmjpeg.a(djdijg12.o)
  "_jpeg16_std_error", referenced from:
      DJDecompressIJG16Bit::init()      in libdcmjpeg.a(djdijg16.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [dcmdjpeg] Error 1
make[1]: *** [apps-all] Error 2
make: *** [dcmjpeg-all] Error 2

Any ideas?
Eric

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#4 Post by Michael Onken »

I just googled a bit and this seems to be a problem with the different flavours of Universal Binaries available. On a 64bit Mac OS X machine a UB might contain code for 4 (!) architectures and it seems that per default gcc selects not the correct ones when building. Though I don't have the possibilty to try it out, you might try to add -arch x86_64 as a parameter to gcc (which is an Apple specific switch).

Additionally you have to be sure that any 3rd party libraries you build (zlib etc) provide the same kind of information.

That's only a guess but maybe worth trying out :wink:

Regards,
Michael

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#5 Post by Michael Onken »

My colleague Jörg noted something a minute ago:

The ijg JPEG libraries are plain C code - maybe the CXXFLAGS you set are not evaluated at all when the compiler is in C mode. Try to provide the -m64 compiler flag also as CFLAGS option to the compiler.

Good luck,
Michael

peer9802
Posts: 15
Joined: Mon, 2007-05-21, 02:17

#6 Post by peer9802 »

Compiling with "CXXFLAGS=-m64 CFLAGS=-m64" got rid of the compile errors. Thanks!

I think I'm down to my last issue and it is related to the dicom dictionary. I have set the DCMDICTPATH environment variable to the location of my "dicom.dic" file; however, the DicomImage->getStatus() function is still saying I haven't loaded a dictionary (the library is loaded when I execute dcmdump). I have tried to set the DCMDICTPATH prior to creating a new DicomImage by calling the following code but have still not succeeded. The environment variable return is correct (at least from what I can tell). I have read through many of the other posts and the solutions don't aren't working. Any other ideas?

Code: Select all

        setenv("DCMDICTPATH", "/Volumes/DATA/dicom.dic",1);
	const char *dcmpaths = getenv("DCMDICTPATH");
	NSLog(@"The dictionary path is %s", dcmpaths);

DcmFileFormat fileformat;
	const void *pixels;
	unsigned char* dataValues;
	OFCondition status = fileformat.loadFile([currentFileName UTF8String]);
	FILE *outputImage;
	char fileToWrite[200];
	int imagePixelOffset = 0;
	
	if (status.good())
	{
		DcmDataset *dataset= fileformat.getDataset();
		DicomImage *image = new DicomImage([currentFileName UTF8String]); //filePath
		NSLog(@"got past new DicomImage.  Status = %i", image->getStatus());
.
.
.
.
Eric

peer9802
Posts: 15
Joined: Mon, 2007-05-21, 02:17

#7 Post by peer9802 »

To clarify, I have also tried to create a built-in dictionary using the procedure outlined in datadict.txt. Everything appears to compile correctly but dcmdump states a dictionary has not been loaded.

My procedure is
1) Goto dcmtk-3.5.4 directory.
2) ./configure CXXFLAGS=-m64 CFLAGS=-m64 --prefix=locationX --with-zlibinc=locationY --disable-threads --enable-std-includes
3) Goto dcmdata/libsrc/ directory.
4) run "make builtindict"
5) go back to dcmtk-3.5.4 directory.
6) run "make all"
7) run "make install"

Am I missing something?
Eric

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#8 Post by Michael Onken »

Hi Peer,

I compiled the CVS version of DCMTK on my 64bit Mac Notebook (running Leopard) and the dictionary works fine for me (with --prefix set and "make install"). The path is automatically set to the dicitionary in the prefix path then.

Are you sure that your DCMDICTPATH actually points to the file dicom.dic but not only to its directory? I can set my DCMDICTPATH without problems in Apple's Terminal with "export DCMDICTPATH=/xxx/yyy/dicom.dic".

If you want to try out the CVS version, please write an email to dicom (at) offis (dot) de so we can provide a corresponding download link to you.

Regards,
Michael

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest