awidegreen / tr064

A library and tool for querying, executing and exporting TR-064 devices and services
BSD 2-Clause "Simplified" License
10 stars 2 forks source link

field has incomplete type #1

Closed ehabtanta closed 9 years ago

ehabtanta commented 9 years ago

hi i am totally new to this but i really need to use the app to test some tr064 routers

so i hardly got the Dependencies and had them red right by the cmake

after that i got this error and i dont know how to fix it

[ 23%] Building CXX object lib/CMakeFiles/tr064.dir/soap/Session.cc.o In file included from /home/ehab/Desktop/tr064/lib/ResourceRetrieval.cc:1:0: /home/ehab/Desktop/tr064/include/tr064/ResourceRetrieval.hh:60:15: error: field ‘_host’ has incomplete type /home/ehab/Desktop/tr064/include/tr064/ResourceRetrieval.hh:61:15: error: field ‘_port’ has incomplete type /home/ehab/Desktop/tr064/include/tr064/ResourceRetrieval.hh:52:51: error: default argument for parameter of type ‘const string& {aka const std::basic_string&}’ has type ‘const char [5]’ In file included from /home/ehab/Desktop/tr064/include/tr064/CpeElementBuilder.hh:5:0, from /home/ehab/Desktop/tr064/lib/CpeElementBuilder.cc:2: /home/ehab/Desktop/tr064/include/tr064/ResourceRetrieval.hh:60:15: error: field ‘_host’ has incomplete type /home/ehab/Desktop/tr064/include/tr064/ResourceRetrieval.hh:61:15: error: field ‘_port’ has incomplete type /home/ehab/Desktop/tr064/include/tr064/ResourceRetrieval.hh:52:51: error: default argument for parameter of type ‘const string& {aka const std::basic_string&}’ has type ‘const char [5]’ /home/ehab/Desktop/tr064/lib/ResourceRetrieval.cc: In constructor ‘tr064::ResourceRetreivalHttp::ResourceRetreivalHttp(const string&, const string&)’: /home/ehab/Desktop/tr064/lib/ResourceRetrieval.cc:24:3: error: class ‘tr064::ResourceRetreivalHttp’ does not have any field named ‘_host’ /home/ehab/Desktop/tr064/lib/ResourceRetrieval.cc:25:3: error: class ‘tr064::ResourceRetreivalHttp’ does not have any field named ‘_port’ /home/ehab/Desktop/tr064/lib/ResourceRetrieval.cc: In member function ‘virtual tr064::ResourceStream tr064::ResourceRetreivalHttp::get(const string&) const’: /home/ehab/Desktop/tr064/lib/ResourceRetrieval.cc:33:8: error: ‘_host’ was not declared in this scope /home/ehab/Desktop/tr064/lib/ResourceRetrieval.cc:39:16: error: ‘_host’ was not declared in this scope /home/ehab/Desktop/tr064/lib/ResourceRetrieval.cc:39:32: error: ‘_port’ was not declared in this scope make[2]: * [lib/CMakeFiles/tr064.dir/ResourceRetrieval.cc.o] Error 1 make[2]: * Waiting for unfinished jobs.... make[2]: * [lib/CMakeFiles/tr064.dir/CpeElementBuilder.cc.o] Error 1 make[1]: * [lib/CMakeFiles/tr064.dir/all] Error 2 make: *\ [all] Error 2

so please can u tell me what to do with it ? shoud i edit it and put my host and port data ?|

tnx n advance

after lost of searching it turnd out to be an old gcc installiation proplem now i updateted it and face issues with openssl and tried to solve them but still no use

e@e-VirtualBox:~/tr064/build$ cmake ..
CMake Error at /usr/share/cmake-3.0/Modules/FindPackageHandleStandardArgs.cmake:136 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES
  OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.0/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:328 (find_package_handle_standard_args)
  CMakeLists.txt:22 (find_package)

-- Configuring incomplete, errors occurred!
See also "/home/e/tr064/build/CMakeFiles/CMakeOutput.log".
CMake Error: Unable to open check cache file for write. /home/e/tr064/build/CMakeFiles/cmake.check_cache
e@e-VirtualBox:~/tr064/build$ cmake -DOPENSSL_ROOT_DIR=/usr/local/ssl -DOPENSSL_LIBRARIES=/usr/local/ssl/lib
CMake Error: The source directory "/home/e/tr064/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
e@e-VirtualBox:~/tr064/build$ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/ssl -DOPENSSL_LIBRARIES=/usr/local/ssl/lib
CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:293 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:22 (find_package)

CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:294 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:22 (find_package)

CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:296 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:22 (find_package)

CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:298 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:22 (find_package)

-- Found OpenSSL: /usr/local/ssl/lib/libssl.a;/usr/local/ssl/lib/libcrypto.a (found version ".0.0`") 
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   system
-- OPENSSL_LIBRARIES defined.
-- OPENSSL_INCLUDE_DIR defined.
-- Found GTest: /usr/lib/libgtest.so  
-- Found Gtest, including unit tests.
-- Configuring incomplete, errors occurred!
See also "/home/e/tr064/build/CMakeFiles/CMakeOutput.log".
CMake Error: Unable to open check cache file for write. /home/e/tr064/build/CMakeFiles/cmake.check_cache
e@e-VirtualBox:~/tr064/build$ cd
e@e-VirtualBox:~$ cd tr064
e@e-VirtualBox:~/tr064$ mkdir x
e@e-VirtualBox:~/tr064$ cd x
e@e-VirtualBox:~/tr064/x$ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/ssl -DOPENSSL_LIBRARIES=/usr/local/ssl/lib
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:293 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:22 (find_package)

CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:294 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:22 (find_package)

CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:296 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:22 (find_package)

CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:298 (list):
  list GET given empty list
Call Stack (most recent call first):
  CMakeLists.txt:22 (find_package)

-- Found OpenSSL: /usr/local/ssl/lib/libssl.a;/usr/local/ssl/lib/libcrypto.a (found version ".0.0`") 
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   system
-- OPENSSL_LIBRARIES defined.
-- OPENSSL_INCLUDE_DIR defined.
-- Found GTest: /usr/lib/libgtest.so  
-- Found Gtest, including unit tests.
-- Configuring incomplete, errors occurred!
See also "/home/e/tr064/x/CMakeFiles/CMakeOutput.log".
e@e-VirtualBox:~/tr064/x$ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/ssl -DOPENSSL_LIBRARIES=/usr/local/ssl/lib
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   system
-- OPENSSL_LIBRARIES defined.
-- OPENSSL_INCLUDE_DIR defined.
-- Found Gtest, including unit tests.
-- Configuring done
WARNING: Target "tr064" requests linking to directory "/usr/local/ssl/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "tr064export" requests linking to directory "/usr/local/ssl/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "tr064tool" requests linking to directory "/usr/local/ssl/lib".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "tr064_tests" requests linking to directory "/usr/local/ssl/lib".  Targets may link only to libraries.  CMake is dropping the item.
-- Generating done
-- Build files have been written to: /home/e/tr064/x
e@e-VirtualBox:~/tr064/x$ make -j 4
Scanning dependencies of target PugiXml
[  3%] Building CXX object contrib/pugixml/CMakeFiles/PugiXml.dir/pugixml.cpp.o
[  3%] Built target PugiXml
Scanning dependencies of target tr064
[ 11%] [ 15%] [ 19%] [ 19%] Building CXX object lib/CMakeFiles/tr064.dir/Utils.cc.o
Building CXX object lib/CMakeFiles/tr064.dir/CpeElementBuilder.cc.o
Building CXX object lib/CMakeFiles/tr064.dir/trace.cc.o
Building CXX object lib/CMakeFiles/tr064.dir/RootDeviceDiscovery.cc.o
[ 23%] Building CXX object lib/CMakeFiles/tr064.dir/RootDevice.cc.o
[ 26%] Building CXX object lib/CMakeFiles/tr064.dir/Service.cc.o
[ 30%] Building CXX object lib/CMakeFiles/tr064.dir/ResourceRetrieval.cc.o
[ 34%] Building CXX object lib/CMakeFiles/tr064.dir/CpeQuery.cc.o
[ 38%] Building CXX object lib/CMakeFiles/tr064.dir/ServiceAction.cc.o
[ 42%] Building CXX object lib/CMakeFiles/tr064.dir/Device.cc.o
[ 46%] Building CXX object lib/CMakeFiles/tr064.dir/net/HttpConnection.cc.o
[ 50%] Building CXX object lib/CMakeFiles/tr064.dir/net/HttpRequest.cc.o
[ 53%] Building CXX object lib/CMakeFiles/tr064.dir/serialize/SerializerJson.cc.o
[ 57%] Building CXX object lib/CMakeFiles/tr064.dir/soap/Session.cc.o
[ 61%] Building CXX object lib/CMakeFiles/tr064.dir/soap/Auth.cc.o
Linking CXX shared library libtr064.so
[ 61%] Built target tr064
Scanning dependencies of target tr064tool
Scanning dependencies of target tr064export
Scanning dependencies of target tr064_tests
[ 65%] [ 69%] [ 73%] [ 76%] Building CXX object tests/CMakeFiles/tr064_tests.dir/cpeservice_test.cc.o
Building CXX object tests/CMakeFiles/tr064_tests.dir/utils_test.cc.o
Building CXX object src/CMakeFiles/tr064export.dir/tr064export.cc.o
Building CXX object src/CMakeFiles/tr064tool.dir/tr064.cc.o
In file included from /home/e/tr064/tests/cpeservice_test.cc:2:0:
/home/e/tr064/tests/cpe_test_global.hh:8:25: fatal error: gmock/gmock.h: No such file or directory
 #include <gmock/gmock.h>
                         ^
In file included from /home/e/tr064/tests/utils_test.cc:2:0:
/home/e/tr064/tests/cpe_test_global.hh:8:25: fatal error: gmock/gmock.h: No such file or directory
 #include <gmock/gmock.h>
                         ^
compilation terminated.
compilation terminated.
Linking CXX executable tr064export
../lib/libtr064.so: undefined reference to `MD5'
collect2: error: ld returned 1 exit status
src/CMakeFiles/tr064export.dir/build.make:87: recipe for target 'src/tr064export' failed
make[2]: *** [src/tr064export] Error 1
CMakeFiles/Makefile2:127: recipe for target 'src/CMakeFiles/tr064export.dir/all' failed
make[1]: *** [src/CMakeFiles/tr064export.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 80%] Building CXX object tests/CMakeFiles/tr064_tests.dir/deserialize_json_test.cc.o
/home/e/tr064/tests/deserialize_json_test.cc:1:25: fatal error: gmock/gmock.h: No such file or directory
 #include <gmock/gmock.h>
                         ^
compilation terminated.
tests/CMakeFiles/tr064_tests.dir/build.make:100: recipe for target 'tests/CMakeFiles/tr064_tests.dir/deserialize_json_test.cc.o' failed
make[2]: *** [tests/CMakeFiles/tr064_tests.dir/deserialize_json_test.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Linking CXX executable tr064tool
../lib/libtr064.so: undefined reference to `MD5'
collect2: error: ld returned 1 exit status
src/CMakeFiles/tr064tool.dir/build.make:87: recipe for target 'src/tr064tool' failed
make[2]: *** [src/tr064tool] Error 1
CMakeFiles/Makefile2:162: recipe for target 'src/CMakeFiles/tr064tool.dir/all' failed
make[1]: *** [src/CMakeFiles/tr064tool.dir/all] Error 2
tests/CMakeFiles/tr064_tests.dir/build.make:54: recipe for target 'tests/CMakeFiles/tr064_tests.dir/utils_test.cc.o' failed
make[2]: *** [tests/CMakeFiles/tr064_tests.dir/utils_test.cc.o] Error 1
tests/CMakeFiles/tr064_tests.dir/build.make:77: recipe for target 'tests/CMakeFiles/tr064_tests.dir/cpeservice_test.cc.o' failed
make[2]: *** [tests/CMakeFiles/tr064_tests.dir/cpeservice_test.cc.o] Error 1
CMakeFiles/Makefile2:292: recipe for target 'tests/CMakeFiles/tr064_tests.dir/all' failed
make[1]: *** [tests/CMakeFiles/tr064_tests.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
e@e-VirtualBox:~/tr064/x$ 
awidegreen commented 9 years ago

What's the OS (version) your trying it on? Which openssl version have you installed/compiled?

As for the google test issue, you can probably try to comment out the

add_subdirectory(tests) 

in https://github.com/awidegreen/tr064/blob/master/CMakeLists.txt#L41 for the time being

ehabtanta commented 9 years ago

tnx for replying i am using centOS 7 for the time being and i workaround the openssl issue by this command cmake -DOPENSSL_ROOT_DIR=/usr/local/ssl -DOPENSSL_LIBRARIES=/usr/local/ssl/lib but when i try to make -j 4 i receive the following errors

[ 61%] Building CXX object lib/CMakeFiles/tr064.dir/soap/Session.cc.o Linking CXX shared library libtr064.so /usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(md5_one.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC /usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value collect2: error: ld returned 1 exit status make[2]: * [lib/libtr064.so] Error 1 make[1]: * [lib/CMakeFiles/tr064.dir/all] Error 2 make: *\ [all] Error 2

os: centos 7 openssl v: OpenSSL 1.0.1e-fips 11 Feb 2013 i complied 1.0.2a multi times but the system still reads this version gcc version : gcc (GCC) 4.8.3 20140911 cmake :cmake version 3.2.2 gtest v :1.7 ( cant get it with gtest version nor GTEST --VERION COMMANDS ) bosst : 1.54

ehabtanta commented 9 years ago

this is the cmake output [ehab@localhost x]$ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/ssl -DOPENSSL_LIBRARIES=/usr/local/ssl/lib -- Found OpenSSL: /usr/local/ssl/lib/libssl.a;/usr/local/ssl/lib/libcrypto.a (found version "1.0.2a") -- Boost version: 1.54.0 -- Found the following Boost libraries: -- system -- OPENSSL_LIBRARIES defined. -- OPENSSL_INCLUDE_DIR defined. -- Found GTest: /usr/lib/libgtest.so
-- Found Gtest, including unit tests. -- Configuring done -- Generating done -- Build files have been written to: /home/ehab/Desktop/tr64/x

awidegreen commented 9 years ago

I tried it myself on centos7; worked for me. However I only used standard yum packages

openssl-devel
openssl-libs
boost-devel
gcc-c++.x86_64                     4.8.3-9.el7 

I needed to remove the REQUIRED in the CMakeLists.txt when finding gtest, because I couldn't find a gtest package for centos easily. I will probably push this, so that the unittest is only compiled and used when gtest is available.

Anyway, that worked perfectly for me.

[vagrant@localhost build]$ cmake ..
-- The C compiler identification is GNU 4.8.3
-- The CXX compiler identification is GNU 4.8.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found OpenSSL: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so (found version "1.0.1e") 
-- Boost version: 1.53.0
-- Found the following Boost libraries:
--   system
-- OPENSSL_LIBRARIES defined.
-- OPENSSL_INCLUDE_DIR defined.
-- Could NOT find GTest (missing:  GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- Found NOT Gtest, unit tests not included in build.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vagrant/tr064/build

As for your problem, I can see that your openssl is a static lib (*.a) ... any specific reason for that? The compiler is actually telling you what the problem is:

/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(md5_one.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC

Using a shared lib for openssl should solve your issue, I guess.

ehabtanta commented 9 years ago

yep i konw that this is the issue but honestly i dont know why it is that way and couldnt replace it with a new version

can u please tel me how to replace the static openssl with a shared lib one ?

awidegreen commented 9 years ago

well ... provide the shared parameter, I guess see https://wiki.openssl.org/index.php/Compilation_and_Installation

ehabtanta commented 9 years ago

./cofig shared make make install doing it right now will see the result by the way i want to use it with another cpe not the firtiz box i know the device ip and the tr064 port & xml file path how to integrate the info ?

ehabtanta commented 9 years ago

it wont work tried alot of shared comands even tried to remove openssl and recomplie it but sitll gives this error

make[4]: * [link_a.gnu] Error 1 make[4]: Leaving directory '/home/e/Downloads/openssl-1.0.2a' Makefile:349: recipe for target 'do_linux-shared' failed make[3]: * [do_linux-shared] Error 2 make[3]: Leaving directory '/home/e/Downloads/openssl-1.0.2a' Makefile:302: recipe for target 'libcrypto.so.1.0.0' failed make[2]: * [libcrypto.so.1.0.0] Error 2 make[2]: Leaving directory '/home/e/Downloads/openssl-1.0.2a' Makefile:109: recipe for target 'shared' failed make[1]: * [shared] Error 2 make[1]: Leaving directory '/home/e/Downloads/openssl-1.0.2a/crypto' Makefile:279: recipe for target 'build_crypto' failed make: *\ [build_crypto] Error 1

can u pleas tel me what to do ?

awidegreen commented 9 years ago

For compiling openssl, I haven't tried it myself. Therefore you should maybe ask the openssl community.

For now, tr064tool always performs a device discovery, or you need to provide a json file -i|--import; which you can create with tr064export.

Adding a parameter to specify a device (ip-addr/hostname) which should be used, is not a bad idea.

ehabtanta commented 9 years ago

ok after days of trail and error i complied the project ignoring the gtest just like u did for konw i cant use the project i ues the tr064tool & tr064export commands from within the made folder but the commands arent recognized what is the right way of executing the program and communicating wih a device that has an ip 192.168.1.1 and a port 1900 open and i only know the tr064 pwd with no login tnx

ehabtanta commented 9 years ago

[root@localhost tr064]# '/root/Downloads/tr064/x/src/tr064tool' Perform RootDevice discovey. ^C [root@localhost tr064]# '/root/Downloads/tr064/x/src/tr064tool' Perform RootDevice discovey. ^C

the tool wont discover the router i use vm with bridged connection the vm have no nat it gets a dhcp ip from the router 192.168.1.x and i know the path of the xml file in the router but i want to invoke the actions with the tool what to do

tnx alooot for ur replies

awidegreen commented 9 years ago

I just pushed the implementation for providing a location option to tr064tool, see bfd703e584b81f5965f1efc4b44e47655a008f02 I hope it works :smile:

use it like:

tr064tool -L http://192.168.1.1:49000/tr64desc.xml

Note that you need to have this url format!

I gonna close this issue. If you need more feature, please open a separate issue!