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

[MSVC] Object file size cannot exceed 4 GB #1448

Open
christianbrugger opened this issue Nov 22, 2024 · 8 comments
Open

[MSVC] Object file size cannot exceed 4 GB #1448

christianbrugger opened this issue Nov 22, 2024 · 8 comments
Labels
compiler bug Not a Glaze bug, but a compiler bug

Comments

@christianbrugger
Copy link

christianbrugger commented Nov 22, 2024

With the newest release of MSVC 17.12 / 19.42.34433.0 the object file size seems to explode. With Version 17.11 / 19.41 the object has less than 10 MB. Something in the new MSVC makes glaze explode. Here is the log:

FAILED: src/core/CMakeFiles/ls_core_lib.dir/serialize_detail.cpp.obj C:
\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1442~1.344\bin\Hostx64\x64\cl.exe  /nologo /TP -external:ID:
\a\logiksim\logiksim\external\glaze\include -external:W0 /DWIN32 /D_WINDOWS /EHsc /Ob0 
/Od /RTC1 -std:c++20 -MDd -Z7 /arch:AVX2 /diagnostics:caret /utf-8 /permissive- 
-DBL_STATIC /Zc:preprocessor /Zc:lambda /external:anglebrackets /external:W0 /W4 /WX /YuD:/a/logiksim/
logiksim/build/win-msvc-debug/src/core/CMakeFiles/ls_core_lib.dir/cmake_pch.hxx /FpD:/a/logiksim/logiksim/
build/win-msvc-debug/src/core/CMakeFiles/ls_core_lib.dir/./cmake_pch.cxx.pch /FID:/a/logiksim/logiksim/build/
win-msvc-debug/src/core/CMakeFiles/ls_core_lib.dir/cmake_pch.hxx /showIncludes 
/Fosrc\core\CMakeFiles\ls_core_lib.dir\serialize_detail.cpp.obj 
/Fdsrc\core\CMakeFiles\ls_core_lib.dir\ls_core_lib.pdb /FS 
-c D:\a\logiksim\logiksim\src\core\serialize_detail.cpp

D:\a\logiksim\logiksim\src\core\serialize_detail.cpp : 
fatal error C1605: compiler limit: object file size cannot exceed 4 GB
ninja: build stopped: subcommand failed.

Link to my failed CI job: https://github.com/christianbrugger/logiksim/actions/runs/11875447310/job/33092660483
This happens when building glaze: https://github.com/stephenberry/glaze/actions/runs/11935224664/job/33266080750

I am sure you guys are aware of the issue.
How is the status so far. Does this need to be fixed in the MSVC compiler. Or will this be fixable in glaze?

@stephenberry
Copy link
Owner

Yes, this is an MSVC compiler bug, which I reported and they fixed in less than 24 hours. But, we're now waiting on the next incremental release. This seems only to occur with the function glz::write_json_schema, so it doesn't affect all of Glaze.

Here is the bug report: https://developercommunity.visualstudio.com/t/Memory-Explosion:-compiler-limit:-objec/10795558

@stephenberry stephenberry added the compiler bug Not a Glaze bug, but a compiler bug label Nov 22, 2024
@arturbac
Copy link
Contributor

arturbac commented Nov 23, 2024

I ran onto this issue with simple_enum tests, tried to fix it without luck ..

  target_compile_options(glaze_enum_name_ut PRIVATE 
    "/bigobj"
    "/Zm500"  # Increased memory allocation
    "/Os"     # Favor small code size
    )
  target_link_options(glaze_enum_name_ut PRIVATE "/LARGEADDRESSAWARE")

@stephenberry
Copy link
Owner

Yeah, I think this was due to a memory leak in the MSVC compiler, which they fixed, but we need to wait until the next incremental version to be released.

@Curve
Copy link

Curve commented Dec 3, 2024

I'm also encountering this issue when using a simple struct with explicit metadata with a skip member:

struct function_data
{
    std::uint64_t id;
    std::string name;
    glz::raw_json params;
};
template <>
struct glz::meta<function_data>
{
    using T                     = function_data;
    static constexpr auto value = object(  //
        "saucer:call", skip{},             // Using this line causes the error, without it, no error occurs.
        &T::id,                            //
        &T::name,                          //
        "params", glz::escaped<&T::params> //
    );
};

Is there something I can do while we wait for a proper upstream fix?

@stephenberry
Copy link
Owner

This is an MSVC compiler bug: https://developercommunity.visualstudio.com/t/Memory-Explosion:-compiler-limit:-objec/10795558

We're awaiting the next MSVC minor release, which is usually every few weeks. They fixed the bug internally, but have yet to release it. You could go back to a previous version of MSVC. They didn't give any indication of what went wrong, so I wouldn't know of any work arounds.

@Curve
Copy link

Curve commented Dec 3, 2024

This is an MSVC compiler bug: https://developercommunity.visualstudio.com/t/Memory-Explosion:-compiler-limit:-objec/10795558

We're awaiting the next MSVC minor release, which is usually every few weeks. They fixed the bug internally, but have yet to release it. You could go back to a previous version of MSVC. They didn't give any indication of what went wrong, so I wouldn't know of any work arounds.

Thanks for the swift response!

which is usually every few weeks

Good to know, hope it'll be released soon ^^

@stephenberry
Copy link
Owner

I checked the MSVC 17.12.3 release from December 3rd and looked at their notes and the fix has not yet been released. Still waiting...

@dbraeckelmann
Copy link

MSVC 17.13 Preview fixes this problem for me, seems like they might not include it in an incremental 17.12 release after all... -.-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler bug Not a Glaze bug, but a compiler bug
Projects
None yet
Development

No branches or pull requests

5 participants