Skip to content

Fix build error on Windows with Clang#1069

Closed
SpinnerX wants to merge 1 commit intogoogle:mainfrom
SpinnerX:fix
Closed

Fix build error on Windows with Clang#1069
SpinnerX wants to merge 1 commit intogoogle:mainfrom
SpinnerX:fix

Conversation

@SpinnerX
Copy link
Copy Markdown

@SpinnerX SpinnerX commented Jun 4, 2024

Resolves #1018

@SpinnerX
Copy link
Copy Markdown
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.

@ondys
Copy link
Copy Markdown
Collaborator

ondys commented Sep 4, 2025

I believe this should be resolved by #987
Please reopen the PR if the issue persists

@ondys ondys closed this Sep 4, 2025
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

2 participants