Author Topic: compiling cli on mac  (Read 2298 times)

0 Members and 1 Guest are viewing this topic.

Offline complexring

  • Full Member
  • ***
  • Posts: 66
    • View Profile
after a bit more digging, found the offending function definition in cliwallet.cpp.

static char** cli_completion( const char * text , int start, int end)
{
   char **matches;
   matches = (char **)NULL;

#ifdef HAVE_READLINE
   if (start == 0)
      matches = rl_completion_matches ((char*)text, &my_generator);
   else
      rl_bind_key('\t',rl_abort);
#endif

   return (matches);
}


clearly this is coming from the portion of code surrounded by the #ifdef READLINE #endif.

so, after attempting to set the readline library with a new cmake call using

 cmake . -DBDB_ROOT_DIR=/usr/local/BerkeleyDB.6.1 -DBOOST_ROOT=/usr/local/boost/1.59.0 -DBDB_VERSION=-6.1 -DReadline_ROOT_DIR=/usr/local

and then performing a grep on various Makesfiles, i see that cmake is still linking with my mac's system installed readline library, namely in /usr/local/lib

i think all i am missing now is the right macros for the readline directory.  the one used above was what i could decipher from the libraries/fc/CMakeModules/FindReadline.cmake .

note, also from this file, it looks like cmake searches for include/readline/readline.h inside of Readline_ROOT_DIR, hence why this is set to /usr/local and not /usr/local/include

i did try both setting Readline_ROOT_DIR to /usr/local /usr/local/include -- both of which failed.

any suggestions?  i don't use cmake enough, otherwise i'd be able parse this a bit more.

Offline complexring

  • Full Member
  • ***
  • Posts: 66
    • View Profile
ok, after successfully getting cmake to recognize my custom built 64 bit non-standard library locations for both berkeley-db and boost. i get the original error.

using

cmake . -DBDB_ROOT_DIR=/usr/local/BerkeleyDB.6.1 -DBOOST_ROOT=/usr/local/boost/1.59.0
make


Offline complexring

  • Full Member
  • ***
  • Posts: 66
    • View Profile
i found in CMakeModules/FindBerkeleyDB.cmake the macro used for the berkeley database.  also, the macro for boost.  i then use :

 BDB_ROOT_DIR=/usr/local/BerkeleyDB.6.1 BOOST_DIR=/usr/local/boost/1.59.0 cmake .

but this doesn't work either.   

Custom CMake files that give me an indication that these are the correct macro names are :

libraries/fc/CMakeModules/FindBoost.cmake 

and

CMakeModules/FindBerkeleyDB.cmake

cmake isn't recognizing the location for boost that i am passing.  either these custom files are wrong or i am ... probably the latter.


----- in response to your latest reply ---

latest version of boost is 1.59.0.  requirements for bitshares seems to be 1.57 (at least looking at cmake files that test for version number).

when i compiled with boost using b2, the updated bjam installer, i only installed 64-bit libraries and not 32-bit.  i know this because i prefer custom installs of all libraries and don't particularly trust brew to do what i want.  i then keep meticulous notes on the build i do and compiler options.  i built boost with

sudo ./b2 -j8 toolset=clang --without-mpi cxxflags="-arch i386 -arch x86_64 -fvisibility=hidden -fvisibility-inlines-hidden -std=c++11 -stdlib=libc++ -ftemplate-depth=512" linkflags="-stdlib=libc++" link=static stage

after checking your link, that happens to be the same stack overflow post i probably used to do that command.

so, boost is not the culprit here.

especially since cmake is not finding the locations of boost and berkeley-db.

Offline kuro112

i looked into it a little, your problem is probably with boost

your probably using the latest version (1.54? i think?)


in my past experiments i had to use a lower version of boost to compile, and built said boost on the same system (so i didnt use ports or brew)

i hope i at least pointed you in the right direction, see this thread for some more info:

http://stackoverflow.com/questions/18888327/using-boost-on-xcode-5-apple-llvm-5-0


note this user compiled with ./b2 and it added 64 bit support to his boost build, its possible you missed that step.
CTO @ Freebie, LLC

Offline complexring

  • Full Member
  • ***
  • Posts: 66
    • View Profile
well ... i have 64-bit versions of berkeley-db and boost installed manually and in non-default locations, but when i try to use cmake with

LDFLAGS="-L$BOOSTPATH/lib -L$BERKELEYDBPATH/lib" CPPFLAGS="-I$BOOSTPATH/include -I$BERKELEYDBPATH/include" cmake .

then cmake doesn't find the boost headers / library and the berkeley header / libraries.

this is how i remember using cmake in other projects ...

anyway, since i couldn't get cmake to recognize libraries in non-standard locations, i went with brew since brew will do symlinks into the standard install location.

i take it i am using cmake wrong ... correct?

---- edit to add ---

also, that particular library is built when running make and not created from any brew install (although knowing that brew does not do 64-bit libraries is good to know ...). 

so, in that case, is the bitshares repo compiling and then archiving a 32-bit library on an x86_64 architecture?  or did i miss reading which particular library is the offender ?


well your using the flags right, just not sure if your missing something / how your system is set up, hard to diagnose from here.

i can tell you for certain the error you got has to do with trying to compile with 32bit versions, beyond that im not sure how to fix it without seeing the system environment.

please see my edit.  i just changed it to be more specific to your reply while you were commenting.  thanks.

(editted to add edit in quoted text for easier reading of the conversation)

Offline kuro112

well ... i have 64-bit versions of berkeley-db and boost installed manually and in non-default locations, but when i try to use cmake with

LDFLAGS="-L$BOOSTPATH/lib -L$BERKELEYDBPATH/lib" CPPFLAGS="-I$BOOSTPATH/include -I$BERKELEYDBPATH/include" cmake .

then cmake doesn't find the boost headers / library and the berkeley header / libraries.

this is how i remember using cmake in other projects ...

anyway, since i couldn't get cmake to recognize libraries in non-standard locations, i went with brew since brew will do symlinks into the standard install location.

i take it i am using cmake wrong ... correct?

well your using the flags right, just not sure if your missing something / how your system is set up, hard to diagnose from here.

i can tell you for certain the error you got has to do with trying to compile with 32bit versions, beyond that im not sure how to fix it without seeing the system environment.
CTO @ Freebie, LLC

Offline complexring

  • Full Member
  • ***
  • Posts: 66
    • View Profile
well ... i have 64-bit versions of berkeley-db and boost installed manually and in non-default locations, but when i try to use cmake with

LDFLAGS="-L$BOOSTPATH/lib -L$BERKELEYDBPATH/lib" CPPFLAGS="-I$BOOSTPATH/include -I$BERKELEYDBPATH/include" cmake .

then cmake doesn't find the boost headers / library and the berkeley header / libraries.

this is how i remember using cmake in other projects ...

anyway, since i couldn't get cmake to recognize libraries in non-standard locations, i went with brew since brew will do symlinks into the standard install location.

i take it i am using cmake wrong ... correct?

---- edit to add ---

also, that particular library is built when running make and not created from any brew install (although knowing that brew does not do 64-bit libraries is good to know ...). 

so, in that case, is the bitshares repo compiling and then archiving a 32-bit library on an x86_64 architecture?  or did i miss reading which particular library is the offender ?
« Last Edit: November 06, 2015, 08:24:16 am by complexring »

Offline kuro112

hey pal it looks like you built or installed 32bit deps and are trying to build x64, build it as 32 or install 64 deps.

as a note, brew will most certainly not install the versions you need to compile, i recommend using ports and manually compiling boost etc.
CTO @ Freebie, LLC

Offline complexring

  • Full Member
  • ***
  • Posts: 66
    • View Profile
Hey everyone,

Cloned the latest bitshares from github, began compilation after installing dependencies via brew and got this error :

Undefined symbols for architecture x86_64:
  "_rl_abort", referenced from:
      fc::rpc::cli_completion(char const*, int, int) in libfc_debug.a(cli.cpp.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[2]: *** [programs/cli_wallet/cli_wallet] Error 1
make[1]: *** [programs/cli_wallet/CMakeFiles/cli_wallet.dir/all] Error 2
make: *** [all] Error 2


---

As a sanity test, I removed the libfc_debug.a library from libaries/fc and then rebuilt it with make, and then tried to build the project again, same error.


other info:


OS
mac osx el capitan

using clang compiler

installed dependencies with brew

and used the simple command "cmake ." before I did anything.