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

[OSX] compiler error with lzo-2.08 #6069

Closed
DorpsGek opened this issue Jul 28, 2014 · 2 comments
Closed

[OSX] compiler error with lzo-2.08 #6069

DorpsGek opened this issue Jul 28, 2014 · 2 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

kernigh2 opened the ticket and wrote:

I have a PowerBook G4 with a PowerPC processor and Mac OS X 10.4.11 Tiger. The binary from openttd.org crashes on startup because of #5694. So I compiled my own binary.

While compiling OpenTTD 1.4.1, I got a compiler error from lzo/lzodefs.h about length of some array being negative. My lzo2 library and headers are from lzo 2.08.

The error happens because src/os/macosx/osx_stdafx.h contains these lines

/* LP64 only exists in 10.5 and higher */
# if defined(APPLE) && !defined(LP64)
# define LP64 0
# endif

Then lzo/lzodefs.h contains these lines

# elif defined(LP64) || defined(__LP64) || defined(_LP64)
LZO_COMPILE_TIME_ASSERT_HEADER(sizeof(long) == 8)
# define LZO_SIZEOF_VOID_P 8
# elif (LZO_ARCH_AVR)

OpenTTD has defined LP64 to 0, so defined(LP64) is true. Therefore, lzo makes a compile-time assertion that sizeof(long) == 8. This assertion fails because long has 4 bytes here. When an assertion fails, lzo makes an array of negative length.

If lzo2 is correct, LP64 must be defined or not defined. One should never define LP64 to 0.

To fix this error, I deleted this definition of LP64. I got several compiler warnings about LP64 not being defined, so I then changed OpenTTD to check defined(LP64) instead of LP64. I have attached my patch in the file openttd-lp64.diff.

Attachments

Reported version: 1.4.1
Operating system: Mac OS X


This issue was imported from FlySpray: https://bugs.openttd.org/task/6069
@DorpsGek
Copy link
Member Author

kernigh2 wrote:

To finish the build, I need both this patch and my other patch on #6070.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6069#comment13418

@DorpsGek
Copy link
Member Author

planetmaker closed the ticket.

Reason for closing: Fixed

In r26709. Thanks for the patch :) Keep them coming.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6069

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant