AcademySoftwareFoundation / AcademySoftwareFoundation/Imath
Error compiling tests using glibc 2.17
- Dominant language
- C++
- Stars
- 488
- Forks
- 161
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 3
Description
I'm getting errors building testFun.cpp using glibc 2.17 and Imath 3.1.6:
```
/home/bokken/build/output/unity/Imath/src/ImathTest/testFun.cpp:49:24: error: expected ')'
printf ("f %.9g %" PRIx32 "\n", f, bit_cast (f));
^
/home/bokken/build/output/unity/Imath/src/ImathTest/testFun.cpp:49:12: note: to match this '('
printf ("f %.9g %" PRIx32 "\n", f, bit_cast (f));
```
In this version of glibc inttypes.h is like the following:
```
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS
#define PRIu64 xxx
#endif
```
Defining __STDC_FORMAT_MACROS before including inttypes.h fixes the issue, e.g.:
```
#define __STDC_FORMAT_MACROS
#include
```
The __STDC_FORMAT_MACROS macro was removed in glibc 2.18.
Contributor guide
Research direction
Start with Imath/src/ImathTest/testFun.cpp, especially the printf using PRIx32, and inspect how inttypes.h is included for C++ builds. Reproduce the test compilation with glibc 2.17, then verify that the test compiles successfully without changing the reported output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100