Error while building DCMTK lib for ANDROID

Compilation and installation of DCMTK

Moderator: Moderator Team

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

Re: Error while building DCMTK lib for ANDROID

#16 Post by Jan Schlamelcher » Tue, 2018-10-30, 10:47

It seems to be a configuration issue, e.g. your AVD is not appropriate for the settings you chose Android ABI etc. Quick Google gave me this:
https://stackoverflow.com/questions/379 ... executable

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#17 Post by ashajg » Thu, 2018-11-01, 11:45

So if my emulator is x86 and if I am trying to use for APP_ABI=arm7 then this error will occur??
Ok I ll check this..

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#18 Post by ashajg » Mon, 2018-11-05, 08:09

Hi Sir

That 32-bit ELF problem is solved........

Now I am getting this:

Reusing already running Android device emulator...
Info: DCMTK ZLIB support will be enabled
Info: DCMTK will compile without built-in (compiled-in) dictionary
Info: DCMTK will try to load external dictionary from default path on startup
Info: DCMTK's builtin private dictionary support will be disabled
Info: Thread support will be enabled
Info: Wide char file I/O functions will be disabled
Info: Wide char main function for command line tools will be disabled
Info: Building DCMTK without character set conversion support
Info: Building DCMTK with large file support (LFS)
Info: C++11 features disabled
Info: STL vector support disabled
Info: STL algorithm support disabled
Info: STL limits support disabled
Info: STL list support disabled
Info: STL map support disabled
Info: STL memory support disabled
Info: STL stack support disabled
Info: STL string support disabled
Info: STL type_traits support disabled
Info: STL tuple support disabled
Info: STL system_error support disabled
CMake Error at CMake/GenerateDCMTKConfigure.cmake:1259 (MESSAGE):
"/cache/arith.cc": error: only position independent executables (PIE) are
supported.


Aborted

Call Stack (most recent call first):
CMakeLists.txt:53 (INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES)

how can i solve this PIE issue??

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#19 Post by ashajg » Mon, 2018-11-05, 09:46

i have ticked on Build_Shared_Libs check box.

still getting this error
CMake Error at CMake/GenerateDCMTKConfigure.cmake:1259 (MESSAGE):
"/cache/arith.cc": error: only position independent executables (PIE) are
supported.

Aborted

Call Stack (most recent call first):
CMakeLists.txt:53 (INSPECT_FUNDAMENTAL_ARITHMETIC_TYPES)


I am using NDK r15c....

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

Re: Error while building DCMTK lib for ANDROID

#20 Post by Jan Schlamelcher » Mon, 2018-11-05, 11:58

Now that is strange, shared libs implies PIE afaik. Perhaps the executable is cached? Did you re-configure from scratch after enabling PIE?

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#21 Post by ashajg » Mon, 2018-11-05, 12:38

Hi

I solved this problem :D
Just added ANDROID_NATIVE_API_LEVEL:24 to my CMAKE GUI
configured it and pressed generate button to generate files in destination folder.

Now I am trying to build Libraries in destination folder using MSYS......

I navigated to destination folder using MSYS and then pressed make to get this problem....

212715008@G5CG7324856E /c/Ashish/dcmtkans
$ make
Microsoft Windows [Version 10.0.16299.726]
(c) 2017 Microsoft Corporation. All rights reserved.


it is not building Libraries and showing this after i am passing make command:Microsoft Windows [Version 10.0.16299.726]
(c) 2017 Microsoft Corporation. All rights reserved.


Please suggest me some way to build it.....

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

Re: Error while building DCMTK lib for ANDROID

#22 Post by Jan Schlamelcher » Mon, 2018-11-05, 13:13

I would guess that accidentally, the wrong 'make.exe' gets started, perhaps use the full path to the one that came with msys?

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#23 Post by ashajg » Tue, 2018-11-06, 08:03

Hi sir

it is still giving same output


user@user-PC ~
$ cd /e/TEST

user@user-PC /e/TEST
$ /c/MinGW/msys/1.0/bin/make.exe
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.


Is there a problem in MakeFile??

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#24 Post by ashajg » Tue, 2018-11-06, 09:53

I tried using mingw32-make command instead of make command and got these error
user@USER-PC /e/TEST
$ mingw32-make
[ 0%] Building CXX object ofstd/libsrc/CMakeFiles/ofstd.dir/ofcmdln.cc.o
In file included from E:\dcmtk-3.6.3\ofstd\libsrc\ofcmdln.cc:25:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofcmdln.h:31:
E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/offile.h:792:17: error: no member named

'fseeko' in the global namespace; did you mean 'fseek'?
result = :: fseeko(file_, off, whence);
~~ ^~~~~~
fseek
C:/android-ndk-r18b/sysroot/usr/include\stdio.h:175:5: note: 'fseek' declared
here
int fseek(FILE* __fp, long __offset, int __whence);
^
In file included from E:\dcmtk-3.6.3\ofstd\libsrc\ofcmdln.cc:25:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofcmdln.h:31:
E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/offile.h:825:17: error: no member named

'ftello' in the global namespace; did you mean 'ftell'?
result = :: ftello(file_);
~~ ^~~~~~
ftell
C:/android-ndk-r18b/sysroot/usr/include\stdio.h:176:6: note: 'ftell' declared
here
long ftell(FILE* __fp);
^
In file included from E:\dcmtk-3.6.3\ofstd\libsrc\ofcmdln.cc:25:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofcmdln.h:31:
E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/offile.h:849:30: error: no member named

'fgetpos' in the global namespace
result = STDIO_NAMESPACE fgetpos(file_, pos);
~~~~~~~~~~~~~~~ ^
E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/offile.h:869:30: error: no member named

'fsetpos' in the global namespace
result = STDIO_NAMESPACE fsetpos(file_, pos);
~~~~~~~~~~~~~~~ ^
In file included from E:\dcmtk-3.6.3\ofstd\libsrc\ofcmdln.cc:25:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofcmdln.h:29:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofstring.h:59:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofstream.h:34:
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:911:9: error:
use of undeclared identifier 'fseeko'
if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
^
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:197:5: note: in
instantiation of member function 'std::__ndk1::basic_filebuf<char,
std::__ndk1::char_traits<char> >::seekoff' requested here
basic_filebuf();
^
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:1106:14: note:
in instantiation of member function 'std::__ndk1::basic_filebuf<char,
std::__ndk1::char_traits<char> >::basic_filebuf' requested here
explicit basic_ifstream(const char* __s, ios_base::openmode __mode ...
^
E:\dcmtk-3.6.3\ofstd\libsrc\ofcmdln.cc:1095:32: note: in instantiation of member

function 'std::__ndk1::basic_ifstream<char, std::__ndk1::char_traits<char>

>::basic_ifstream' requested here
STD_NAMESPACE ifstream cmdFile(filename, STD_NAMESPACE ios::in);
^
In file included from E:\dcmtk-3.6.3\ofstd\libsrc\ofcmdln.cc:25:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofcmdln.h:29:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofstring.h:59:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofstream.h:34:
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:913:20: error:
use of undeclared identifier 'ftello'
pos_type __r = ftello(__file_);
^
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:929:9: error:
use of undeclared identifier 'fseeko'
if (fseeko(__file_, __sp, SEEK_SET))
^
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:197:5: note: in
instantiation of member function 'std::__ndk1::basic_filebuf<char,
std::__ndk1::char_traits<char> >::seekpos' requested here
basic_filebuf();
^
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:1106:14: note:
in instantiation of member function 'std::__ndk1::basic_filebuf<char,
std::__ndk1::char_traits<char> >::basic_filebuf' requested here
explicit basic_ifstream(const char* __s, ios_base::openmode __mode ...
^
E:\dcmtk-3.6.3\ofstd\libsrc\ofcmdln.cc:1095:32: note: in instantiation of member

function 'std::__ndk1::basic_ifstream<char, std::__ndk1::char_traits<char>

>::basic_ifstream' requested here
STD_NAMESPACE ifstream cmdFile(filename, STD_NAMESPACE ios::in);
^
In file included from E:\dcmtk-3.6.3\ofstd\libsrc\ofcmdln.cc:25:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofcmdln.h:29:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofstring.h:59:
In file included from E:\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofstream.h:34:
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:993:13: error:
use of undeclared identifier 'fseeko'
if (fseeko(__file_, -__c, SEEK_CUR))
^
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:197:5: note: in
instantiation of member function 'std::__ndk1::basic_filebuf<char,
std::__ndk1::char_traits<char> >::sync' requested here
basic_filebuf();
^
C:\android-ndk-r18b\sources\cxx-stl\llvm-libc++\include\fstream:1106:14: note:
in instantiation of member function 'std::__ndk1::basic_filebuf<char,
std::__ndk1::char_traits<char> >::basic_filebuf' requested here
explicit basic_ifstream(const char* __s, ios_base::openmode __mode ...
^
E:\dcmtk-3.6.3\ofstd\libsrc\ofcmdln.cc:1095:32: note: in instantiation of member

function 'std::__ndk1::basic_ifstream<char, std::__ndk1::char_traits<char>

>::basic_ifstream' requested here
STD_NAMESPACE ifstream cmdFile(filename, STD_NAMESPACE ios::in);
^
8 errors generated.
ofstd\libsrc\CMakeFiles\ofstd.dir\build.make:74: recipe for target 'ofstd/libsrc
/CMakeFiles/ofstd.dir/ofcmdln.cc.o' failed
mingw32-make[2]: *** [ofstd/libsrc/CMakeFiles/ofstd.dir/ofcmdln.cc.o] Error 1
CMakeFiles\Makefile2:199: recipe for target 'ofstd/libsrc/CMakeFiles/ofstd.dir/a
ll' failed
mingw32-make[1]: *** [ofstd/libsrc/CMakeFiles/ofstd.dir/all] Error 2
Makefile:139: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

Is it correct to use mingw32-make instead of make and how can i solve these errors if mingw32-make command is correct..

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

Re: Error while building DCMTK lib for ANDROID

#25 Post by Jan Schlamelcher » Tue, 2018-11-06, 10:11

Well, it seems to build, so using ming32-make seemingly did the trick. I've never seen these errors, might be something you can 'fix' by choosing another standard library (as far as I remember the NDK provides various different C standard library implementations to choose from).

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#26 Post by ashajg » Tue, 2018-11-06, 12:12

So do I have to change CMAKE_CXX_COMPILER_AR and CMAKE_C_COMPILER_AR ??

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#27 Post by ashajg » Tue, 2018-11-06, 12:33

Hi sir

CMAKE_CXX_STANDARD_LIBRARIES are set to this:
-latomic -lm "C:/android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a" "C:/android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++abi.a" "C:/android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a" "C:/android-ndk-r18b/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a" "-ldl"
Should i have to change this ??

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

Re: Error while building DCMTK lib for ANDROID

#28 Post by Jan Schlamelcher » Tue, 2018-11-06, 13:56

I believe there was a special CMake variable for the Android standard library.

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#29 Post by ashajg » Wed, 2018-11-07, 03:55

Hi Sir

I noticed that while configuring CMAKE is TAKING CLANG COMPILER
ANDROID_PLATFORM not set. Defaulting to minimum supported version
16.
Check for working C compiler: C:/android-ndk-r18b/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
Check for working C compiler: C:/android-ndk-r18b/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/android-ndk-r18b/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
Check for working CXX compiler: C:/android-ndk-r18b/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Setting build type to 'Release' as none was specified

Is it OK ??


And Can you please tell me the name of That CMAKE variable for ANDROID STANDARD LIBRARY so that I can check if it is set or not?

ashajg
Posts: 30
Joined: Thu, 2018-10-11, 11:10

Re: Error while building DCMTK lib for ANDROID

#30 Post by ashajg » Wed, 2018-11-07, 06:02

I tried with NDK r15c and getting these errors
C:\Ashish\dcmtkans>make all
[ 0%] Building CXX object ofstd/libsrc/CMakeFiles/ofstd.dir/ofstd.cc.o
In file included from C:\Ashish\dcmtk-3.6.3\ofstd\libsrc\ofstd.cc:179:
C:\Ashish\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofpwd.h:83:14: error: duplicate member 'pw_passwd'
OFString pw_gecos;
^
C:\Android\android-ndk-r15c\sysroot\usr\include\pwd.h:77:19: note: expanded from macro 'pw_gecos'
# define pw_gecos pw_passwd
^
C:\Ashish\dcmtk-3.6.3\ofstd\include\dcmtk/ofstd/ofpwd.h:80:14: note: previous declaration is here
OFString pw_passwd;
^
C:\Ashish\dcmtk-3.6.3\ofstd\libsrc\ofstd.cc:2875:3: error: multiple initializations given for non-static member
'pw_passwd'
, pw_gecos()
^~~~~~~~~~
C:\Android\android-ndk-r15c\sysroot\usr\include\pwd.h:77:19: note: expanded from macro 'pw_gecos'
# define pw_gecos pw_passwd
^
C:\Ashish\dcmtk-3.6.3\ofstd\libsrc\ofstd.cc:2874:3: note: previous initialization is here
, pw_passwd()
^~~~~~~~~~~
C:\Ashish\dcmtk-3.6.3\ofstd\libsrc\ofstd.cc:2887:3: error: multiple initializations given for non-static member
'pw_passwd'
, pw_gecos()
^~~~~~~~~~
C:\Android\android-ndk-r15c\sysroot\usr\include\pwd.h:77:19: note: expanded from macro 'pw_gecos'
# define pw_gecos pw_passwd
^
C:\Ashish\dcmtk-3.6.3\ofstd\libsrc\ofstd.cc:2886:3: note: previous initialization is here
, pw_passwd()
^~~~~~~~~~~
3 errors generated.
make[2]: *** [ofstd/libsrc/CMakeFiles/ofstd.dir/ofstd.cc.o] Error 1
make[1]: *** [ofstd/libsrc/CMakeFiles/ofstd.dir/all] Error 2
make: *** [all] Error 2

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest