Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: ../../../external_libs/fmt/include/fmt/format.h: No such file or directory #3925

Closed
bsergean opened this issue Feb 8, 2021 · 8 comments

Comments

@bsergean
Copy link
Contributor

bsergean commented Feb 8, 2021

Description

Installed headers (utils/common.h) reference uninstalled third-party header (format.h).
Those inclusions of un-installed third-party code in public headers make it so that we cannot build the library anymore.

#if (!((defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))))
#define FMT_HEADER_ONLY
#include "../../../external_libs/fmt/include/fmt/format.h"
#endif
#include "../../../external_libs/fast_double_parser/include/fast_double_parser.h"

The error message is


/xxx/include/LightGBM/utils/common.h:35:10: fatal error: ../../../external_libs/fmt/include/fmt/format.h: No such file or directory
   35 | #include "../../../external_libs/fmt/include/fmt/format.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Reproducible example

... todo ...

Environment info

LightGBM version or commit hash: master

This seems to be a regression from 792c930 / before that common/util.h did not include external headers.

I think it would be best to not have headers depend on third-party code, and move that code inside .cpp files or implementation code (under some kind of namespace ?), but an alternative could be to install the fmt code.

spdlog also uses fmt library, maybe their approach could be adopted.

@StrikerRUS
Copy link
Collaborator

Just a quick check: have you specified --recursive flag during cloning LightGBM repository?

git clone --recursive https://github.com/microsoft/LightGBM

@bsergean
Copy link
Contributor Author

bsergean commented Feb 8, 2021 via email

@jameslamb jameslamb added the bug label Feb 9, 2021
@StrikerRUS
Copy link
Collaborator

I guess this issue can treated as a sub-issue of #4067.

I'm adding this to the feature requests list in #2302.

@bholekiran
Copy link

I am also getting similar error, eventhough this format.h header is present in that path. Please let me know the solution for this.

/u/sinkib/LightGBM/include/LightGBM/utils/common.h(36): catastrophic error: cannot open source file "../../../external_libs/fmt/include/fmt/format.h"
#include "../../../external_libs/fmt/include/fmt/format.h"

@bholekiran
Copy link

@StrikerRUS I am also getting similar error, eventhough this format.h header is present in that path. Please let me know the solution for this.

/u/sinkib/LightGBM/include/LightGBM/utils/common.h(36): catastrophic error: cannot open source file "../../../external_libs/fmt/include/fmt/format.h"
#include "../../../external_libs/fmt/include/fmt/format.h"

@Usmaniatech
Copy link

I am also facing this issue:

In file included from /home/jupyter/LightGBM/include/LightGBM/config.h:16:0,
from /home/jupyter/LightGBM/include/LightGBM/boosting.h:8,
from /home/jupyter/LightGBM/src/c_api.cpp:7:
/home/jupyter/LightGBM/include/LightGBM/utils/common.h:33:82: fatal error: ../../../external_libs/fast_double_parser/include/fast_double_parser.h: No such file or directory
#include "../../../external_libs/fast_double_parser/include/fast_double_parser.h"
^
compilation terminated.
In file included from /home/jupyter/LightGBM/include/LightGBM/config.h:16:0,
from /home/jupyter/LightGBM/include/LightGBM/boosting.h:8,
from /home/jupyter/LightGBM/src/boosting/boosting.cpp:5:
/home/jupyter/LightGBM/include/LightGBM/utils/common.h:33:82: fatal error: ../../../external_libs/fast_double_parser/include/fast_double_parser.h: No such file or directory
#include "../../../external_libs/fast_double_parser/include/fast_double_parser.h"
^
compilation terminated.
In file included from /home/jupyter/LightGBM/include/LightGBM/config.h:16:0,
from /home/jupyter/LightGBM/include/LightGBM/boosting.h:8,
from /home/jupyter/LightGBM/src/boosting/gbdt.h:8,
from /home/jupyter/LightGBM/src/boosting/gbdt.cpp:5:
/home/jupyter/LightGBM/include/LightGBM/utils/common.h:33:82: fatal error: ../../../external_libs/fast_double_parser/include/fast_double_parser.h: No such file or directory
#include "../../../external_libs/fast_double_parser/include/fast_double_parser.h"
^
compilation terminated.
In file included from /home/jupyter/LightGBM/include/LightGBM/config.h:16:0,
from /home/jupyter/LightGBM/src/boosting/gbdt_model_text.cpp:5:
/home/jupyter/LightGBM/include/LightGBM/utils/common.h:33:82: fatal error: ../../../external_libs/fast_double_parser/include/fast_double_parser.h: No such file or directory
#include "../../../external_libs/fast_double_parser/include/fast_double_parser.h"
^
compilation terminated.
make[2]: *** [CMakeFiles/lightgbm_objs.dir/src/boosting/boosting.cpp.o] Error 1

were u able to resolve this error.

You can reproduce this error by using:

git clone --recursive https://github.com/microsoft/LightGBM
cd LightGBM
mkdir build
cd build
cmake ..
make -j4

@Usmaniatech
Copy link

@bholekiran were you able to resolve it ?

@WatsonCao
Copy link

In my case, I solved it use git clone --recursive.

Or you may download corresponding missing files from https://github.com/microsoft/LightGBM/tree/master/external_libs.

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

No branches or pull requests

6 participants