Skip to content

fix a line in PyMethodBase.cxx which make it fail to build#12308

Merged
vepadulano merged 1 commit intoroot-project:masterfrom
ACA4DFA4:fix_PyMethodBase.cxx
Feb 14, 2023
Merged

fix a line in PyMethodBase.cxx which make it fail to build#12308
vepadulano merged 1 commit intoroot-project:masterfrom
ACA4DFA4:fix_PyMethodBase.cxx

Conversation

@ACA4DFA4
Copy link
Copy Markdown

fixed a bug in tmva/pymva/src/PyMethodBase.cxx

@phsft-bot
Copy link
Copy Markdown

Can one of the admins verify this patch?

@vepadulano
Copy link
Copy Markdown
Member

@phsft-bot build

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac12/noimt, mac11/cxx14, windows10/cxx14
How to customize builds

@vepadulano
Copy link
Copy Markdown
Member

Good catch @ACA4DFA4 ! I wonder why we don't see the build failure in our CI. Can you tell us your configuration and how you got the error during the build ?

@lmoneta
Copy link
Copy Markdown
Member

lmoneta commented Feb 14, 2023

I think the code before is valid C++, since you can convert const char * to std::string and you can do:

std::string s = " this  " + std::string("works ");

@vepadulano
Copy link
Copy Markdown
Member

vepadulano commented Feb 14, 2023

But the code before was doing

"Key "+key+" does not exist in the dictionary."

Which is const char * + const char * + const char *, which do not implement operator+. Or am I missing something?

godbolt example

Copy link
Copy Markdown
Member

@lmoneta lmoneta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct @vepadulano. The code before compiles because we are building only with Python3 and it is compiled only in Python2 builds.
In the CI we don't have anymore Python2 only builds.

@vepadulano
Copy link
Copy Markdown
Member

Ok I understand. I would wait for @ACA4DFA4 to tell us more about their configuration, including why do they need to build with Python2.

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Failing tests:

@ACA4DFA4
Copy link
Copy Markdown
Author

ACA4DFA4 commented Feb 14, 2023

Ok I understand. I would wait for @ACA4DFA4 to tell us more about their configuration, including why do they need to build with Python2.

Yesterday I just found that root-v6.28/00 was released on the Releases page, then downloaded the tarball and built it with cmake (-DCMAKE_CXX_STANDARD=17), since the binary distributions don't have ROOT7 features. The OS was Ubuntu 18.04 on Windows 10 (WSL1), and there were python3.8.0, python3.7.5, python3.6.9 and python2.7.17 installed. The default python3 was python3.6.9, with numpy installed. The other 2 versions of python3 didn't have numpy or any other packages. The output of cmake configuration about python was:

-- Could NOT find Python3 (missing: Python3_INCLUDE_DIRS Python3_LIBRARIES Python3_NumPy_INCLUDE_DIRS Development NumPy Development.Module Development.Embed) (found version "3.8.0")
-- Found Python2: /usr/bin/python2.7 (found version "2.7.17") found components: Interpreter Development NumPy Development.Module Development.Embed 
...
-- Building with -fPIC
-- Found Python3: /usr/bin/python3.8 (found suitable version "3.8.0", minimum required is "3.0") found components: Interpreter 

I don't know why python3.6 was not chosen but python3.8, and why python3 was not found at the first time. In fact, I have built root-v6.26/00 with python3.6 successfully when python3.7 and python3.8 were not installed before.

@vepadulano
Copy link
Copy Markdown
Member

@ACA4DFA4 the Python executable chosen should be whatever python3 points to, which probably will be python3.8. In the output you pasted, python3.8 is actually found, what is not found is missing: Python3_INCLUDE_DIRS Python3_LIBRARIES Python3_NumPy_INCLUDE_DIRS.... It might be enough to just install numpy with python3, but that's beside the point of this PR. In your case PyROOT will build directly with Python2 since there are some missing components for 3, hence the error you found. Thanks for the fix! This PR can be merged.

@vepadulano vepadulano merged commit 14c51d1 into root-project:master Feb 14, 2023
@ACA4DFA4 ACA4DFA4 deleted the fix_PyMethodBase.cxx branch March 25, 2023 12:49
@ACA4DFA4 ACA4DFA4 restored the fix_PyMethodBase.cxx branch March 25, 2023 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants