asoroa / ukb

Ukb: graph-based WSD and similarity
106 stars 28 forks source link

compile MacOS #11

Closed arademaker closed 1 year ago

arademaker commented 5 years ago

I got the error trying to compile on MacOS 10.15.1. Boost was installed with brew. Any idea?

% make
3.2.7.g7f3a305
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o globalVars.o -I /usr/local/include globalVars.cc
g++ -O2 -Wall -Wno-deprecated -D UKB_SERVER -o ukb_walkandprint ukb_walkandprint.cc common.o globalVars.o ukbServer.o configFile.o fileElem.o kbGraph.o kbGraph_common.o kbGraph_v16.o disambGraph.o csentence.o wdict.o walkandprint.o -I /usr/local/include  -L/usr/local/opt/icu4c/lib -lboost_program_options -lboost_system -lboost_filesystem -lboost_random -lpthread
Undefined symbols for architecture x86_64:
  "boost::system::system_category()", referenced from:
      ukb::start_daemon(unsigned int, void (*)(bool), bool (*)(ukb::sSession&)) in ukbServer.o
      ukb::sSession::sSession(boost::asio::io_context&, bool (*)(ukb::sSession&)) in ukbServer.o
      ukb::protocol::sRead::sRead(boost::asio::basic_stream_socket<boost::asio::ip::tcp>&) in ukbServer.o
      ukb::sSession::sSession(boost::asio::io_context&, bool (*)(ukb::sSession&)) in ukbServer.o
      ukb::sServer::start_accept() in ukbServer.o
      ukb::sClient::sClient(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int) in ukbServer.o
      boost::asio::ip::basic_resolver<boost::asio::ip::tcp>::resolve(boost::asio::ip::basic_resolver_query<boost::asio::ip::tcp> const&) in ukbServer.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ukb_walkandprint] Error 1
luigi-asprino commented 3 years ago

Hi,

I just compiled UKB on MacOS Big Sur 11.2.1 and I didn't experience any error.

% gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.21)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
arademaker commented 3 years ago

perfect, it worked with the following commands after install boost with brew

./configure --with-boost-include=/usr/local/include
make
arademaker commented 2 years ago

One year later... Now something is wrong with boost?

ar@tenis src % gcc -v
Apple clang version 13.1.6 (clang-1316.0.21.2.3)
Target: x86_64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

ar@tenis src % ./configure --with-boost-include=/usr/local/include
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether make sets $(MAKE)... yes
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for /usr/local/include/boost/graph/adjacency_list.hpp... yes
checking for /usr/local/include/boost/tokenizer.hpp... yes
checking for /usr/local/include/boost/lexical_cast.hpp... yes
checking for /usr/local/include/boost/filesystem/path.hpp... yes
checking for /usr/local/include/boost/random.hpp... yes
checking for main in -lboost_program_options... yes
checking for main in -lboost_system... yes
checking for main in -lboost_filesystem... yes
checking for main in -lboost_random... yes
configure: creating ./config.status
config.status: creating Makefile

ar@tenis src % make
3.2.7.g7f3a305.dirty
g++ -c -O2 -Wall -Wno-deprecated -D UKB_SERVER -o globalVars.o -I /usr/local/include globalVars.cc
g++ -O2 -Wall -Wno-deprecated -D UKB_SERVER -o ukb_walkandprint ukb_walkandprint.cc common.o globalVars.o ukbServer.o configFile.o fileElem.o kbGraph.o kbGraph_common.o kbGraph_v16.o disambGraph.o csentence.o wdict.o walkandprint.o -I /usr/local/include  -lboost_program_options -lboost_system -lboost_filesystem -lboost_random -lpthread
In file included from ukb_walkandprint.cc:4:
In file included from ./ukbServer.h:10:
/usr/local/include/boost/bind.hpp:36:1: warning: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated. Please use <boost/bind/bind.hpp> + using namespace boost::placeholders, or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior. [-W#pragma-messages]
BOOST_PRAGMA_MESSAGE(
^
/usr/local/include/boost/config/pragma_message.hpp:24:34: note: expanded from macro 'BOOST_PRAGMA_MESSAGE'
# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x)))
                                 ^
<scratch space>:162:2: note: expanded from here
 message("The practice of declaring the Bind placeholders (_1, _2, ...) " "in the global namespace is deprecated. Please use " "<boost/bind/bind.hpp> + using namespace boost::placeholders, " "or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior.")
 ^
1 warning generated.
Undefined symbols for architecture x86_64:
  "boost::filesystem::detail::directory_iterator_construct(boost::filesystem::directory_iterator&, boost::filesystem::path const&, boost::system::error_code*)", referenced from:
      ukb::extract_input_files(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in fileElem.o
  "boost::filesystem::absolute(boost::filesystem::path const&, boost::filesystem::path const&)", referenced from:
      ukb::get_fname_absolute(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in fileElem.o
  "boost::filesystem::directory_entry::m_get_status(boost::system::error_code*) const", referenced from:
      ukb::extract_input_files(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in fileElem.o
  "boost::filesystem::path::parent_path() const", referenced from:
      ukb::File_elem::fill(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in fileElem.o
  "boost::filesystem::path::lexically_normal() const", referenced from:
      ukb::File_elem::fill(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in fileElem.o
  "boost::filesystem::path::filename() const", referenced from:
      ukb::extract_input_files(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in fileElem.o
      ukb::File_elem::fill(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in fileElem.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [ukb_walkandprint] Error 1
arademaker commented 1 year ago

I was able to compile.