Loki-Astari / ThorsMongo

C++ MongoDB API and BSON/JSON Serialization library
GNU General Public License v3.0
316 stars 71 forks source link

error when running configure #13

Closed chfakht closed 9 years ago

chfakht commented 9 years ago

hi I'm getting this erros when running ./configure --disable-binary

checking for wget... wget
checking for unzip... unzip
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
Submodule 'build' () registered for path 'build'
Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Unable to fetch in submodule path 'build'
./configure: line 2990: pushd: build/third: No such file or directory
./configure: line 2991: ./setup: No such file or directory
configure: error: Failed to set up the test utilities

am i doing something wrong !!! thanks

chfakht commented 9 years ago

i have solved it a little by giving the right permission to configure and running it under root but get same errors , just the Warning disapered

checking for wget... wget
checking for unzip... unzip
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
Submodule 'build' () registered for path 'build'
fatal: Needed a single revision
Unable to find current revision in submodule path 'build'
./configure: line 2990: pushd: build/third: No such file or directory
./configure: line 2991: ./setup: No such file or directory
configure: error: Failed to set up the test utilities
Loki-Astari commented 9 years ago
  Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.

This is just warning you that it is adding the machine to your know hosts file. It only does this the first time. After that it should not be a problem.

It seems to be failing when pulling the build tools from github:

  Permission denied (publickey).

Because I use ssh for all my github communications it is expecting you to have registered your ssh public key with github. You can fix this by adding your public key to git hub as per this:

http://stackoverflow.com/questions/25828483/github-permission-denied-publickey

  ## Note the use of git@ here. This makes sure you pull it using ssh.
  ## If this works then the rest of the processes should also work.
  git clone git@github.com:Loki-Astari/ThorsSerializer.git
  cd ThorsSerializer
  ./configure --disable-binary
Loki-Astari commented 9 years ago

Note: Short Instructions:

Part 1: Generate ssh key

  # Generate an ssh key
  # If you don't have any keys then just hit enter to the prompts.
  > ssh-keygen -t rsa -b 4096
  Generating public/private rsa key pair.
  Enter file in which to save the key (/Users/Loki/.ssh/id_rsa):
  Enter passphrase (empty for no passphrase):
  Enter same passphrase again:
  Your identification has been saved in /Users/Loki/.ssh/id_rsa.
  Your public key has been saved in /Users/Loki/.ssh/id_rsa.pub.
  The key fingerprint is:
  42:cc:de:bf:61:a2:23:ab:ab:fd:27:11:77:da:ba:0c Loki@Asguard
  The key's randomart image is:
  +--[ RSA 4096]----+
  | .  .            |
  |.... .           |
  |+o.o  .          |
  |+o+  o . .       |
  |+.    + XX       |
  |.o.  . o . x x   |
  |. .xE.a.  a  a   |
  |    ..oo         |
  |     .oo.        |
  +-----------------+
  # If you have not set up a ~/.ssh/config file this will be all you need to do.
  # You can skip forward to adding your public key to github.
  # 
  # If you already have an ~/.ssh/config file then you probably know what to do!
  # But you can add an IdentityFile
  > echo  >> ~/.ssh/config
  > echo "IdentifyFile ~/.ssh/id_rsa"  >> ~/.ssh/config

Part 2: Add public key to github

Now you need to add the public part of the key to github.

  1. Got to the page "https://github.com/settings/ssh"
  2. Click the button "Add SSH Key" in the top right.
  3. Add a title the paste the content of the file ~/.ssh/id_rsa.pub

Now it should all work.

chfakht commented 9 years ago

thanks but i have solved it for now , i have the errors

  checking for wget... wget
  checking for unzip... unzip
  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
  Submodule 'build' () registered for path 'build'
  fatal: Needed a single revision
  Unable to find current revision in submodule path 'build'
  ./configure: line 2990: pushd: build/third: No such file or directory
  ./configure: line 2991: ./setup: No such file or directory
  configure: error: Failed to set up the test utilities
Loki-Astari commented 9 years ago

Those errors are caused because you did not solve it. Your git submodule update failed because you don't have any keys installed on github.com

Once you have added your ssh keys correctly (see above). You can fix by:

 git submodule update
 ./configure --disable-binary
Loki-Astari commented 9 years ago

@chfakht I see you have now installed a public key on github. Are you problems solved?

chfakht commented 9 years ago

yes it's working now but after that when i run make i get those errors

  Buiding src Start
  make -C src build PREFIX=/home/pi/yB/ThorsSerializer/build CXXSTDVER=
  make[1]: Entering directory '/home/pi/yB/ThorsSerializer/src'
  Buiding BinaryRep Start
  make -C BinaryRep build PREFIX=/home/pi/yB/ThorsSerializer/build CXXSTDVER=
  make[2]: Entering directory '/home/pi/yB/ThorsSerializer/src/BinaryRep'
  Building Objects for Testing and Coverage
  make[3]: Entering directory '/home/pi/yB/ThorsSerializer/src/BinaryRep'
  make[3]: Nothing to be done for 'gcovarch'.
  make[3]: Leaving directory '/home/pi/yB/ThorsSerializer/src/BinaryRep'
  Building Unit Tests
  make[3]: Entering directory '/home/pi/yB/ThorsSerializer/src/BinaryRep/test'
  Building coverage
  g++ -c unittest.cpp -DCOVERAGE_BinaryRep                             OK
  ERROR
  g++ -c BinaryRepTest.cpp -o coverage/BinaryRepTest.o -fPIC -I/home/pi/yB/ThorsSerializer/build/include -isystem /home/pi/yB/ThorsSerializer/build/include3rd -DBOOST_FILESYSTEM_VERSION=3 -I.. -DCOVERAGE_BinaryRep -g -fprofile-arcs -ftest-coverage -DCOVERAGE_TEST -Wno-unreachable-code -DTHOR_USE_CPLUSPLUS
  ========================================
  In file included from ../BinaryRep.h:5:0,
                   from BinaryRepTest.cpp:3:
  ../BinaryFormat.h:5:29: fatal error: BinaryRepConfig.h: No such file or directory
  compilation terminated.
  /home/pi/yB/ThorsSerializer/build/tools/Makefile:514: recipe for target 'coverage/BinaryRepTest.o'       failed
  make[3]: *** [coverage/BinaryRepTest.o] Error 1
  make[3]: *** Waiting for unfinished jobs....
  ERROR
  g++ -c FltBinRepTest.cpp -o coverage/FltBinRepTest.o -fPIC -I/home/pi/yB/ThorsSerializer/build/include -isystem /home/pi/yB/ThorsSerializer/build/include3rd -DBOOST_FILESYSTEM_VERSION=3 -I.. -DCOVERAGE_BinaryRep -g -fprofile-arcs -ftest-coverage -DCOVERAGE_TEST -Wno-unreachable-code -DTHOR_USE_CPLUSPLUS
  ========================================
  In file included from ../FltBinRep.h:6:0,
             from FltBinRepTest.cpp:3:
  ../BinaryFormat.h:5:29: fatal error: BinaryRepConfig.h: No such file or directory
  compilation terminated.
  /home/pi/yB/ThorsSerializer/build/tools/Makefile:514: recipe for target 'coverage/FltBinRepTest.o' failed
  make[3]: *** [coverage/FltBinRepTest.o] Error 1
  ERROR
  g++ -c BinaryFormatTest.cpp -o coverage/BinaryFormatTest.o -fPIC -I/home/pi/yB/ThorsSerializer/build/include -isystem /home/pi/yB/ThorsSerializer/build/include3rd -DBOOST_FILESYSTEM_VERSION=3 -I.. -DCOVERAGE_BinaryRep -g -fprofile-arcs -ftest-coverage -DCOVERAGE_TEST -Wno-unreachable-code -DTHOR_USE_CPLUSPLUS
  ========================================
  In file included from BinaryFormatTest.cpp:3:0:
  ../BinaryFormat.h:5:29: fatal error: BinaryRepConfig.h: No such file or directory
  compilation terminated.
  ERROR
  g++ -c IntBinRepTest.cpp -o coverage/IntBinRepTest.o -fPIC -I/home/pi/yB/ThorsSerializer/build/include -isystem /home/pi/yB/ThorsSerializer/build/include3rd -DBOOST_FILESYSTEM_VERSION=3 -I.. -DCOVERAGE_BinaryRep -g -fprofile-arcs -ftest-coverage -DCOVERAGE_TEST -Wno-unreachable-code -DTHOR_USE_CPLUSPLUS
  /home/pi/yB/ThorsSerializer/build/tools/Makefile:514: recipe for target 'coverage/BinaryFormatTest.o' failed
  ========================================
  make[3]: *** [coverage/BinaryFormatTest.o] Error 1
  In file included from ../IntBinRep.h:5:0,
                   from IntBinRepTest.cpp:3:
  ../BinaryFormat.h:5:29: fatal error: BinaryRepConfig.h: No such file or directory
  compilation terminated.
  /home/pi/yB/ThorsSerializer/build/tools/Makefile:514: recipe for target 'coverage/IntBinRepTest.o' failed
  make[3]: *** [coverage/IntBinRepTest.o] Error 1
  rm coverage/unittest.o
  make[3]: Leaving directory '/home/pi/yB/ThorsSerializer/src/BinaryRep/test'
  /home/pi/yB/ThorsSerializer/build/tools/Makefile:320: recipe for target 'test' failed
  make[2]: *** [test] Error 2
  make[2]: Leaving directory '/home/pi/yB/ThorsSerializer/src/BinaryRep'
  /home/pi/yB/ThorsSerializer/build/tools/Project.Makefile:30: recipe for target 'BinaryRep.dir' failed
  make[1]: *** [BinaryRep.dir] Error 2
  make[1]: Leaving directory '/home/pi/yB/ThorsSerializer/src'
  /home/pi/yB/ThorsSerializer/build/tools/Project.Makefile:30: recipe for target 'src.dir' failed
  make: *** [src.dir] Error 2
Loki-Astari commented 9 years ago

@chfakht

The error:

 ../BinaryFormat.h:5:29: fatal error: BinaryRepConfig.h: No such file or directory

The file BinaryFormat.h should be in the directory src/BinaryRep/BinaryRepConfig.h and is generated from the file src/BinaryRep/BinaryRepConfig.h.in by the configuration scripts. If this file does not exist then it suggests that ./configuration has not run correctly.

Please re-run the configuration script. It does a lot more than download the build tools. It also sets up the tests tools and checks the configuration.

Loki-Astari commented 9 years ago

@chfakht I am sorry for all the problems.

From this experience I have updated my build tools to provide more detailed instructions when this happens to the next person. I hope we can solve your next issue as well.

chfakht commented 9 years ago

you have done a great job :100: hope that the issue will be solved in the next release .... oh i forget to tell you that i'm using GCC 4.6 that came by default in raspbian installed on my pi ... however in your requirement you said that i must have a compiler compatible with c++14 version !!! => it could be this the problem

Loki-Astari commented 9 years ago

Yep that is definitely a problem: The configuration scripts will fail (and refuse to complete) unless your compiler can support C++14 (so that sounds like the problem).

According to this page: https://gcc.gnu.org/projects/cxx0x.html

gcc 4.6 only supports the C++ 11 as a pre-release

According to this page: https://gcc.gnu.org/projects/cxx1y.html

gcc 4.8 supports the C++ 14 (but best to upgrade to gcc 4.9 as a minimum).

chfakht commented 9 years ago

now that i have installed g++4.9 like an option in raspberry from this link :https://solarianprogrammer.com/2015/01/13/raspberry-pi-raspbian-install-gcc-compile-cpp-14-programs/ , now i can compile an example by g++-4.9 -std=c++14 -Wall -pedantic test.cpp -o lambda_test so how can add the flag g++-4.9 to use it with configure for example

Loki-Astari commented 9 years ago

On Ubuntu you can specify which version is the default compiler with update-alternatives.

see: how-to-change-the-default-gcc-compiler-in-ubuntu for details.

Note: The makefile will also want to run code coverage tests on the code you will probably need to install the gcov-4.9 tool as well.

If you are using a system where it is hard to change the default you can tell configure to use an alternative.

CXX=g++-4.9 COV=gcov-4.9 ./configure --disable-binary
chfakht commented 9 years ago

No when running CXX=g++-4.9 COV=gcov-4.9 ./configure --disable-binary i get this checking for wget... wget checking for unzip... unzip 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++-4.9 accepts -g... yes Submodule 'build' () registered for path 'build' ~/yB/ThorsSerializer/build/third ~/yB/ThorsSerializer ~/yB/ThorsSerializer checking whether we are using the GNU C++ compiler... (cached) yes checking whether g++-4.9 accepts -g... (cached) yes checking for gcc... gcc checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking whether gcc understands -c and -o together... yes checking for flex... no checking for lex... no configure: error:

Error: This package uses flex (and is not compatible with lex). Please make sure flex is installed.

when trying to install bison & flex by

sudo apt-get install bison flex Reading package lists... Done Building dependency tree
Reading state information... Done Package bison is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: bison-doc

Package flex is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'bison' has no installation candidate E: Package 'flex' has no installation candidate

Loki-Astari commented 9 years ago

You can download and build bison/flex from source

http://stackoverflow.com/q/7320370/14065

chfakht commented 9 years ago

thanks i installed flex bison and yaml ang run the command successfull but when running make i get those errors

make
Buiding src Start
make -C src build PREFIX=/home/pi/yB/ThorsSerializer/build CXXSTDVER=14
make[1]: Entering directory '/home/pi/yB/ThorsSerializer/src'
Buiding BinaryRep Start
make -C BinaryRep build PREFIX=/home/pi/yB/ThorsSerializer/build CXXSTDVER=14
make[2]: Entering directory '/home/pi/yB/ThorsSerializer/src/BinaryRep'
Building Objects for Testing and Coverage
make[3]: Entering directory '/home/pi/yB/ThorsSerializer/src/BinaryRep'
make[3]: Nothing to be done for 'gcovarch'.
make[3]: Leaving directory '/home/pi/yB/ThorsSerializer/src/BinaryRep'
Building Unit Tests
make[3]: Entering directory '/home/pi/yB/ThorsSerializer/src/BinaryRep/test'
Building coverage
g++-4.9 -c unittest.cpp -DCOVERAGE_BinaryRep                         OK
g++-4.9 -c BinaryRepTest.cpp -DCOVERAGE_BinaryRep                    OK
g++-4.9 -c BinaryFormatTest.cpp -DCOVERAGE_BinaryRep                 OK
g++-4.9 -c IntBinRepTest.cpp -DCOVERAGE_BinaryRep                    OK
g++-4.9 -c FltBinRepTest.cpp -DCOVERAGE_BinaryRep                    OK
g++-4.9 -o coverage/unittest.app -DCOVERAGE_BinaryRep                ERROR
g++-4.9 -o coverage/unittest.app coverage/FltBinRepTest.o coverage/BinaryRepTest.o coverage/IntBinRepTest.o coverage/BinaryFormatTest.o coverage/unittest.o -L../coverage -L/home/pi/yB/ThorsSerializer/build/lib -lgtest -fprofile-arcs -ftest-coverage -lpthread -L/home/pi/yB/ThorsSerializer/build/lib
    ===================================================
    coverage/FltBinRepTest.o: In function `FltBinRepTest_convertIEEELongDoubleNan_Test::TestBody()':
/home/pi/yB/ThorsSerializer/src/BinaryRep/test/FltBinRepTest.cpp:42: undefined reference to `ThorsAnvil::BinaryRep::FloatConverterTrait<long double>::StorageType ThorsAnvil::BinaryRep::host2NetIEEE<long double, true, 8u, 53u>(long double)'
    coverage/FltBinRepTest.o: In function `FltBinRepTest_convertIEEELongDouble1Million234p875_Test::TestBody()':
/home/pi/yB/ThorsSerializer/src/BinaryRep/test/FltBinRepTest.cpp:90: undefined reference to `ThorsAnvil::BinaryRep::FloatConverterTrait<long double>::StorageType ThorsAnvil::BinaryRep::host2NetIEEE<long double, true, 8u, 53u>(long double)'
coverage/FltBinRepTest.o: In function `FltBinRepTest_revertIEEELongDoubleNan_Test::TestBody()':
/home/pi/yB/ThorsSerializer/src/BinaryRep/test/FltBinRepTest.cpp:106: undefined reference to `ThorsAnvil::BinaryRep::FloatConverterTrait<long double>::StorageType ThorsAnvil::BinaryRep::host2NetIEEE<long double, true, 8u, 53u>(long double)'
/home/pi/yB/ThorsSerializer/src/BinaryRep/test/FltBinRepTest.cpp:106: undefined reference to `long double ThorsAnvil::BinaryRep::net2HostIEEE<long double, true, 8u, 53u>(ThorsAnvil::BinaryRep::FloatConverterTrait<long double>::StorageType)'
coverage/FltBinRepTest.o: In function `FltBinRepTest_revertIEEELongDouble1Million234p875_Test::TestBody()':
/home/pi/yB/ThorsSerializer/src/BinaryRep/test/FltBinRepTest.cpp:121: undefined reference to `ThorsAnvil::BinaryRep::FloatConverterTrait<long double>::StorageType ThorsAnvil::BinaryRep::host2NetIEEE<long double, true, 8u, 53u>(long double)'
/home/pi/yB/ThorsSerializer/src/BinaryRep/test/FltBinRepTest.cpp:121: undefined reference to `long double ThorsAnvil::BinaryRep::net2HostIEEE<long double, true, 8u, 53u>(ThorsAnvil::BinaryRep::FloatConverterTrait<long double>::StorageType)'
collect2: error: ld returned 1 exit status
/home/pi/yB/ThorsSerializer/build/tools/Makefile:463: recipe for target 'coverage/unittest.app' failed
make[3]: *** [coverage/unittest.app] Error 1
rm coverage/unittest.o
make[3]: Leaving directory '/home/pi/yB/ThorsSerializer/src/BinaryRep/test'
/home/pi/yB/ThorsSerializer/build/tools/Makefile:320: recipe for target 'test' failed
make[2]: *** [test] Error 2
make[2]: Leaving directory '/home/pi/yB/ThorsSerializer/src/BinaryRep'
/home/pi/yB/ThorsSerializer/build/tools/Project.Makefile:30: recipe for target 'BinaryRep.dir' failed
make[1]: *** [BinaryRep.dir] Error 2
make[1]: Leaving directory '/home/pi/yB/ThorsSerializer/src'
/home/pi/yB/ThorsSerializer/build/tools/Project.Makefile:30: recipe for target 'src.dir' failed
make: *** [src.dir] Error 2

what's next :package:␣
Loki-Astari commented 9 years ago

I have updated the build tools to handle this correctly now. If you pass the --disable-binary flag to configure it will not build the BinaryRep directory. Which is probably a good move as it is probably not trivialy portable to other hardware.

git pull ./configure --disable-binary make

chfakht commented 9 years ago

Now finally i was able to run ./configure make and sudo make install successfully :+1: but when trying the simple example in doc folder

g++-4.9 -std=c++14 example1.cpp -lThorSerialize14

(it's compiled successfully) but when running the executable i get

./a.out: error while loading shared libraries: libThorSerialize14.so: cannot open shared object file: No such file or directory

some final help plzz

Loki-Astari commented 9 years ago

When the system tries to load shared libraries at runtime it has to know where to look. By default this is just in /usr/lib but the system allows you to extend the default by having the file /etc/ld.so.conf. On most version of Linux this will add the directory /usr/local/lib (which is where user defined software is installed).

I suspect the raspberry-pi is not a standard desktop configuration where user code is normally installed.

For full details:
http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

So you have two options if you want all user built libs to work.

1) Modify /etc/ld.so.conf to add /usr/local/lib 2) Build so that the shared lib is installed in /usr/lib

./configure --disable-binary prefix=/usr
sudo make instal

Optionally you can use the environment variables to modify the search path temporarily.

# Notice there is just a space between the two commands.
# This works in bash and only modifies the environment for this one command.
LD_LIBRARY_PATH=/usr/local/lib ./a.out

# if you want to extend it permanently (for the current shell)
export LD_LIBRARY_PATH=/usr/local/lib
./a.out
chfakht commented 9 years ago

thanks a lot , i have modify /etc/ld.so.conf to add /usr/local/lib and runned ldconfig after that , now i am able to run the example successfullty thanks for putting in your time and effort to solve this issue :100: , i have also learn a lot of things from this :+1: after that i want to use JSON format to save some data into database .... i've choosen mongoDB database , have you any idea on how to use it in C++ , or maybe suggest me another database :1234: thanks

Loki-Astari commented 9 years ago

Sorry. I have not used Mongo. Good luck.

I have used MySQL and there are C++ libraries available for that.

chfakht commented 9 years ago

yes i have found "jsoncpp" in github that support MySQL , but however i don't know if MySQL is suitable in my case since i just want to stock some data on it without need the to update it ... ᐧ

2015-08-16 22:00 GMT+01:00 Loki Astari notifications@github.com:

Sorry. I have not used Mongo. Good luck.

I have used MySQL and there are C++ libraries available for that.

— Reply to this email directly or view it on GitHub https://github.com/Loki-Astari/ThorsSerializer/issues/13#issuecomment-131622023 .