rcsoccersim / rcssserver

The RoboCup Soccer Simulator Server
GNU Lesser General Public License v3.0
137 stars 52 forks source link

Macos installation error #102

Closed xiaomi2077 closed 2 years ago

xiaomi2077 commented 2 years ago

I want to build rcssserve on macos.
Runing g++ -v,I get:

Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

and I run cmake ..,I get:

-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX13.0.sdk/usr/lib/libz.tbd (found version "1.2.11") 
-- Found BISON: /opt/homebrew/opt/bison/bin/bison (found version "3.8.2") 
-- Found FLEX: /usr/bin/flex (found version "2.6.4") 
-- Found Boost: /opt/homebrew/lib/cmake/Boost-1.80.0/BoostConfig.cmake (found version "1.80.0") found components: system filesystem 
-- Boost_INCLUDE_DIRS = /opt/homebrew/include
-- Boost_LIBRARIES = Boost::system;Boost::filesystem
-- Boost_LIB_VERSION = 1_80
-- Looking for C++ include sys/socket.h
-- Looking for C++ include sys/socket.h - found
-- Looking for C++ include sys/param.h
-- Looking for C++ include sys/param.h - found
-- Looking for C++ include sys/time.h
-- Looking for C++ include sys/time.h - found
-- Looking for C++ include netinet/in.h
-- Looking for C++ include netinet/in.h - found
-- Looking for C++ include arpa/inet.h
-- Looking for C++ include arpa/inet.h - found
-- Looking for C++ include netdb.h
-- Looking for C++ include netdb.h - found
-- Looking for C++ include unistd.h
-- Looking for C++ include unistd.h - found
-- Looking for C++ include poll.h
-- Looking for C++ include poll.h - found
-- Looking for C++ include pwd.h
-- Looking for C++ include pwd.h - found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/czs/Documents/develop/robocup/rcssserver-17.0.1/build

Runing make I get:

[  1%] Building CXX object rcss/net/CMakeFiles/RCSSNet.dir/addr.cpp.o
/Users/czs/Documents/develop/robocup/rcssserver-17.0.1/rcss/net/addr.cpp:207:17: warning: private field 'm_error' is not used [-Wunused-private-field]
    Addr::Error m_error;
                ^
/Users/czs/Documents/develop/robocup/rcssserver-17.0.1/rcss/net/addr.cpp:208:9: warning: private field 'm_errno' is not used [-Wunused-private-field]
    int m_errno;
        ^
2 warnings generated.
[  2%] Building CXX object rcss/net/CMakeFiles/RCSSNet.dir/socket.cpp.o
[  3%] Building CXX object rcss/net/CMakeFiles/RCSSNet.dir/socketstreambuf.cpp.o
[  4%] Building CXX object rcss/net/CMakeFiles/RCSSNet.dir/tcpsocket.cpp.o
[  4%] Building CXX object rcss/net/CMakeFiles/RCSSNet.dir/udpsocket.cpp.o
[  5%] Linking CXX shared library librcssnet.dylib
[  5%] Built target RCSSNet
[  6%] Building CXX object rcss/conf/CMakeFiles/RCSSConfParser.dir/parser.cpp.o
In file included from /Users/czs/Documents/develop/robocup/rcssserver-17.0.1/rcss/conf/parser.cpp:28:
/Users/czs/Documents/develop/robocup/rcssserver-17.0.1/rcss/conf/builder.hpp:849:27: warning: unused parameter 'value' [-Wunused-parameter]
                        V value )
                          ^
1 warning generated.
[  7%] Building CXX object rcss/conf/CMakeFiles/RCSSConfParser.dir/builder.cpp.o
In file included from /Users/czs/Documents/develop/robocup/rcssserver-17.0.1/rcss/conf/builder.cpp:26:
/Users/czs/Documents/develop/robocup/rcssserver-17.0.1/rcss/conf/builder.hpp:849:27: warning: unused parameter 'value' [-Wunused-parameter]
                        V value )
                          ^
1 warning generated.
[  8%] Building CXX object rcss/conf/CMakeFiles/RCSSConfParser.dir/statushandler.cpp.o
[  9%] Building CXX object rcss/conf/CMakeFiles/RCSSConfParser.dir/streamstatushandler.cpp.o
[ 10%] Linking CXX shared library librcssconfparser.dylib
Undefined symbols for architecture arm64:
  "boost::filesystem::path::append_v3(boost::filesystem::path const&)", referenced from:
      rcss::conf::Parser::include(char const*, char const*) in parser.cpp.o
  "boost::filesystem::detail::current_path(boost::system::error_code*)", referenced from:
      rcss::conf::Parser::include(char const*, char const*) in parser.cpp.o
  "boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)", referenced from:
      rcss::conf::Parser::include(char const*, char const*) in parser.cpp.o
  "boost::filesystem::detail::absolute(boost::filesystem::path const&, boost::filesystem::path const&, boost::system::error_code*)", referenced from:
      rcss::conf::Parser::include(char const*, char const*) in parser.cpp.o
  "boost::filesystem::path::find_root_directory() const", referenced from:
      rcss::conf::Parser::include(char const*, char const*) in parser.cpp.o
  "boost::filesystem::path::find_parent_path_size() const", referenced from:
      rcss::conf::Parser::include(char const*, char const*) in parser.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [rcss/conf/librcssconfparser.3.0.0.dylib] Error 1
make[1]: *** [rcss/conf/CMakeFiles/RCSSConfParser.dir/all] Error 2
make: *** [all] Error 2

I found the same issue https://github.com/rcsoccersim/rcssserver/issues/93#issuecomment-1203903713 . The solution is to upgrade bison's version. And I run bison -V,I get:

bison (GNU Bison) 3.8.2
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

It seems that upgrading the bison's version does not solve the problem. I suppose the issue here may be ld: symbol(s) not found for architecture arm64. If so, how can I resolve it?
I tried different versions of boost and rcssserver.

hidehisaakiyama commented 2 years ago

How did you install boost library?

xiaomi2077 commented 2 years ago

I tried two methods. One is through the brew commandbrew install boost, and the other is compiled from source

hidehisaakiyama commented 2 years ago

Perhaps there is something wrong with the installation of boost. I don't know which method is better because I'm not familiar with the recent macOS environment.

The option to directly specify the location of boost library file can be found by running ccmake .. in the build directory. Please try this, then cmake .. again.

xiaomi2077 commented 2 years ago

I successfully built the rcssserver. I searched the CmakeList.txt files in the project,and replace SHARED with STATIC