AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Mozilla Public License 2.0
2.62k stars 647 forks source link

[BUILD] Windows - Visual Studio 2019 : fatal error LNK1248 #1718

Closed nyue closed 9 months ago

nyue commented 10 months ago

Environment

Operating System: (e.g. Windows 2019, macOS-10.15, Linux CentOS 7.4)

Windows 10

Version / Commit SHA: (e.g VDB 7.2, SHA: 1a2b3c4d5e...)

OpenVDB 11.0.0

CMake Version: (e.g. 3.18)

3.25

Compiler: (e.g. gcc 10, msvc 2019)

VS 2019

Describe the problem

Linker error

openvdb\openvdb\libopenvdb.lib : fatal error LNK1248: image size (1017E3216) exceeds maximum allowable size (FFFFFFFF)
[155/156] Building CXX object openvdb_cmd\vdb_print\CMakeFiles\vdb_print.dir\main.cc.obj
ninja: build stopped: subcommand failed.

vdb_print is not critical to me at this point so I can remove it from the build but reporting this anyway.

Idclip commented 9 months ago

Hey @nyue this is usually related to explicit template instatiation. We should probably turn this off on Windows. Try configuring with -D USE_EXPLICIT_INSTANTIATION=OFF

nyue commented 9 months ago

That works for me.

I have a new issue with the Windows build

The Ninja build encountered multiple build rules but only if I build the AX stuff.

image

Idclip commented 9 months ago

Ah this looks to be a bug in our CMake, both the shared and static builds of AX are producing the same library name.

You can either disable the static/shared build with OPENVDB_AX_SHARED=ON|OFF or OPENVDB_AX_STATIC=ON|OFF or add:

  if(WIN32)
    set_target_properties(openvdb_ax_static PROPERTIES PREFIX "lib")
  endif()

to somewhere in openvdb_ax/CMakeLists.txt:

https://github.com/AcademySoftwareFoundation/openvdb/blob/41bb1279c2c96d0d09614bc57830da0184002c51/openvdb_ax/openvdb_ax/CMakeLists.txt#L304-L308

I'll make the latter change to master