Compile error for version 1.5.1

48 views
Skip to first unread message

Guoyi Zhang

unread,
Dec 11, 2021, 12:05:25 AM12/11/21
to ExaBayes
My command is

  cd $srcdir/$pkgname-$pkgver
  ./configure --prefix=/usr
  make

For details
make --version
GNU Make 4.3

gcc --version
gcc (GCC) 11.1.0

And the error report is here

  CXX      src/apps/yggdrasil-exabayes.o
In file included from ./src/comm/LocalComm.hpp:10,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueue.hpp:56:24: 错误:模板第 1 个参数无效
   56 |   Node(std::vector<byte> msg, std::vector<int> whoReads );
      |                        ^
./src/comm/threads/MessageQueue.hpp:56:24: 错误:模板第 2 个参数无效
./src/comm/threads/MessageQueue.hpp:61:35: 错误:模板第 1 个参数无效
   61 |   std::tuple<int, std::vector<byte> > getConsumed(int threadId);
      |                                   ^
./src/comm/threads/MessageQueue.hpp:61:35: 错误:模板第 2 个参数无效
./src/comm/threads/MessageQueue.hpp:61:37: 错误:模板第 2 个参数无效
   61 |   std::tuple<int, std::vector<byte> > getConsumed(int threadId);
      |                                     ^
./src/comm/threads/MessageQueue.hpp:64:19: 错误:模板第 1 个参数无效
   64 |   std::vector<byte> _message;
      |                   ^
./src/comm/threads/MessageQueue.hpp:64:19: 错误:模板第 2 个参数无效
In file included from ./src/comm/threads/MessageQueue.hpp:71,
                 from ./src/comm/LocalComm.hpp:10,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueue.tpp: 在成员函数‘void MessageQueue::produce(std::vector<T>, const std::vector<int>&)’中:
./src/comm/threads/MessageQueue.tpp:15:33: 错误:模板第 1 个参数无效
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                 ^
./src/comm/threads/MessageQueue.tpp:15:33: 错误:模板第 2 个参数无效
./src/comm/threads/MessageQueue.tpp:15:52: 错误:对‘byte’的引用有歧义
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                    ^~~~
In file included from /usr/include/c++/11.1.0/bits/stl_algobase.h:61,
                 from /usr/include/c++/11.1.0/bits/char_traits.h:39,
                 from /usr/include/c++/11.1.0/ios:40,
                 from /usr/include/c++/11.1.0/ostream:38,
                 from /usr/include/c++/11.1.0/iostream:39,
                 from ./src/apps/exabayes.cpp:22:
/usr/include/c++/11.1.0/bits/cpp_type_traits.h:404:30: 附注:备选为: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from ./src/comm/LocalComm.hpp:10,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueue.hpp:24:17: 附注:         ‘typedef uint8_t byte’
   24 | typedef uint8_t byte;
      |                 ^~~~
In file included from ./src/comm/threads/MessageQueue.hpp:71,
                 from ./src/comm/LocalComm.hpp:10,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueue.tpp:15:56: 错误:expected ‘>’ before ‘*’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                        ^
./src/comm/threads/MessageQueue.tpp:15:56: 错误:expected ‘(’ before ‘*’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                        ^
      |                                                        (
./src/comm/threads/MessageQueue.tpp:15:57: 错误:expected primary-expression before ‘>’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                         ^
./src/comm/threads/MessageQueue.tpp:15:89: 错误:对‘byte’的引用有歧义
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                         ^~~~
In file included from /usr/include/c++/11.1.0/bits/stl_algobase.h:61,
                 from /usr/include/c++/11.1.0/bits/char_traits.h:39,
                 from /usr/include/c++/11.1.0/ios:40,
                 from /usr/include/c++/11.1.0/ostream:38,
                 from /usr/include/c++/11.1.0/iostream:39,
                 from ./src/apps/exabayes.cpp:22:
/usr/include/c++/11.1.0/bits/cpp_type_traits.h:404:30: 附注:备选为: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from ./src/comm/LocalComm.hpp:10,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueue.hpp:24:17: 附注:         ‘typedef uint8_t byte’
   24 | typedef uint8_t byte;
      |                 ^~~~
In file included from ./src/comm/threads/MessageQueue.hpp:71,
                 from ./src/comm/LocalComm.hpp:10,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueue.tpp:15:93: 错误:expected ‘>’ before ‘*’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                             ^
./src/comm/threads/MessageQueue.tpp:15:93: 错误:expected ‘(’ before ‘*’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                             ^
      |                                                                                             (
./src/comm/threads/MessageQueue.tpp:15:94: 错误:expected primary-expression before ‘>’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                              ^
./src/comm/threads/MessageQueue.tpp:15:121: 错误:expected ‘)’ before ‘;’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                                                         ^
      |                                                                                                                         )
./src/comm/threads/MessageQueue.tpp: 在成员函数‘std::tuple<bool, std::vector<T, std::allocator<_CharT> > > MessageQueue::consume(int)’中:
./src/comm/threads/MessageQueue.tpp:46:39: 错误:模板第 1 个参数无效
   46 |           auto msg =  std::vector<byte>();
      |                                       ^
./src/comm/threads/MessageQueue.tpp:46:39: 错误:模板第 2 个参数无效
In file included from ./src/comm/LocalComm.hpp:11,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueueSingle.hpp: 在全局域:
./src/comm/threads/MessageQueueSingle.hpp:46:24: 错误:模板第 1 个参数无效
   46 |   Node(std::vector<byte> msg );
      |                        ^
./src/comm/threads/MessageQueueSingle.hpp:46:24: 错误:模板第 2 个参数无效
./src/comm/threads/MessageQueueSingle.hpp:50:19: 错误:模板第 1 个参数无效
   50 |   std::vector<byte> _message;
      |                   ^
./src/comm/threads/MessageQueueSingle.hpp:50:19: 错误:模板第 2 个参数无效
In file included from ./src/comm/threads/MessageQueueSingle.hpp:55,
                 from ./src/comm/LocalComm.hpp:11,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueueSingle.tpp: 在成员函数‘void MessageQueueSingle::produce(std::vector<T>)’中:
./src/comm/threads/MessageQueueSingle.tpp:15:33: 错误:模板第 1 个参数无效
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                 ^
./src/comm/threads/MessageQueueSingle.tpp:15:33: 错误:模板第 2 个参数无效
./src/comm/threads/MessageQueueSingle.tpp:15:52: 错误:对‘byte’的引用有歧义
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                    ^~~~
In file included from /usr/include/c++/11.1.0/bits/stl_algobase.h:61,
                 from /usr/include/c++/11.1.0/bits/char_traits.h:39,
                 from /usr/include/c++/11.1.0/ios:40,
                 from /usr/include/c++/11.1.0/ostream:38,
                 from /usr/include/c++/11.1.0/iostream:39,
                 from ./src/apps/exabayes.cpp:22:
/usr/include/c++/11.1.0/bits/cpp_type_traits.h:404:30: 附注:备选为: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from ./src/comm/LocalComm.hpp:11,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueueSingle.hpp:16:17: 附注:         ‘typedef uint8_t byte’
   16 | typedef uint8_t byte;
      |                 ^~~~
In file included from ./src/comm/threads/MessageQueueSingle.hpp:55,
                 from ./src/comm/LocalComm.hpp:11,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueueSingle.tpp:15:56: 错误:expected ‘>’ before ‘*’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                        ^
./src/comm/threads/MessageQueueSingle.tpp:15:56: 错误:expected ‘(’ before ‘*’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                        ^
      |                                                        (
./src/comm/threads/MessageQueueSingle.tpp:15:57: 错误:expected primary-expression before ‘>’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                         ^
./src/comm/threads/MessageQueueSingle.tpp:15:89: 错误:对‘byte’的引用有歧义
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                         ^~~~
In file included from /usr/include/c++/11.1.0/bits/stl_algobase.h:61,
                 from /usr/include/c++/11.1.0/bits/char_traits.h:39,
                 from /usr/include/c++/11.1.0/ios:40,
                 from /usr/include/c++/11.1.0/ostream:38,
                 from /usr/include/c++/11.1.0/iostream:39,
                 from ./src/apps/exabayes.cpp:22:
/usr/include/c++/11.1.0/bits/cpp_type_traits.h:404:30: 附注:备选为: ‘enum class std::byte’
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from ./src/comm/LocalComm.hpp:11,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueueSingle.hpp:16:17: 附注:         ‘typedef uint8_t byte’
   16 | typedef uint8_t byte;
      |                 ^~~~
In file included from ./src/comm/threads/MessageQueueSingle.hpp:55,
                 from ./src/comm/LocalComm.hpp:11,
                 from ./src/comm/Communicator.hpp:5,
                 from ./src/comm/ParallelSetup.hpp:8,
                 from ./src/mcmc/SampleMaster.hpp:20,
                 from ./src/apps/exabayes.cpp:29:
./src/comm/threads/MessageQueueSingle.tpp:15:93: 错误:expected ‘>’ before ‘*’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                             ^
./src/comm/threads/MessageQueueSingle.tpp:15:93: 错误:expected ‘(’ before ‘*’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                             ^
      |                                                                                             (
./src/comm/threads/MessageQueueSingle.tpp:15:94: 错误:expected primary-expression before ‘>’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                              ^
./src/comm/threads/MessageQueueSingle.tpp:15:121: 错误:expected ‘)’ before ‘;’ token
   15 |   auto tmpMsg = std::vector<byte>(reinterpret_cast<byte*>(msg.data()), reinterpret_cast<byte*>(msg.data() + msg.size()));
      |                                                                                                                         ^
      |                                                                                                                         )
./src/comm/threads/MessageQueueSingle.tpp: 在成员函数‘std::tuple<bool, std::vector<T, std::allocator<_CharT> > > MessageQueueSingle::consume(int)’中:
./src/comm/threads/MessageQueueSingle.tpp:37:35: 错误:模板第 1 个参数无效
   37 |       auto msg =  std::vector<byte>();
      |                                   ^
./src/comm/threads/MessageQueueSingle.tpp:37:35: 错误:模板第 2 个参数无效
在全局域:
cc1plus: 附注:unrecognized command-line option ‘-Wno-unknown-warning’ may have been intended to silence earlier diagnostics
cc1plus: 附注:unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
make: *** [Makefile:5278:src/apps/yggdrasil-exabayes.o] 错误 1

Tobias Senoner

unread,
Jul 20, 2024, 12:24:26 AM7/20/24
to ExaBayes
Hi,

I ran into the same issue and realized that the issue is that ExaBayes 1.5.1 only works for GCC 9 and 10 and not for GCC 11.
Therefore, I have written a small python patcher script that can be run in the root of the directory to modify the files and fix this error message.
Here is the python code:

"""
ExaBayes GCC 11 Compatibility Patcher

This script patches the ExaBayes source code to ensure compatibility with GCC version 11.
It primarily addresses issues related to the 'byte' type definition conflicts by
replacing instances of 'byte' with a custom type name 'exabayes_byte'. This
modification resolves ambiguities between std::byte and the project's internal byte
definition, allowing successful compilation with GCC version 11.

The script recursively scans the ExaBayes source directories, identifies relevant files,
and performs necessary replacements to maintain the software's functionality while
eliminating compiler errors related to type ambiguity.
"""
import os
import re

# Define the directories to search
src_dirs = ['src', 'include'] # Add or modify directories as needed

# Define the new type name
new_type_name = 'exabayes_byte'

# Define patterns to match and replace
patterns = [
(r'\btypedef\s+uint8_t\s+byte\s*;', f'typedef uint8_t {new_type_name};'),
(r'\bstd::vector<byte>', f'std::vector<{new_type_name}>'),
(r'\bvector<byte>', f'vector<{new_type_name}>'),
(r'\bbyte\s+\*', f'{new_type_name} *'),
(r'\bbyte\s+&', f'{new_type_name} &'),
(r'\bbyte>', f'{new_type_name}>'),
(r'\bbyte,', f'{new_type_name},'),
(r'\bbyte\s*\)', f'{new_type_name})'),
(r'\bbyte;', f'{new_type_name};'),
(r'reinterpret_cast<byte\s*\*>', f'reinterpret_cast<{new_type_name}*>'), # New pattern
]

def process_file(filepath):
with open(filepath, 'r') as file:
content = file.read()

modified = False
for pattern, replacement in patterns:
new_content, count = re.subn(pattern, replacement, content)
if count > 0:
content = new_content
modified = True

if modified:
with open(filepath, 'w') as file:
file.write(content)
print(f"Modified: {filepath}")

def process_directory(directory):
for root, _, files in os.walk(directory):
for file in files:
if file.endswith(('.cpp', '.hpp', '.h', '.tpp')):
filepath = os.path.join(root, file)
process_file(filepath)

if __name__ == "__main__":
for src_dir in src_dirs:
if os.path.exists(src_dir):
process_directory(src_dir)
else:
print(f"Directory not found: {src_dir}")

print("Processing complete. Please review the changes before compiling.")

best,
Tobias

Alexandros Stamatakis

unread,
Jul 22, 2024, 3:46:54 AM7/22/24
to exab...@googlegroups.com
Thank you so much Tobias, much appreciated.

Alexis
>    15 |   auto tmpMsg =
> std::vector<byte>(reinterpret_cast<byte*>(msg.data()),
> reinterpret_cast<byte*>(msg.data() + msg.size()));
>       |
>                             ^~~~
> In file included from /usr/include/c++/11.1.0/bits/stl_algobase.h:61,
>                  from /usr/include/c++/11.1.0/bits/char_traits.h:39,
>                  from /usr/include/c++/11.1.0/ios:40,
>                  from /usr/include/c++/11.1.0/ostream:38,
>                  from /usr/include/c++/11.1.0/iostream:39,
>                  from ./src/apps/exabayes.cpp:22:
> /usr/include/c++/11.1.0/bits/cpp_type_traits.h:404:30: 附注:备选
> --
> You received this message because you are subscribed to the Google
> Groups "ExaBayes" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to exabayes+u...@googlegroups.com
> <mailto:exabayes+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/exabayes/c1c0a1d6-179c-4263-8218-434c44eddf23n%40googlegroups.com <https://groups.google.com/d/msgid/exabayes/c1c0a1d6-179c-4263-8218-434c44eddf23n%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
Alexandros (Alexis) Stamatakis

ERA Chair, Institute of Computer Science, Foundation for Research and
Technology - Hellas
Research Group Leader, Heidelberg Institute for Theoretical Studies
Full Professor, Dept. of Informatics, Karlsruhe Institute of Technology

www.biocomp.gr (Crete lab)
www.exelixis-lab.org (Heidelberg lab)
Reply all
Reply to author
Forward
0 new messages