Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing C++11 compilation #309

Merged
merged 8 commits into from
Jul 20, 2023
Merged

Testing C++11 compilation #309

merged 8 commits into from
Jul 20, 2023

Conversation

quantumjot
Copy link
Owner

@quantumjot quantumjot commented Apr 27, 2023

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
Copy link

deprecated-napari-hub-preview-bot bot commented Apr 27, 2023

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
Copy link

codecov-commenter commented Apr 27, 2023

Codecov Report

Patch and project coverage have no change.

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

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

📣 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
@@           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           

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

This was linked to issues Apr 27, 2023
@paddyroddy
Copy link
Collaborator

@paddyroddy
Copy link
Collaborator

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
Copy link
Contributor

nthndy commented Apr 27, 2023

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

@nthndy
Copy link
Contributor

nthndy commented Apr 28, 2023

works for me!

@ania-m-b
Copy link

ania-m-b commented Apr 28, 2023

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
Copy link

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 paddyroddy marked this pull request as ready for review May 26, 2023 09:16
@paddyroddy paddyroddy self-requested a review May 26, 2023 09:16
Copy link
Collaborator

@paddyroddy paddyroddy left a comment

Choose a reason for hiding this comment

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

Some comments

@@ -7,7 +7,7 @@ mkdir ./btrack/obj
# clone Eigen
if [ ! -e ./btrack/include/eigen/signature_of_eigen3_matrix_library ]
then
git clone https://gitlab.com/libeigen/eigen.git ./btrack/include/eigen
git clone --depth 1 --branch 3.3.9 https://gitlab.com/libeigen/eigen.git ./btrack/include/eigen
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a good compromise rather than using the old repository. I've just realised that --branch here also accepts tags https://stackoverflow.com/a/39067940/7359333. My concern at first was that they may delete the branch.

XLD_FLAGS = -arch x86_64 -arch arm64
XLDFLAGS =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious to know whether any of the XLDFLAGS are actually required?

Copy link
Owner Author

Choose a reason for hiding this comment

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

For some of the compilers they are required (I think!)

@@ -20,7 +20,7 @@
#include <algorithm>
#include <cmath>
#include <ctime>
#include <filesystem>
// #include <experimental/filesystem>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here and elsewhere should we just remove rather than comment out?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think I'd like to leave this in if possible, since we might want to reinstate it once we can move back to C++17 (or greater). Probably fine to delete though, it's not an essential function - mostly used for debugging.

@quantumjot quantumjot merged commit e750129 into main Jul 20, 2023
@quantumjot quantumjot deleted the fix-makefile branch July 20, 2023 13:20
@paddyroddy
Copy link
Collaborator

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
Copy link
Owner Author

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

@paddyroddy
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] glibc incompatibility Cannot load dylib on Intel macbooks
6 participants