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

Compilation Error on Raspberry Pi 4 Buster #471

Closed
swagatk opened this issue Feb 7, 2023 · 2 comments
Closed

Compilation Error on Raspberry Pi 4 Buster #471

swagatk opened this issue Feb 7, 2023 · 2 comments
Labels

Comments

@swagatk
Copy link

swagatk commented Feb 7, 2023

Hi,

I am trying to compile this package on Raspberry Pi 4 with Buster OS. I follow the following instruction available on this page:

git clone https://github.com/strasdat/Sophus.git
cd Sophus
mkdir build && cd build && cmake .. && sudo make install

I get the following error:

In file included from /home/pi/Sophus/sophus/common.hpp:36,
                 from /home/pi/Sophus/sophus/types.hpp:7,
                 from /home/pi/Sophus/sophus/rotation_matrix.hpp:9,
                 from /home/pi/Sophus/sophus/so3.hpp:6,
                 from /home/pi/Sophus/sophus/rxso3.hpp:6,
                 from /home/pi/Sophus/test/core/test_rxso3.cpp:3:
/home/pi/Sophus/test/core/test_rxso3.cpp: In lambda function:
/home/pi/Sophus/sophus/common.hpp:50:30: error: declaration of ‘struct Sophus::Tests<Scalar_>::testFit()::<lambda()>::S’ shadows template parameter
 #define SOPHUS_FMT_STRING(x) FMT_STRING(x)
                              ^~~~~~~~~~
/home/pi/Sophus/sophus/common.hpp:64:15: note: in expansion of macro ‘SOPHUS_FMT_STRING’
   fmt::format(SOPHUS_FMT_STRING(description), ##__VA_ARGS__)
               ^~~~~~~~~~~~~~~~~
/home/pi/Sophus/sophus/test_macros.hpp:79:14: note: in expansion of macro ‘SOPHUS_FMT_STR’
       msg += SOPHUS_FMT_STR(descr, ##__VA_ARGS__);                             \
              ^~~~~~~~~~~~~~
/home/pi/Sophus/test/core/test_rxso3.cpp:288:9: note: in expansion of macro ‘SOPHUS_TEST’
         SOPHUS_TEST(passed, !isScaledOrthogonalAndPositive(sR_cols_swapped),
         ^~~~~~~~~~~
/home/pi/Sophus/test/core/test_rxso3.cpp:275:13: note: template parameter ‘S’ declared here
   template <class S = Scalar>
             ^~~~~
make[2]: *** [test/core/CMakeFiles/test_rxso3.dir/build.make:63: test/core/CMakeFiles/test_rxso3.dir/test_rxso3.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:206: test/core/CMakeFiles/test_rxso3.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Machine specs are as given below:

$ uname -a
Linux raspberrypi 5.15.89-v7l+ #1621 SMP Tue Jan 24 11:10:47 GMT 2023 armv7l GNU/Linux

I also tried changing the compiler from ++11 to ++14 by using the following command:

$ sed -i 's/++11/++14/g' CMakeLists.txt

This did not help either. Is there anything else that I can try to solve this error? Thanks in advance.

Regards,
Swagat

@swagatk swagatk added the bug label Feb 7, 2023
@timecod
Copy link

timecod commented Mar 28, 2023

At ./sophus/common.hpp:

#ifdef SOPHUS_COMPILE_TIME_FMT
// To keep compatibility with older libfmt versions,
// disable the compile time check if FMT_STRING is not available.
#ifdef FMT_STRING
// compile-time format check on x
#define SOPHUS_FMT_STRING(x) FMT_STRING(x)
#else
// identity, hence no compile-time check on x
#define SOPHUS_FMT_STRING(x) x
#endif
#else // ! SOPHUS_COMPILE_TIME_FMT
// identity, hence no compile-time check on x
#define SOPHUS_FMT_STRING(x) x
#endif // ! SOPHUS_COMPILE_TIME_FMT

Raspberry buster has libfmt-dev version 5.x

However, last commit (#376) about this file was dedicated to libfmt-dev 9.0

@swagatk
Copy link
Author

swagatk commented Apr 23, 2023

The solution suggested by @timecod worked for me.
The problem was with the libfmt version. After installing the latest version libfmt-dev manually, the Sophus was compiled successfully without any error. I followed the following steps:

  1. Uninstall the libfmt-dev package installed through apt manager

$ sudo apt-get remove --purge libfmt-dev

  1. Download the libfmt-dev source package from this github repository:
$ git clone https://github.com/fmtlib/fmt.git
$ cd fmt
$ mkdir build
$ cd build
$ cmake ..
$ sudo make install 
  1. Now follow the instructions for Sophus installation as explained in the first message.

I think the issue is resolved now. Hence, closing this issue.

Thanks everyone for help.

Regards,
Swagat

@swagatk swagatk closed this as completed Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants