tomlplusplus: Failure to compile with intel compiler on linux
Environment
toml++ version and/or commit hash:
toml.hpp v2.3.0 [9be51e4]
Compiler:
icpc (ICC) 19.1.0.166 20191121
icpc (ICC) 19.0.0.117 20180804
gcc backend: 7.4.0 (also tried 9.3.0)
C++ standard mode (e.g. 17, 20, ‘latest’):
17
Target arch (e.g. x64):
x64 (linux)
Library configuration overrides:
None
Relevant compilation flags:
-std=c++17
Describe the bug
Compiling a simple test program with icpc fails, complaining about issues with TOML_ALWAYS_INLINE. The same example works fine when compiling with gcc (the same version used as the backend for icpc). Other versions of gcc on the backend similarly fail.
In file included from test.cpp(3):
% icpc test.cpp -std=c++17
toml.hpp(1119): error #77: this declaration has no storage class or type specifier
TOML_ALWAYS_INLINE
... [[hundreds of lines of errors]]
Steps to reproduce (or a small repro code sample)
#include <iostream>
#include <fstream> //required for parse_file()
#include "toml.hpp"
int main(int argc, char** argv)
{
toml::table tbl;
try
{
tbl = toml::parse_file(argv[1]);
std::cout << tbl << "\n";
}
catch (const toml::parse_error& err)
{
std::cerr << "Parsing failed:\n" << err << "\n";
return 1;
}
return 0;
}
Additional information
Forcing #define TOML_ALWAYS_INLINE __forceinline will compile with no errors, but fail to link.
/tmp/icpcJYElhL.o: In function `toml::v2::default_formatter<char>::print(toml::v2::table const&)':
test.cpp:(.text._ZN4toml2v217default_formatterIcE5printERKNS0_5tableE[_ZN4toml2v217default_formatterIcE5printERKNS0_5tableE]+0x50): undefined reference to `toml::v2::node::type() const'
... [[et al.]]
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 30 (16 by maintainers)
Commits related to this issue
- Incorporate TOML library icpc fixes https://github.com/marzer/tomlplusplus/issues/83 — committed to flatironinstitute/SkellySim by blackwer 3 years ago
Thanks all. Things I’ve learned about ICC:
{}std::optionalneeds to be explicitly default constructed to beconstexpr??I’ve pushed some minor fixes in 3db1e4e3. Not promising it will fix the linker error you were seeing @blackwer since I haven’t got an ICC test setup locally yet, but iterating on compiler explorer was a good start.
It’s HPC software that relies on a bunch of libraries that have to be installed with some extremely special care, so I will definitely have to isolate the code a bit unfortunately. I’ll see what I can drum up and open an issue with it hopefully today.
Thanks! It does compile on a considerably more complex example now, though it’s certainly not happy! Thousands of lines of complaints about missing return statements in non-void functions. I’ll suppress the warnings for now and open another issue when I’m actually on the clock and can isolate what its freakin’ problem is.
One of us! One of us! One of us!
What. The actual fuck.
Well, I’ve got a hilarious hack that seems to work, so there’s that.