Mingw cross-compilation build fails
- Dominant language
- C++
- Stars
- 32.1k
- Forks
- 6.9k
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Description
### Expected behavior
Can build rocksdb on MinGW (cross compilation on linux for mingw)
### Actual behavior
- https://github.com/facebook/rocksdb/blob/master/port/port_posix.h#L24 - redefinition error
- https://github.com/facebook/rocksdb/blob/master/port/port_posix.h#L54 - no header `endian.h`
### Steps to reproduce the behavior
```bash
# docker run -it ubuntu:18.04 bash
apt-get update
apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git g++-mingw-w64-x86-64 ccache nsis
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
apt-get install cmake
git clone https://github.com/facebook/rocksdb
cd rocksdb
mkdir build
cd build
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ cmake ..
make
```
See this error:
```bash
Scanning dependencies of target rocksdb-shared
[ 0%] Building CXX object CMakeFiles/rocksdb-shared.dir/cache/cache.cc.o
In file included from /opt/rocksdb/port/port.h:18:0,
from /opt/rocksdb/cache/sharded_cache.h:15,
from /opt/rocksdb/cache/lru_cache.h:13,
from /opt/rocksdb/cache/cache.cc:12:
/opt/rocksdb/port/port_posix.h:24:0: error: "__declspec" redefined [-Werror]
#define __declspec(S)
: note: this is the location of the previous definition
In file included from /opt/rocksdb/port/port.h:18:0,
from /opt/rocksdb/cache/sharded_cache.h:15,
from /opt/rocksdb/cache/lru_cache.h:13,
from /opt/rocksdb/cache/cache.cc:12:
/opt/rocksdb/port/port_posix.h:54:12: fatal error: endian.h: No such file or directory
#include
^~~~~~~~~~
cc1plus: all warnings being treated as errors
compilation terminated.
CMakeFiles/rocksdb-shared.dir/build.make:62: recipe for target 'CMakeFiles/rocksdb-shared.dir/cache/cache.cc.o' failed
make[2]: *** [CMakeFiles/rocksdb-shared.dir/cache/cache.cc.o] Error 1
CMakeFiles/Makefile2:2868: recipe for target 'CMakeFiles/rocksdb-shared.dir/all' failed
make[1]: *** [CMakeFiles/rocksdb-shared.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
```
I am sure there are more errors.
Contributor guide
Assessment
This issue has not been assessed yet.