PDB-REDO / alphafill

AlphaFill is an algorithm based on sequence and structure similarity that “transplants” missing compounds to the AlphaFold models. By adding the molecular context to the protein structures, the models can be more easily appreciated in terms of function and structure integrity.
https://alphafill.eu
BSD 2-Clause "Simplified" License
92 stars 19 forks source link

Fails to compile at utilities.hpp #31

Closed abiadak3 closed 1 year ago

abiadak3 commented 1 year ago

When building, it launches an error:

 error: no matching function for call to ‘std::basic_string<char>::replace(const __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&, const __gnu_cxx::__normal_iterator<const char*, std::basic_string<char> >&, std::basic_string<char>)’
  157 |                         pattern.replace(m[0].first, m[0].second, id.substr(start, length));

I've tried with GCC, from 8 to 12 and with Intel icpc (ICC) 2021.5.0. This is inside this function:

    std::string get_file(const std::string &id, int chunk_nr, std::string pattern)
    {
        std::string::size_type i;

        std::regex rx(R"(\$\{id:(\d+):(\d+)\})");
        std::smatch m;

        while (std::regex_search(pattern, m, rx))
        {
            int start = stoi(m[1]);
            int length = stoi(m[2]);
            pattern.replace(m[0].first, m[0].second, id.substr(start, length));
        }

        while ((i = pattern.find("${id}")) != std::string::npos)
            pattern.replace(i, strlen("${id}"), id);

        while ((i = pattern.find("${chunk}")) != std::string::npos)
            pattern.replace(i, strlen("${chunk}"), std::to_string(chunk_nr));

        return pattern;
    }

Any idea about how to solve it, please?

mhekkel commented 1 year ago

I don't see any problem in this code. It is perfectly valid C++. Are you really sure you tried compilers other than gcc 8? You should really use 9.4 or newer in case of gcc. And that also means you should use the std c++ library from gcc 9.4 and/or newer.

abiadak3 commented 1 year ago

Hi Maarten, yes, the GCC version I was using at the previous post was 12.1.1.

The GCC 9 version I've is 9.3.1-2, so I do provide here the complete logs with GCC 10.2.1 from the following commands:

cmake .. -DCMAKE_BUILD_TYPE=Release >& alphafill-cmake.log
cmake --build . >& alphafill-build.log

Here are the logs:

https://gist.github.com/abiadak3/5ef813673d08734fb96129812c5cc773

The link above needs to be copy/pasted for arriving to the right place.

Thank you for taking a look to it.

mhekkel commented 1 year ago

I'd love to help you, but I'm afraid I don't know how. Problem is, you apparently are using RedHat and I tried to obtain the tool chain you are using as a docker image but I'm not allowed to use it. Need to register or something. So I cannot reproduce your problem.

Anyway, I firmly believe this is an error in the tools you are using. The code compiles fine with various versions of gcc on my machines, including gcc 10.2.

So perhaps you should try to contact RedHat to see if this is a known issue?

abiadak3 commented 1 year ago

Thanks again for your help. At the end, I've being able to compile it inside a docker with Ubuntu 20.04.6 LTS, and the following library versions: gcc: 9.4 boost: 1.82 cifpp: 5.06 zeep: 5.1.8

For your record, cifpp 5.0.9 gives error: 'cif::Progress' has not been declared and zeep 6.0.1 gives error: 'class zeep::http::uri' has no member named 'filename' By the way, cmake --install . just print: -- Install configuration: "Release" and doesn't copy any file.

About RedHat toolchains I was using, they are freely available. For example, in Centos 8 Stream they can be installed with: yum install gcc-toolset-10

mhekkel commented 1 year ago

Just yesterday I updated libcifpp to a new version, and libzeep as well. I forgot to check in the changes for alphafill required to build with these new libraries. That's fixed now, in version v2.0.0.

And yes, I will have to write an --install rule.

I will see if I can reproduce the errors you see with a docker container. There is a docker container for building pdb-redo based software btw that uses centos but in that container I build my own gcc from source to be able to build binaries that run on very old versions of centos.

abiadak3 commented 1 year ago

Thank you again. I can confirm that the v2.0.0 compiles building gcc 9.5 from source in Centos 7 with the current versions of zeep (6.0.1) and cifpp (5.0.9)