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 build error on Windows with Clang #1069

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

SpinnerX
Copy link

@SpinnerX SpinnerX commented Jun 4, 2024

Resolves #1018

@SpinnerX
Copy link
Author

SpinnerX commented Jun 5, 2024

The build was failing with Clang on Windows due to order of precedence of the macros for determining file size.

C:\Users\heraa.conan2\p\b\draco1d23f170ed5b0\b\src\src\draco\io\stdio_file_reader.cc:91:48: error: use of undeclared identifier 'ftello'; did you mean 'ftell'?

The _FILE_OFFSET_BITS macro is defined in the file cmake\draco_build_definitions.cmake. The code in question is the part below.

if(NOT MSVC)
    if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
      # Ensure 64-bit platforms can support large files.
      list(APPEND draco_defines "_LARGEFILE_SOURCE" "_FILE_OFFSET_BITS=64")
    endif()

When _FILE_OFFSET_BITS is defined, it uses the linux only C API which fails on Windows. I decided to only change the macro order in the header file src\draco\io\stdio_file_reader.cc because I wasn't sure if there were other potential use cases for this macro in the future.

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.

Cannot build with clang on windows
1 participant