问题
I'm trying to build the mailcore2 library on linux (Ubuntu 18.04) but having a hard time. (Mostly) following the directions on their repo here: https://github.com/MailCore/mailcore2/blob/master/build-linux/README.md
So first I install dependencies (that all goes fine):
sudo apt-get install libctemplate-dev libicu-dev libsasl2-dev libtidy-dev \
uuid-dev libxml2-dev libglib2.0-dev autoconf automake libtool cmake
Then it instructs how to build libetpan, but I'm using the updated instructions from the libtepan repo: https://github.com/dinhviethoa/libetpan:
git clone https://github.com/dinhviethoa/libetpan
cd libetpan
./autogen.sh
make
sudo make install
Finally I try to build MailCore:
git clone https://github.com/MailCore/mailcore2
cd mailcore2
mkdir build
cd build
cmake ..
make
But no matter what commit I'm using, I always get the following error:
In file included from /home/<USER>/mailcore2/src/core/basetypes/MCString.h:7:0,
from /home/<USER>/mailcore2/src/core/basetypes/MCData.cpp:24:
/home/<USER>/mailcore2/build/src/include/MailCore/MCICUTypes.h:16:25: error: conflicting declaration ‘typedef short unsigned int UChar’
typedef __CHAR16_TYPE__ UChar;
^~~~~
In file included from /usr/include/unicode/utypes.h:38:0,
from /usr/include/unicode/ucsdet.h:24,
from /home/<USER>/mailcore2/src/core/basetypes/MCData.cpp:15:
/usr/include/unicode/umachine.h:347:22: note: previous declaration as ‘typedef char16_t UChar’
typedef char16_t UChar;
^~~~~
src/CMakeFiles/MailCore.dir/build.make:182: recipe for target 'src/CMakeFiles/MailCore.dir/core/basetypes/MCData.cpp.o' failed
make[2]: *** [src/CMakeFiles/MailCore.dir/core/basetypes/MCData.cpp.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/MailCore.dir/all' failed
make[1]: *** [src/CMakeFiles/MailCore.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I've been using it on iOS (via CocoaPods) for a while, but wanted to move my email functionality to the server-side. I opened an issue on Github, but no traction yet.
回答1:
In /home/<USER>/mailcore2/build/src/include/MailCore/MCICUTypes.h
replace:
typedef __CHAR16_TYPE__ UChar;
with:
typedef char16_t UChar;
then run:
make clean
make
来源:https://stackoverflow.com/questions/62644650/building-mailcore2-on-linux