Skip to content

Compilation errors #8

@neurolabusc

Description

@neurolabusc

I tried to build this on a macOS. I installed the dependencies specified by CMake:

brew install libzip
brew install eigen
brew install nlohmann-json
brew install spdlog

At that stage, the CMake felt the dependencies were met, but the make command failed, because of a dependency on mio. Since that header-only library seems mature, it might be worth just including the files, as there is no generic installer. Once I met that dependcy, the code still fails to compile:

In file included from /Users/chris/src/trx-cpp/src/trx.h:294:
/Users/chris/src/trx-cpp/src/trx.tpp:1097:39: error: use of undeclared identifier 'canonicalize_file_name'
 1097 |         std::string directory = (std::string)canonicalize_file_name(path.c_str());
      |          

The error means is because canonicalize_file_name() is not available on your platform — it's a GNU extension, available on Linux, but not on macOS or standard C++. For cross-platform support, if you want to require C++17 (-std=c++17) you could use:

#include <filesystem>
std::string directory = std::filesystem::canonical(path).string();

Alternatively:

#include <limits.h>
#include <stdlib.h>

char resolved_path[PATH_MAX];
realpath(path.c_str(), resolved_path);
std::string directory = resolved_path;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions