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

error: no matching conversion for functional-style cast from 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000> >::rep' (aka 'long long') to 'xgboost::Integer' (aka 'xgboost::JsonInteger') #5117

Closed
yurivict opened this issue Dec 14, 2019 · 4 comments · Fixed by #5233

Comments

@yurivict
Copy link

yurivict commented Dec 14, 2019

/usr/ports/misc/xgboost/work/xgboost-0.90-235-gad4a1c73/src/common/timer.cc:47:25: error: no matching conversion for functional-style cast from 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000> >::rep' (aka 'long long') to 'xgboost::Integer' (aka 'xgboost::JsonInteger')
    j_pair["elapsed"] = Integer(std::chrono::duration_cast<std::chrono::microseconds>(
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/ports/misc/xgboost/work/xgboost-0.90-235-gad4a1c73/include/xgboost/json.h:189:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000> >::rep' (aka 'long long') to 'const xgboost::JsonInteger' for 1st argument
class JsonInteger : public Value {
      ^
/usr/ports/misc/xgboost/work/xgboost-0.90-235-gad4a1c73/include/xgboost/json.h:189:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000> >::rep' (aka 'long long') to 'xgboost::JsonInteger' for 1st argument
/usr/ports/misc/xgboost/work/xgboost-0.90-235-gad4a1c73/include/xgboost/json.h:200:3: note: candidate template ignored: requirement 'std::is_same<long long, long>::value' was not satisfied [with IntT = long long]
  JsonInteger(IntT value) : Value(ValueKind::Integer), integer_{value} {} // NOLINT
  ^

clang-8 on FreeBSD

@hcho3
Copy link
Collaborator

hcho3 commented Dec 14, 2019

Thanks for your report. We generally aim to make XGBoost POSIX-compliant, but currently our testing infrastructure uses Linux exclusively.

@trivialfis
Copy link
Member

@yurivict Would you like to open a PR as you have better testing environment for BSD? A simple static_cast should get it working.

@yurivict
Copy link
Author

I just patches the port:

--- src/common/timer.cc.orig    2019-12-14 20:35:26 UTC
+++ src/common/timer.cc
@@ -44,8 +44,9 @@ std::vector<Monitor::StatMap> Monitor::CollectFromOthe
     statistic[kv.first] = Object();
     auto& j_pair = statistic[kv.first];
     j_pair["count"] = Integer(kv.second.count);  
-    j_pair["elapsed"] = Integer(std::chrono::duration_cast<std::chrono::microseconds>(
-        kv.second.timer.elapsed).count());
+    // https://github.com/dmlc/xgboost/issues/5117
+    j_pair["elapsed"] = 1; //Integer(std::chrono::duration_cast<std::chrono::microseconds>(
+        //kv.second.timer.elapsed).count());
   }
  
   std::stringstream ss;

I wouldn't have time for this any time soon.

@hcho3 hcho3 mentioned this issue Jan 27, 2020
@hcho3
Copy link
Collaborator

hcho3 commented Jan 27, 2020

@yurivict dmlc/rabit#133 and #5233 should fix the build on FreeBSD.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants