quantumjot / btrack

Bayesian multi-object tracking
https://btrack.readthedocs.io
MIT License
309 stars 50 forks source link

Testing C++11 compilation #309

Closed quantumjot closed 12 months ago

quantumjot commented 1 year ago

This is a test of compilation of the latest version of btrack using an older compiler for compatibility.

@markdane @ania-m-b @nthndy - could you try this fix out, since I know you were all having issues on your respective machines?

git clone -b fix-makefile https://github.com/quantumjot/btrack.git
cd btrack
./build.sh
pip install -e .
deprecated-napari-hub-preview-bot[bot] commented 1 year ago

Preview page for your plugin is ready here: https://preview.napari-hub.org/quantumjot/btrack/309 Updated: 2023-04-27T07:46:01.160069

codecov-commenter commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (6cbd357) 84.87% compared to head (5606ac8) 84.87%.

:exclamation: Current head 5606ac8 differs from pull request most recent head c969653. Consider uploading reports for the commit c969653 to get more accurate results

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #309 +/- ## ======================================= Coverage 84.87% 84.87% ======================================= Files 30 30 Lines 1957 1957 Branches 296 296 ======================================= Hits 1661 1661 Misses 212 212 Partials 84 84 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

paddyroddy commented 1 year ago

To support older versions of C++ we could look into https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners

paddyroddy commented 1 year ago

Had a look. The old link https://github.com/eigenteam/eigen-git-mirror says it is deprecated and may be removed at any time. Hence why we removed it.

nthndy commented 1 year ago

(will give this a go tomorrow as I don't have my macbook on me today)

nthndy commented 1 year ago

works for me!

ania-m-b commented 1 year ago

For macOS Mojave 10.14.6 users if you struggle to get btrack to work you may notice these errors:

When trying to run tracks in your notebook:

[ERROR][2023/04/28 01:22:50 PM] Exception caught:
 - btrack_version: 0.6.1.dev31
 - system_platform: macOS-10.14.6-x86_64-i386-64bit
 - system_python: 3.10.11
 - function: <function load_library at 0x12ec90f70>
 - exception: dlopen(/Users/username/Documents/btrack_0.6.0/btrack/btrack/libs/libtracker.dylib, 6): image not found
 - arguments: (PosixPath('/Users/username/Documents/btrack_0.6.0/btrack/btrack/libs/libtracker'),)
 - keywords: {}

While building:

mkdir: ./btrack/libs: File exists
mkdir: ./btrack/obj: File exists
Compiling btrack from source...
rm -f ./btrack/obj/bayes.o ./btrack/obj/hyperbin.o ./btrack/obj/hypothesis.o ./btrack/obj/inference.o ./btrack/obj/interface.o ./btrack/obj/manager.o ./btrack/obj/motion.o ./btrack/obj/pdf.o ./btrack/obj/tracker.o ./btrack/obj/tracklet.o ./btrack/obj/wrapper.o
clang++ -arch x86_64 -arch arm64 -c -std=c++11 -m64 -fPIC -I"./btrack/include" -DDEBUG=false -DBUILD_SHARED_LIB -O3  -c btrack/src/bayes.cc -o btrack/obj/bayes.o
In file included from btrack/src/bayes.cc:17:
In file included from ./btrack/include/bayes.h:20:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/algorithm:642:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/cstring:61:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:61:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/string.h:61:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/_types.h:27:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/_types.h:32:
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/cdefs.h:784:2: error:
      Unsupported architecture
#error Unsupported architecture
 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [btrack/obj/bayes.o] Error 1

To overcome this issue in your btrack folder go to Makefile(txt file) and remove this bit : -arch arm64 from the line where it appears. Save the new Makefile and repeat ./build.sh

This will result in successful outcome. Then install the whole package!

Many thanks to @quantumjot for solving this issue!!!

markdane commented 1 year ago

This works for me too. Thank you. Sorry about the delay but I've been running btrack on a virtual machine to get around this. Glad to move it all back on our cluster computer. BTW, the optimization is much faster now.

paddyroddy commented 11 months ago

FYI, I can no longer compile on my machine. Do we want to support old machines or new ones? I'm on an M1 macOS

quantumjot commented 11 months ago

Weird - I just tried compiling on my M1 Mac and it was fine

paddyroddy commented 11 months ago

I'm still having issues on my standard M1. On my M1 Max I haven't had such issues. Not sure why (unless it's from a previous build on the M1 Max).

Building btrack...
mkdir: cannot create directory ‘./btrack/libs’: File exists
mkdir: cannot create directory ‘./btrack/obj’: File exists
Compiling btrack from source...
rm -f ./btrack/obj/bayes.o ./btrack/obj/hyperbin.o ./btrack/obj/hypothesis.o ./btrack/obj/inference.o ./btrack/obj/interface.o ./btrack/obj/manager.o ./btrack/obj/motion.o ./btrack/obj/pdf.o ./btrack/obj/tracker.o ./btrack/obj/tracklet.o ./btrack/obj/wrapper.o
clang++ -arch x86_64 -arch arm64 -c -std=c++11 -m64 -fPIC -I"./btrack/include" -DDEBUG=false -DBUILD_SHARED_LIB -O3  -c btrack/src/bayes.cc -o btrack/obj/bayes.o
clang++ -arch x86_64 -arch arm64 -c -std=c++11 -m64 -fPIC -I"./btrack/include" -DDEBUG=false -DBUILD_SHARED_LIB -O3  -c btrack/src/hyperbin.cc -o btrack/obj/hyperbin.o
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:19:
./btrack/include/eigen/Eigen/src/Core/util/Macros.h:707:2: error: This compiler appears to be too old to be supported by Eigen
#error This compiler appears to be too old to be supported by Eigen
 ^
./btrack/include/eigen/Eigen/src/Core/util/Macros.h:950:79: error: constexpr function's return type 'void' is not a literal type
    template<typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void ignore_unused_variable(const T&) {}
                                                                              ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:168:
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:157:37: error: no template named 'remove_const_t' in namespace 'std'; did you mean 'remove_const'?
struct is_void : is_same<void, std::remove_const_t<T>> {};
                               ~~~~~^~~~~~~~~~~~~~
                                    remove_const
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/remove_const.h:20:50: note: 'remove_const' declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const            {typedef _Tp type;};
                                                 ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:168:
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:224:48: error: no member named 'enable_if_t' in namespace 'std'
template<typename T> struct array_size<T, std::enable_if_t<((T::SizeAtCompileTime&0)==0)>> {
                                          ~~~~~^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:224:90: error: expected unqualified-id
template<typename T> struct array_size<T, std::enable_if_t<((T::SizeAtCompileTime&0)==0)>> {
                                                                                         ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:255:17: error: 'auto' return without trailing return type; deduced return types are a C++14 extension
EIGEN_CONSTEXPR auto index_list_size(const T& x) {
                ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:256:18: error: no template named 'common_type_t' in namespace 'std'; did you mean 'common_type'?
  using R = std::common_type_t<std::ptrdiff_t, std::make_signed_t<decltype(x.size())>>;
            ~~~~~^~~~~~~~~~~~~
                 common_type
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/common_type.h:69:29: note: 'common_type' declared here
struct _LIBCPP_TEMPLATE_VIS common_type;
                            ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:168:
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:256:53: error: no template named 'make_signed_t' in namespace 'std'; did you mean 'make_signed'?
  using R = std::common_type_t<std::ptrdiff_t, std::make_signed_t<decltype(x.size())>>;
                                               ~~~~~^~~~~~~~~~~~~
                                                    make_signed
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/make_signed.h:65:29: note: 'make_signed' declared here
struct _LIBCPP_TEMPLATE_VIS make_signed
                            ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:168:
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:309:38: error: no template named 'integer_sequence' in namespace 'std'; did you mean '__integer_sequence'?
using reduce_all = std::is_same<std::integer_sequence<bool, values..., true>,
                                ~~~~~^~~~~~~~~~~~~~~~
                                     __integer_sequence
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tuple:89:8: note: '__integer_sequence' declared here
struct __integer_sequence {
       ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:168:
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:310:10: error: no template named 'integer_sequence' in namespace 'std'; did you mean '__integer_sequence'?
    std::integer_sequence<bool, true, values...> >;
    ~~~~~^~~~~~~~~~~~~~~~
         __integer_sequence
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tuple:89:8: note: '__integer_sequence' declared here
struct __integer_sequence {
       ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:168:
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:315:24: error: no template named 'integer_sequence' in namespace 'std'; did you mean '__integer_sequence'?
    !std::is_same<std::integer_sequence<bool, values..., false>, std::integer_sequence<bool, false, values...> >::value>;
                  ~~~~~^~~~~~~~~~~~~~~~
                       __integer_sequence
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tuple:89:8: note: '__integer_sequence' declared here
struct __integer_sequence {
       ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:168:
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:315:71: error: no template named 'integer_sequence' in namespace 'std'; did you mean '__integer_sequence'?
    !std::is_same<std::integer_sequence<bool, values..., false>, std::integer_sequence<bool, false, values...> >::value>;
                                                                 ~~~~~^~~~~~~~~~~~~~~~
                                                                      __integer_sequence
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__tuple:89:8: note: '__integer_sequence' declared here
struct __integer_sequence {
       ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:168:
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:335:68: error: no template named 'enable_if_t' in namespace 'std'
  template <typename C> static meta_yes testFunctor(C const *,std::enable_if_t<(sizeof(return_ptr<C>()->operator()())>0)> * = 0);
                                                              ~~~~~^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:344:68: error: no template named 'enable_if_t' in namespace 'std'
  template <typename C> static meta_yes testFunctor(C const *,std::enable_if_t<(sizeof(return_ptr<C>()->operator()(IndexType(0)))>0)> * = 0);
                                                              ~~~~~^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:353:68: error: no template named 'enable_if_t' in namespace 'std'
  template <typename C> static meta_yes testFunctor(C const *,std::enable_if_t<(sizeof(return_ptr<C>()->operator()(IndexType(0),IndexType(0)))>0)> * = 0);
                                                              ~~~~~^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:502:16: warning: variable templates are a C++14 extension [-Wc++14-extensions]
constexpr bool is_int_or_enum_v = std::is_enum<A>::value || std::is_integral<A>::value;
               ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:530:3: warning: use of this statement in a constexpr function is a C++14 extension [-Wc++14-extensions]
  if ((int) a == 0 || (int) b == 0) return 0;
  ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:533:3: warning: multiple return statements in constexpr function is a C++14 extension [-Wc++14-extensions]
  return plain_enum_min(a, b);
  ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:530:37: note: previous return statement is here
  if ((int) a == 0 || (int) b == 0) return 0;
                                    ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:531:37: note: previous return statement is here
  if ((int) a == 1 || (int) b == 1) return 1;
                                    ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:532:49: note: previous return statement is here
  if ((int) a == Dynamic || (int) b == Dynamic) return Dynamic;
                                                ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:546:3: warning: use of this statement in a constexpr function is a C++14 extension [-Wc++14-extensions]
  if ((int) a == 0 || (int) b == 0) return 0;
  ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:551:3: warning: multiple return statements in constexpr function is a C++14 extension [-Wc++14-extensions]
  return plain_enum_min(a, b);
  ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:546:37: note: previous return statement is here
  if ((int) a == 0 || (int) b == 0) return 0;
                                    ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:547:37: note: previous return statement is here
  if ((int) a == 1 || (int) b == 1) return 1;
                                    ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:548:49: note: previous return statement is here
  if ((int) a == Dynamic && (int) b == Dynamic) return Dynamic;
                                                ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:549:27: note: previous return statement is here
  if ((int) a == Dynamic) return (int) b;
                          ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:550:27: note: previous return statement is here
  if ((int) b == Dynamic) return (int) a;
                          ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:559:3: warning: use of this statement in a constexpr function is a C++14 extension [-Wc++14-extensions]
  if ((int) a == Dynamic || (int) b == Dynamic) return Dynamic;
  ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:560:3: warning: multiple return statements in constexpr function is a C++14 extension [-Wc++14-extensions]
  return plain_enum_max(a, b);
  ^
./btrack/include/eigen/Eigen/src/Core/util/Meta.h:559:49: note: previous return statement is here
  if ((int) a == Dynamic || (int) b == Dynamic) return Dynamic;
                                                ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:170:
./btrack/include/eigen/Eigen/src/Core/util/ForwardDeclarations.h:112:46: error: no type named 'conditional_t' in namespace 'std'
         typename StrideType = typename std::conditional_t<PlainObjectType::IsVectorAtCompileTime,InnerStride<1>,OuterStride<> > > class Ref;
                               ~~~~~~~~~~~~~~^~~~~~~~~~~~~
./btrack/include/eigen/Eigen/src/Core/util/ForwardDeclarations.h:112:59: error: expected ',' or '>' in template-parameter-list
         typename StrideType = typename std::conditional_t<PlainObjectType::IsVectorAtCompileTime,InnerStride<1>,OuterStride<> > > class Ref;
                                                          ^
./btrack/include/eigen/Eigen/src/Core/util/ForwardDeclarations.h:112:98: error: expected unqualified-id
         typename StrideType = typename std::conditional_t<PlainObjectType::IsVectorAtCompileTime,InnerStride<1>,OuterStride<> > > class Ref;
                                                                                                 ^
In file included from btrack/src/hyperbin.cc:17:
In file included from ./btrack/include/hyperbin.h:27:
In file included from ./btrack/include/tracklet.h:23:
In file included from ./btrack/include/eigen/Eigen/Dense:1:
In file included from ./btrack/include/eigen/Eigen/Core:172:
./btrack/include/eigen/Eigen/src/Core/util/XprHelper.h:105:16: error: no template named 'conditional_t' in namespace 'std'
  typedef std::conditional_t<(sizeof(I1)<sizeof(I2)), I2, I1> type;
          ~~~~~^
./btrack/include/eigen/Eigen/src/Core/util/XprHelper.h:195:3: warning: use of this statement in a constexpr function is a C++14 extension [-Wc++14-extensions]
  if((ArrayBytes % AlignmentBytes) == 0) {
  ^
./btrack/include/eigen/Eigen/src/Core/util/XprHelper.h:200:5: warning: multiple return statements in constexpr function is a C++14 extension [-Wc++14-extensions]
    return 0;
    ^
./btrack/include/eigen/Eigen/src/Core/util/XprHelper.h:196:5: note: previous return statement is here
    return AlignmentBytes;
    ^
./btrack/include/eigen/Eigen/src/Core/util/XprHelper.h:198:5: note: previous return statement is here
    return compute_default_alignment_helper(ArrayBytes, AlignmentBytes/2);
    ^
./btrack/include/eigen/Eigen/src/Core/util/XprHelper.h:242:12: warning: variable declaration in a constexpr function is a C++14 extension [-Wc++14-extensions]
  unsigned row_major_bit = Options&RowMajor ? RowMajorBit : 0;
           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
10 warnings and 20 errors generated.
make: *** [btrack/obj/hyperbin.o] Error 1