Can't Compile for Windows under Ubuntu 20.04 ( GDNative )

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Karim

I have Ubuntu 20.04, i am using GDNative in a project and i can compile for linux just fine but when i compile for windows and i have mingw installed as said in the doc it throw a g++ error "Command line option not found. Did you mean… so this is a compiler error i guess. So how to fix this ? Has anyone compiled for windows under linux please help me.

How exactly are you compiling? From IDE (which one?) from cli, with make, cmake, scons, whatever?
Did you test mingw compilation for other projects?

I have the same os and custom makefile. Everything works ok.

sash-rc | 2021-02-12 21:06

:bust_in_silhouette: Reply From: yrtv

Use Docker. Containers used for official build can be found here.:

I edited the answer to update my script with registry name(this is new security requirement on some distros). If your module still does not build check your Sconstruruct file(one which you wrote for your module) for typos.

My personal interactive mega container for Win/JS/Android:

FROM docker.io/fedora:latest

RUN cd /root && \
echo 'fastestmirror=true' >> /etc/dnf/dnf.conf && \
dnf -y upgrade && \
dnf -y install scons mingw64-gcc-c++ mingw64-winpthreads-static \
     mingw32-gcc-c++ mingw32-winpthreads-static make binutils \
     yasm which xz lbzip2 java-1.8.0-openjdk-devel git unzip && \
dnf -y clean all && \
curl -O 'https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash' && \
echo '. ~/git-completion.bash' >> ./.bashrc && \
curl -O 'https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh' && \
echo '. ~/git-prompt.sh' >> ./.bashrc && \
echo 'export GIT_PS1_SHOWDIRTYSTATE=1' >> ./.bashrc && \
echo export PS1=\'\\w\$'(__git_ps1 " (%s)")'\\$ \' >> ./.bashrc && \
curl -LO 'https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip' && \
mkdir ./android && \
unzip ./commandlinetools-linux-6609375_latest.zip -d ./android/cmdline-tools && \
rm ./commandlinetools-linux-6609375_latest.zip && \
echo 'export ANDROID_HOME=~/android/' >> ./.profile && \
echo 'export ANDROID_NDK_ROOT=~/android/ndk-bundle/' >> ./.profile && \
echo 'export ANDROID_NDK_HOME=~/android/ndk-bundle/' >> ./.profile && \
mkdir ./.android && \
touch ./.android/repositories.cfg && \
yes | ./android/cmdline-tools/tools/bin/sdkmanager --licenses && \
./android/cmdline-tools/tools/bin/sdkmanager --install ndk-bundle && \
git clone https://github.com/emscripten-core/emsdk.git && \
./emsdk/emsdk install latest && \
./emsdk/emsdk activate latest && \
echo '. ~/emsdk/emsdk_env.sh' >> ./.bashrc && \
git clone https://github.com/godotengine/godot.git

CMD ["/bin/bash"]