nwchemgit / nwchem

NWChem: Open Source High-Performance Computational Chemistry
http://nwchemgit.github.io
Other
481 stars 160 forks source link

Looking for a 7.2.2 patch for: warning: implicit declaration of function ‘Py_SetProgramName’ #950

Closed marcindulak closed 4 months ago

marcindulak commented 4 months ago

Is your feature request related to a problem? Please describe.

Reported at https://bugzilla.redhat.com/show_bug.cgi?id=2264226

To reproduce, build the following Dockerfile with docker build --progress=plain --pull -t nwchem:latest .

# docker build --progress=plain --no-cache --pull -t nwchem:latest .

FROM python:3.13.0a3

RUN set -x \
    && apt-get update \
    && apt-get install -y git gcc python3-dev

RUN set -x \
    && git clone https://github.com/nwchemgit/nwchem

RUN set -x \
    && apt-get update \
    && apt-get install -y libglobalarrays-dev

RUN set -x \
    && cd nwchem \
    && git checkout 74936fb92aec6990ce48bf334747215813684576 \
    && cd src/python \
    && export CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer' \
    && gcc $(pkg-config --cflags --libs python3) $CFLAGS -Werror -c task_python.c

CMD ["/bin/bash"]

Output

gcc -I/usr/local/include/python3.13 -L/usr/local/lib -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Werror -c task_python.c
 task_python.c: In function ‘task_python_’:
 task_python.c:43:4: error: implicit declaration of function ‘Py_SetProgramName’; did you mean ‘Py_GetProgramName’? [-Werror=implicit-function-declaration]
    43 |    Py_SetProgramName(nwprogram);
       |    ^~~~~~~~~~~~~~~~~
       |    Py_GetProgramName
cc1: all warnings being treated as errors

Describe the solution you'd like

A patch for 7.2.2 https://github.com/nwchemgit/nwchem/commit/74936fb92aec6990ce48bf334747215813684576, or a new hotfix for 7.2

edoapra commented 4 months ago

Fixes for the Py_SetProgramName issue have already been committed and tested on ubuntu. https://github.com/nwchemgit/nwchem/commit/c6851de6a771a31d387e06819fce26b49391b20b https://github.com/nwchemgit/nwchem/commit/bc18d20d90ba1fd6efc894558bef2fdacaac28a8 I am not quite sure about the origin of the Fedora failure.

edoapra commented 4 months ago

I am trying to understand this issue. Are you asking for a new hotfix release (e.g. 7.2.3) with the existing python fixes from the master and hotfix/release-7-2-0 branches? The patch for the 7.2.0 branch is already have available as https://github.com/nwchemgit/nwchem/commit/997856ea3e784f2e1c25a094005421ca0e064347.patch

edoapra commented 4 months ago

This updated Dockerfile shows the use of the two necessary patches

FROM python:3.13.0a3

RUN set -x \
    && apt-get update \
    && apt-get install -y git gcc python3-dev libglobalarrays-dev curl bzip2 patch

RUN set -x \
    && curl -LJO https://github.com/nwchemgit/nwchem/releases/download/v7.2.2-release/nwchem-7.2.2-release.revision-74936fb9-srconly.2023-11-03.tar.bz2 \
    && tar xjf nwchem*bz2 \
    && rm nw*bz2

RUN set -x \
    && apt-get update

RUN set -x \
    && cd nwchem*    \
    && curl  https://github.com/nwchemgit/nwchem/commit/997856ea3e784f2e1c25a094005421ca0e064347.patch | patch -p1 \
    && curl https://github.com/nwchemgit/nwchem/commit/bc18d20d90ba1fd6efc894558bef2fdacaac28a8.patch | patch -p1 \
    && cd src/python \
    && export CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer' \
    && gcc $(pkg-config --cflags --libs python3) $CFLAGS -Werror -c task_python.c

CMD ["/bin/bash"]
edoapra commented 4 months ago

Contrary to comment https://github.com/nwchemgit/nwchem/issues/950#issuecomment-1949260400, a second patch is needed (present in master but not in hotfix/release-7-2-0) and a PR for it is in progress

edoapra commented 4 months ago

Pull request https://github.com/nwchemgit/nwchem/pull/951 merged into the hotfix/release-7-2-0 branch

marcindulak commented 4 months ago

I'm closing the issue, since the build using two patches https://github.com/nwchemgit/nwchem/issues/950#issuecomment-1949321440 suceeded (the build link is in bugzilla).