Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fix build and link using Cygwin and Mingw32 for Windows 7 x64 #7763

Merged
merged 4 commits into from Oct 7, 2019

Conversation

joestringer
Copy link
Contributor

@joestringer joestringer commented Oct 6, 2019

I have a local Cygwin environment which I've been attempting to use to compile OpenTTD using the Mingw32 toolchain that you can install via the cygwin installer.

With all of the necessary components installed via the mingw32 variations (including lzma, which was hiding in the mingw64-x86_64-xz package), I configure and build like so:

MINGW32_BASEPATH=/usr/x86_64-w64-mingw32/sys-root/mingw
./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/ \
            --with-lzo2=$MINGW32_BASEPATH/lib/liblzo2.a \
            PKG_CONFIG_LIBDIR="$MINGW32_BASEPATH/lib/pkgconfig"
make -j`nproc`

(To launch successfully I had to create a bundle and launch it from the bundle directory, make install doesn't work... but that's minor)

This series of commits fix the build issues and a startup DLL error with gdi32 which prevented compile and launch of OpenTTD on my Windows 7 x64 environment. For more details, see the individual commit messages.

joestringer added 4 commits Oct 6, 2019
Fix the following compile errors:

In file included from openttd/src/debug.h:15:0,
                 from openttd/src/string.cpp:13:
openttd/src/cpu.h:35:19: error: 'uint' was not declared in this scope
 bool HasCPUIDFlag(uint type, uint index, uint bit);

openttd/src/string.cpp: In function 'char* strcasestr(const char*, const char*)':
openttd/src/string.cpp:548:7: error: 'strncasecmp' was not declared in this scope
   if (strncasecmp(haystack, needle, needle_len) == 0) return const_cast<char *>(haystack);

openttd/src/strgen/strgen_base.cpp: In function 'void EmitPlural(Buffer*, char*, int)':
openttd/src/core/alloc_func.hpp:136:6: error: 'alloca' was not declared in this scope
  (T*)alloca((num_elements) * sizeof(T)))

Signed-off-by: Joe Stringer <joe@wand.net.nz>
src/depend/depend.cpp: In constructor 'File::File(const char*)':
src/depend/depend.cpp:170:19: error: 'strdup' was not declared in this scope
   this->dirname = strdup(filename);
                   ^~~~~~

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Fixes the following complaints:

src/network/core/address.cpp: In member function 'const sockaddr_storage* NetworkAddress::GetAddress()':
src/network/core/address.cpp:134:55: error: 'AI_ADDRCONFIG' was not declared in this scope
   this->Resolve(this->address.ss_family, SOCK_STREAM, AI_ADDRCONFIG, nullptr, ResolveLoopProc);

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Prior to this commit, the following is observed when running openttd.exe
that was compiled using mingw32 on x86_64:

> The procedure entry point ScriptBreak could not be located in the
  dynamic link library GDI32.dll

The MSDN docs at the below link state that modules using Uniscribe must
first link against usp10 before gdi32 to avoid this issue:

https://msdn.microsoft.com/en-us/library/windows/desktop/dd319118(v=vs.85).aspx

Signed-off-by: Joe Stringer <joe@wand.net.nz>
@glx22
Copy link
Contributor

@glx22 glx22 commented Oct 6, 2019

MSYS2/MinGW_W64 still works.

LordAro
LordAro approved these changes Oct 7, 2019
@nielsmh nielsmh merged commit 48fd7b2 into OpenTTD:master Oct 7, 2019
8 checks passed
@joestringer joestringer deleted the mingw32 branch Oct 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants