Skip to content

fix(assimp): -Wunused-but-set-variable error from GCC 16#4

Closed
c-dilks wants to merge 1 commit into
gemc:mainfrom
c-dilks:fix-gcc-16
Closed

fix(assimp): -Wunused-but-set-variable error from GCC 16#4
c-dilks wants to merge 1 commit into
gemc:mainfrom
c-dilks:fix-gcc-16

Conversation

@c-dilks
Copy link
Copy Markdown
Contributor

@c-dilks c-dilks commented May 21, 2026

GCC 16 is out now and it's much more aggressive for warning on -Wunused-but-set-variable; one particular warning from building assimp as part of cadmesh is:

/tmp/mlibrary/cadmesh/external/assimp/code/AssetLib/MS3D/MS3DLoader.cpp: In member function ‘virtual void Assimp::MS3DImporter::InternReadFile(const std::string&, aiScene*, Assimp::IOSystem*)’:
/tmp/mlibrary/cadmesh/external/assimp/code/AssetLib/MS3D/MS3DLoader.cpp:633:28: error: variable ‘qu’ set but not used [-Werror=unused-but-set-variable=]
  633 |                 aiQuatKey* qu = nd->mRotationKeys;
      |                            ^~
cc1plus: all warnings being treated as errors

The assimp project builds with -Werror, which treats all warnings as errors, so this warning causes compilation failure of cadmesh.

This PR builds assimp with -Wunused-but-set-variable to suppress this error.

GCC 16 is out now and it's much more aggressive for warning on
`-Wunused-but-set-variable`; one particular warning from building
`assimp` as part of `cadmesh` is:

```
/tmp/mlibrary/cadmesh/external/assimp/code/AssetLib/MS3D/MS3DLoader.cpp: In member function ‘virtual void Assimp::MS3DImporter::InternReadFile(const std::string&, aiScene*, Assimp::IOSystem*)’:
/tmp/mlibrary/cadmesh/external/assimp/code/AssetLib/MS3D/MS3DLoader.cpp:633:28: error: variable ‘qu’ set but not used [-Werror=unused-but-set-variable=]
  633 |                 aiQuatKey* qu = nd->mRotationKeys;
      |                            ^~
cc1plus: all warnings being treated as errors
```

The `assimp` project builds with `-Werror`, which treats all warnings as
errors, so this warning causes compilation failure of `cadmesh`.

This PR builds `assimp` with `-Wunused-but-set-variable` to suppress
this error.
@c-dilks
Copy link
Copy Markdown
Contributor Author

c-dilks commented May 21, 2026

Hmm... this isn't the only one that would need suppressing...

@c-dilks c-dilks marked this pull request as draft May 21, 2026 21:33
@c-dilks
Copy link
Copy Markdown
Contributor Author

c-dilks commented May 21, 2026

Nevermind, #5 is sufficient if you install assimp from your system package manager and build cadmesh with WITH_SYS_ASSIMP=ON

@c-dilks c-dilks closed this May 21, 2026
@c-dilks c-dilks deleted the fix-gcc-16 branch May 21, 2026 23:41
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.

1 participant