Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

tensorpipe fails to build on FreeBSD: error: use of undeclared identifier 'getBootIDInternal' #461

Open
yurivict opened this issue Apr 30, 2023 · 1 comment

Comments

@yurivict
Copy link

/usr/ports/math/dgl/work/dgl-1.0.2/third_party/tensorpipe/tensorpipe/common/system.cc:144:41: error: use of undeclared identifier 'getBootIDInternal'
  static optional<std::string> bootID = getBootIDInternal();
                                        ^
1 error generated.

The error occurred while trying to build the DGL library https://github.com/dmlc/dgl

@lw
Copy link
Contributor

lw commented May 2, 2023

That's expected: we have an implementation of that function for Linux and MacOS, but not for FreeBSD:

#ifdef __APPLE__
optional<std::string> getBootIDInternal() {
std::array<char, 128> buf;
// See https://developer.apple.com/documentation/iokit/iokitlib_h for IOKitLib
// API documentation.
io_registry_entry_t ioRegistryRoot =
IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
CFStringRef uuidCf = (CFStringRef)IORegistryEntryCreateCFProperty(
ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
IOObjectRelease(ioRegistryRoot);
CFStringGetCString(uuidCf, buf.data(), buf.size(), kCFStringEncodingMacRoman);
CFRelease(uuidCf);
return std::string(buf.data());
}
#elif defined(__linux__)
optional<std::string> getBootIDInternal() {
std::ifstream f{"/proc/sys/kernel/random/boot_id"};
if (!f.is_open()) {
return nullopt;
}
std::string v;
getline(f, v);
f.close();
return v;
}

If you're familiar with FreeBSD feel free to submit a patch! However, FreeBSD isn't really supported or tested, so nothing guarantees that you won't find other issues after this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants