Building DCMTK for Android

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
bmeric
Posts: 6
Joined: Tue, 2011-03-22, 10:00

Building DCMTK for Android

#1 Post by bmeric »

Hi,

I'm trying to build dcmtk on Android but i'm stuck. I downloaded dcmtk-3.6.1_20150217.tar.gz from snapshots and follow instructions from wiki. I tried on both Windows 8.1 and Ubuntu 14.10 with SDK 19, NDK r10d, Cmake 3.2.2.

First error was "string sub-command REGEX, mode MATCHALL needs at least 5 arguments total to" on android.toolchain.cmake:148, i tried changing this section with;

Code: Select all

        #STRING(REGEX MATCHALL "Name:[ \t]*[^\r\n]*" ANDROID_AVAILABLE_AVDS ${OUTPUT})
        #STRING(REGEX REPLACE "Name:[ \t]*([^\r\n;]*)" "\\1" ANDROID_AVAILABLE_AVDS "${ANDROID_AVAILABLE_AVDS}")
        #SET(ANDROID_EMULATOR_AVD "${ANDROID_EMULATOR_AVD}" CACHE STRING "Android emulator Android Virtual Device (AVD) configuration" FORCE)
	SET(ANDROID_EMULATOR_AVD "DCMTK" CACHE STRING "Android emulator Android Virtual Device (AVD) configuration" FORCE)
        #SET_PROPERTY(CACHE ANDROID_EMULATOR_AVD PROPERTY STRINGS ${ANDROID_AVAILABLE_AVDS})
	SET_PROPERTY(CACHE ANDROID_EMULATOR_AVD PROPERTY STRINGS "DCMTK") 
(i'm not familiar with cmake, i thought "ok, my avd name is DCMTK, maybe this is trying to set my avd name", probably stupid change)

After this change, when i click configure and cmake freezed. After couple of changes(to be honest, i don't even remember, i'm trying to build dcmtk almost 2 days) cmake stuck at "Waiting until the Android device emulator is ready to receive instructions" message.

I have builded dcmtk on Windows and Linux withouth any problem but i cannot build it for android. What i'm doing wrong? Is my setup wrong, are dcmtk, sdk, ndk, cmake versions wrong? Is there any prebuilt dcmtk for Android?(I just need binaries like echoscu)

Please advice.

edit: Ok, i find out what the problem was. Wiki says "location of the adb program within your SDK. Called adb.exe under Windows." so i misunderstood that "location" as path but it is executable name with path. After this, cmake generated makefile but i got completion error :( . I guess it's because of ndk versions, i will download and try again with r9d.

edit2: After i installed ndk r9d, it compiled successfully.

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Building DCMTK for Android

#2 Post by Jan Schlamelcher »

bmeric wrote:edit: Ok, i find out what the problem was. Wiki says "location of the adb program within your SDK. Called adb.exe under Windows." so i misunderstood that "location" as path but it is executable name with path. After this, cmake generated makefile but i got completion error :( . I guess it's because of ndk versions, i will download and try again with r9d.
The CMake scripts were created for NDK r10d, so that seems strage. Did you reset the CMake scripts you modified to the original version? Since I guess the errors were follow ups after adb.exe was not found. Btw. I would recommend setting ANDROID_SDK_ROOT instead of setting the executables manually.

bmeric
Posts: 6
Joined: Tue, 2011-03-22, 10:00

Re: Building DCMTK for Android

#3 Post by bmeric »

Jan Schlamelcher wrote:
bmeric wrote:edit: Ok, i find out what the problem was. Wiki says "location of the adb program within your SDK. Called adb.exe under Windows." so i misunderstood that "location" as path but it is executable name with path. After this, cmake generated makefile but i got completion error :( . I guess it's because of ndk versions, i will download and try again with r9d.
The CMake scripts were created for NDK r10d, so that seems strage. Did you reset the CMake scripts you modified to the original version? Since I guess the errors were follow ups after adb.exe was not found. Btw. I would recommend setting ANDROID_SDK_ROOT instead of setting the executables manually.
After i find out about path/filepath mistake, i removed everything about dcmtk and copy from dcmtk-3.6.1_20150217, but it failed again.

Probably i had the older version of android.toolchain.cmake, latest changelog in that file is;

Code: Select all

#   - December 2013
#     [+] updated for NDK r9c
#   - January 2014
#     [~] fix copying of shared STL
#   - April 2014
#     [+] updated for NDK r9d
# ------------------------------------------------------------------------------

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Building DCMTK for Android

#4 Post by Jan Schlamelcher »

What is the actual error? The changelog in the android.toolchain.cmake is from the original authors. We modified it afterwards, but did not update the changelog, because we use git commit messages instead.

bmeric
Posts: 6
Joined: Tue, 2011-03-22, 10:00

Re: Building DCMTK for Android

#5 Post by bmeric »

I don't remember but i can install r10d and test it again. If i recall correctly, it was pointer class in oflog.

bmeric
Posts: 6
Joined: Tue, 2011-03-22, 10:00

Re: Building DCMTK for Android

#6 Post by bmeric »

Well, this is strange. I removed n9d, install r10d/set paths and reinstall dcmtk snapshot and everything works as expected :/ I have no idea what went wrong last time.

de.wang.tang
Posts: 3
Joined: Mon, 2017-08-21, 08:24

Re: Building DCMTK for Android

#7 Post by de.wang.tang »

I want to ask, compile DCMTK in the ubuntu or window ?

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Building DCMTK for Android

#8 Post by Jan Schlamelcher »

I plan on writing a tutorial for that, but I have currently no idea when I'll find the time for it. The existing tutorial in our wiki is now completely outdated since we modified the way DCMTK is build for Android in DCMTK 3.6.2. I'll point you to this for starters: https://cmake.org/cmake/help/v3.7/manua ... or-android . Maybe you can figure the rest out yourself before I finish the tutorial, otherwise please be patient.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests