Error while building DCMTK lib for ANDROID
Moderator: Moderator Team
Re: Error while building DCMTK lib for ANDROID
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?
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?
-
- OFFIS DICOM Team
- Posts: 318
- Joined: Mon, 2014-03-03, 09:51
- Location: Oldenburg, Germany
Re: Error while building DCMTK lib for ANDROID
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:Just need to know if this will have an impact on later stage
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 wrote:If you are going to update dcmtk according to this change?
Re: Error while building DCMTK lib for ANDROID
OK sirJan Schlamelcher wrote: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:Just need to know if this will have an impact on later stage
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 wrote:If you are going to update dcmtk according to this change?
Thank you very much for help
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
-
- Posts: 6
- Joined: Mon, 2020-06-22, 12:07
Re: Error while building DCMTK lib for ANDROID
sir ,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'smin/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:as the least sucking solution.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
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
-
- Posts: 6
- Joined: Mon, 2020-06-22, 12:07
Re: Error while building DCMTK lib for ANDROID
I solved this problemliusunping wrote: ↑Mon, 2020-06-29, 10:54sir ,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'smin/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:as the least sucking solution.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
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
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
Re: Error while building DCMTK lib for ANDROID
Hi, I'm trying to build dcmtk on Android and I keep failing. This post might be a bit lengthy and I'm sorry for that. But I hope someone finds time for this ^_^'
I have cloned dcmtk 3.6.7 from Github just a few days ago.
I have followed this topic so far and made some necessary changes in the script dcmtkUseAndroidSDK.cmake itself but to no avail.
What I did:
-------------------------------
1 - line 130
I have changed the emulator path from ~tools/emulator to ~emulator/emulator:
find_program(ANDROID_EMULATOR_PROGRAM emulator PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES emulator NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
That was necessary because the tool will otherwise yield this error:
"PANIC: Missing emulator engine program for 'x86' CPUS."
2 - line 132
Using android.bat seems to be deprecated, so I've changed that line to:
find_program(ANDROID_ANDROID_PROGRAM avdmanager.bat PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES tools/bin NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-------------------------------
Doing 1 and 2 makes the parser in line 145 work.
ANDROID_AVAILABLE_AVDS is then "Pixel_XL_API_30;Pixel_XL_API_30_2" (These two AVD are actually the same and work fine).
But the subsequent ANDROID_EMULATOR_AVD stays empty. I forced it to "Pixel_XL_API_30", but that still didn't do the job.
In line 319, the command to start the AVD is called and I invoked it by hand in the terminal to see what it does but it gave an error saying the -prop (ro.emu.uuid=...) passed is unknown.
Just calling ~emulator/emulator.exe -avd Pixel_XL_API_30 in the terminal starts the AVD, so that seems to work. From here on, I have no idea what to do, so I'd need your help. I also ask myself why do I need an AVD? So far, for building and running Android applications I did not need one. I'm using the device directly. As I have understood the configuration steps so far, this leads to the generation of config/arith.h and I guess other files as well. Couldn't that be done with setting an AVD altogether as I could specify the CPU architecture and Android API version and whatnot via variables.
As for general info: I am using the Qt Creator, writing programs in C++, running them on both, PC and Android devices and I'm using the Qt Creator to setup dcmtk. That worked out of the box for the PC (Windows) case, which makes me very happy, but completely failed for Android.
Kind Regards,
mahanako
I have cloned dcmtk 3.6.7 from Github just a few days ago.
I have followed this topic so far and made some necessary changes in the script dcmtkUseAndroidSDK.cmake itself but to no avail.
What I did:
-------------------------------
1 - line 130
I have changed the emulator path from ~tools/emulator to ~emulator/emulator:
find_program(ANDROID_EMULATOR_PROGRAM emulator PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES emulator NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
That was necessary because the tool will otherwise yield this error:
"PANIC: Missing emulator engine program for 'x86' CPUS."
2 - line 132
Using android.bat seems to be deprecated, so I've changed that line to:
find_program(ANDROID_ANDROID_PROGRAM avdmanager.bat PATHS ${ANDROID_SDK_ROOT} PATH_SUFFIXES tools/bin NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-------------------------------
Doing 1 and 2 makes the parser in line 145 work.
ANDROID_AVAILABLE_AVDS is then "Pixel_XL_API_30;Pixel_XL_API_30_2" (These two AVD are actually the same and work fine).
But the subsequent ANDROID_EMULATOR_AVD stays empty. I forced it to "Pixel_XL_API_30", but that still didn't do the job.
In line 319, the command to start the AVD is called and I invoked it by hand in the terminal to see what it does but it gave an error saying the -prop (ro.emu.uuid=...) passed is unknown.
Just calling ~emulator/emulator.exe -avd Pixel_XL_API_30 in the terminal starts the AVD, so that seems to work. From here on, I have no idea what to do, so I'd need your help. I also ask myself why do I need an AVD? So far, for building and running Android applications I did not need one. I'm using the device directly. As I have understood the configuration steps so far, this leads to the generation of config/arith.h and I guess other files as well. Couldn't that be done with setting an AVD altogether as I could specify the CPU architecture and Android API version and whatnot via variables.
As for general info: I am using the Qt Creator, writing programs in C++, running them on both, PC and Android devices and I'm using the Qt Creator to setup dcmtk. That worked out of the box for the PC (Windows) case, which makes me very happy, but completely failed for Android.
Kind Regards,
mahanako
Re: Error while building DCMTK lib for ANDROID
I've decided to post my question as a new topic:
https://forum.dcmtk.org/viewtopic.php?f=3&t=5228
https://forum.dcmtk.org/viewtopic.php?f=3&t=5228
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest