Error while building DCMTK lib for ANDROID

Compilation and installation of DCMTK

Moderator: Moderator Team

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

Re: Error while building DCMTK lib for ANDROID

#46 Post by ashajg » Thu, 2018-11-08, 13:34

Sir

this #undef pw_gecos fix worked for me.
26 .so files are created.
Just need to know if this will have an impact on later stage and secondly if you are going to update dcmtk according to this change?

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

Re: Error while building DCMTK lib for ANDROID

#47 Post by Jan Schlamelcher » Thu, 2018-11-08, 14:43

ashajg wrote:Just need to know if this will have an impact on later stage
Probably not, but one can't be sure. You will run into problems if you use code that depends on the define and also includes (directly or indirectly) ofstd/ofpwd.h. My guess would be that this is very unlikely, but you cannot be 100% sure.
ashajg wrote:If you are going to update dcmtk according to this change?
I think I will add some code as I posted before that #undefines pw_gecos inside ofpwd.h and defines it back to pw_passwd afterwards as this should be the most robust solution.

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

Re: Error while building DCMTK lib for ANDROID

#48 Post by ashajg » Fri, 2018-11-09, 11:58

Jan Schlamelcher wrote:
ashajg wrote:Just need to know if this will have an impact on later stage
Probably not, but one can't be sure. You will run into problems if you use code that depends on the define and also includes (directly or indirectly) ofstd/ofpwd.h. My guess would be that this is very unlikely, but you cannot be 100% sure.
ashajg wrote:If you are going to update dcmtk according to this change?
I think I will add some code as I posted before that #undefines pw_gecos inside ofpwd.h and defines it back to pw_passwd afterwards as this should be the most robust solution.
OK sir

Thank you very much for help :D

liusunping
Posts: 6
Joined: Mon, 2020-06-22, 12:07

Re: Error while building DCMTK lib for ANDROID

#49 Post by liusunping » Mon, 2020-06-29, 10:54

Jan Schlamelcher wrote:
Thu, 2018-11-08, 11:53
Turns out there is no good way to workaround this issue. The best way is probably to put #undef pw_gecos in line 35 of ofstd/include/dcmtk/ofstd/ofpwd.h, but this would of course have the side effect that everyone including this file loses the definition. While this would fix the issue at hand, it might lead to problems later on. There is simply no portable way to temporary undefine a preprocessor marco and the () trick I used for working around Microsoft's min/max defines seems to only work on functions, but not on member variables.
Can you try it with the #undef? If that works, I will perhaps add something like:

Code: Select all

#ifdef PASSWD_GECOS_IS_DEFINED_TO_PASSWD
#undef pw_gecos
#endif
...
#ifdef PASSWD_GECOS_IS_DEFINED_TO_PASSWD
#define pw_gecos pw_passwd
#endif
as the least sucking solution.
sir ,
I have the same problem,ndk :android-ndk-r21b,dcmtk:3.6.5,ANDROID_NATIVE_API_LEVEL:24
error log:
In file included from /mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:179:
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/ofpwd.h:87:14: error: duplicate member 'pw_passwd'
OFString pw_gecos;
^
/mnt/e/ndk/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/pwd.h:77:19: note: expanded from macro 'pw_gecos'
# define pw_gecos pw_passwd
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/ofpwd.h:84:14: note: previous declaration is here
OFString pw_passwd;
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:1179:17: warning: 'readdir_r' is deprecated: readdir_r is deprecated; use readdir instead [-Wdeprecated-declarations]
while (!readdir_r(dirPtr, &d, &entry) && entry)
^
/mnt/e/ndk/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/dirent.h:87:92: note: 'readdir_r' has been explicitly marked deprecated here
int readdir_r(DIR* __dir, struct dirent* __entry, struct dirent** __buffer) __attribute__((__deprecated__("readdir_r is deprecated; use readdir instead")));
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:2959:3: error: multiple initializations given for non-static member 'pw_passwd'
, pw_gecos()
^~~~~~~~~~
/mnt/e/ndk/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/pwd.h:77:19: note: expanded from macro 'pw_gecos'
# define pw_gecos pw_passwd
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:2958:3: note: previous initialization is here
, pw_passwd()
^~~~~~~~~~~
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:2971:3: error: multiple initializations given for non-static member 'pw_passwd'
, pw_gecos()
^~~~~~~~~~
/mnt/e/ndk/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/pwd.h:77:19: note: expanded from macro 'pw_gecos'
# define pw_gecos pw_passwd
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:2970:3: note: previous initialization is here
, pw_passwd()
^~~~~~~~~~~
1 warning and 3 errors generated.
ofstd/libsrc/CMakeFiles/ofstd.dir/build.make:398: recipe for target 'ofstd/libsrc/CMakeFiles/ofstd.dir/ofstd.cc.o' failed
make[2]: *** [ofstd/libsrc/CMakeFiles/ofstd.dir/ofstd.cc.o] Error 1
CMakeFiles/Makefile2:195: recipe for target 'ofstd/libsrc/CMakeFiles/ofstd.dir/all' failed
make[1]: *** [ofstd/libsrc/CMakeFiles/ofstd.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

I refer to your answer,add code in line 35 of ofstd/include/dcmtk/ofstd/ofpwd.h,

#ifdef PASSWD_GECOS_IS_DEFINED_TO_PASSWD
#undef pw_gecos
#endif

#ifdef PASSWD_GECOS_IS_DEFINED_TO_PASSWD
#define pw_gecos pw_passwd
#endif

but also wrong

liusunping
Posts: 6
Joined: Mon, 2020-06-22, 12:07

Re: Error while building DCMTK lib for ANDROID

#50 Post by liusunping » Tue, 2020-06-30, 09:28

liusunping wrote:
Mon, 2020-06-29, 10:54
Jan Schlamelcher wrote:
Thu, 2018-11-08, 11:53
Turns out there is no good way to workaround this issue. The best way is probably to put #undef pw_gecos in line 35 of ofstd/include/dcmtk/ofstd/ofpwd.h, but this would of course have the side effect that everyone including this file loses the definition. While this would fix the issue at hand, it might lead to problems later on. There is simply no portable way to temporary undefine a preprocessor marco and the () trick I used for working around Microsoft's min/max defines seems to only work on functions, but not on member variables.
Can you try it with the #undef? If that works, I will perhaps add something like:

Code: Select all

#ifdef PASSWD_GECOS_IS_DEFINED_TO_PASSWD
#undef pw_gecos
#endif
...
#ifdef PASSWD_GECOS_IS_DEFINED_TO_PASSWD
#define pw_gecos pw_passwd
#endif
as the least sucking solution.
sir ,
I have the same problem,ndk :android-ndk-r21b,dcmtk:3.6.5,ANDROID_NATIVE_API_LEVEL:24
error log:
In file included from /mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:179:
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/ofpwd.h:87:14: error: duplicate member 'pw_passwd'
OFString pw_gecos;
^
/mnt/e/ndk/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/pwd.h:77:19: note: expanded from macro 'pw_gecos'
# define pw_gecos pw_passwd
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/include/dcmtk/ofstd/ofpwd.h:84:14: note: previous declaration is here
OFString pw_passwd;
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:1179:17: warning: 'readdir_r' is deprecated: readdir_r is deprecated; use readdir instead [-Wdeprecated-declarations]
while (!readdir_r(dirPtr, &d, &entry) && entry)
^
/mnt/e/ndk/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/dirent.h:87:92: note: 'readdir_r' has been explicitly marked deprecated here
int readdir_r(DIR* __dir, struct dirent* __entry, struct dirent** __buffer) __attribute__((__deprecated__("readdir_r is deprecated; use readdir instead")));
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:2959:3: error: multiple initializations given for non-static member 'pw_passwd'
, pw_gecos()
^~~~~~~~~~
/mnt/e/ndk/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/pwd.h:77:19: note: expanded from macro 'pw_gecos'
# define pw_gecos pw_passwd
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:2958:3: note: previous initialization is here
, pw_passwd()
^~~~~~~~~~~
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:2971:3: error: multiple initializations given for non-static member 'pw_passwd'
, pw_gecos()
^~~~~~~~~~
/mnt/e/ndk/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/pwd.h:77:19: note: expanded from macro 'pw_gecos'
# define pw_gecos pw_passwd
^
/mnt/e/dicom/v7a/dcmtk-3.6.5/ofstd/libsrc/ofstd.cc:2970:3: note: previous initialization is here
, pw_passwd()
^~~~~~~~~~~
1 warning and 3 errors generated.
ofstd/libsrc/CMakeFiles/ofstd.dir/build.make:398: recipe for target 'ofstd/libsrc/CMakeFiles/ofstd.dir/ofstd.cc.o' failed
make[2]: *** [ofstd/libsrc/CMakeFiles/ofstd.dir/ofstd.cc.o] Error 1
CMakeFiles/Makefile2:195: recipe for target 'ofstd/libsrc/CMakeFiles/ofstd.dir/all' failed
make[1]: *** [ofstd/libsrc/CMakeFiles/ofstd.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

I refer to your answer,add code in line 35 of ofstd/include/dcmtk/ofstd/ofpwd.h,

#ifdef PASSWD_GECOS_IS_DEFINED_TO_PASSWD
#undef pw_gecos
#endif

#ifdef PASSWD_GECOS_IS_DEFINED_TO_PASSWD
#define pw_gecos pw_passwd
#endif

but also wrong
I solved this problem
add #undef pw_gecos in line 35 of ofstd/include/dcmtk/ofstd/ofpwd.h,Maybe it is due to language, I immediately mistaken your previous answer

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest