tkn-tub / ns3-gym

ns3-gym - The Playground for Reinforcement Learning in Networking Research
GNU General Public License v2.0
514 stars 196 forks source link

protobuf messages are not generated during build configuration #73

Closed prototact closed 10 months ago

prototact commented 1 year ago

I used the latest branch for ns-3.36.1. During the configuration step there is nothing mentioned of messages being generated. The build command fails since it depends on them. I have installed the zmq and protobuf related libraries, following the instructions in the README file.

rukyr97 commented 1 year ago

I am having the same problem.

a-andre commented 1 year ago

Could you test if #74 fixes the issue?

pgawlowicz commented 1 year ago

Hi @a-andre and @rukyr97,

could I ask you to test a fresh installation of the app-ns-3.36+??

Thank you!

a-andre commented 1 year ago

Fresh installation builds without issues. (CMake 3.26, Protobuf 21.12)

pgawlowicz commented 1 year ago

nice, thank you @a-andre !

Shadab442 commented 1 year ago

In my case fresh installation of ns-3.36.1/ns-3.37 does not work, I am using CMake 3.26 and Protobuf 3.20.3.

In ns-3.36.1 I get the following error when I configure the build:

CMake Error at /usr/share/cmake-3.26/Modules/FindProtobuf.cmake:493 (file): file STRINGS file "/usr/include/google/protobuf/stubs/common.h" cannot be read. Call Stack (most recent call first): contrib/ns3-gym/CMakeLists.txt:13 (find_package)

CMake Error at /usr/share/cmake-3.26/Modules/FindProtobuf.cmake:499 (math): math cannot parse the expression: " / 1000000": syntax error, unexpected exp_DIVIDE (2). Call Stack (most recent call first): contrib/ns3-gym/CMakeLists.txt:13 (find_package)

CMake Error at /usr/share/cmake-3.26/Modules/FindProtobuf.cmake:500 (math): math cannot parse the expression: " / 1000 % 1000": syntax error, unexpected exp_DIVIDE (2). Call Stack (most recent call first): contrib/ns3-gym/CMakeLists.txt:13 (find_package)

CMake Error at /usr/share/cmake-3.26/Modules/FindProtobuf.cmake:501 (math): math cannot parse the expression: " % 1000": syntax error, unexpected exp_MOD (2). Call Stack (most recent call first): contrib/ns3-gym/CMakeLists.txt:13 (find_package)

CMake Warning at build-support/3rd-party/colored-messages.cmake:81 (_message): Protobuf compiler version 3.20.3; doesn't match library version ERROR.ERROR.ERROR Call Stack (most recent call first): /usr/share/cmake-3.26/Modules/FindProtobuf.cmake:524 (message) contrib/ns3-gym/CMakeLists.txt:13 (find_package)

CMake Error at build-support/custom-modules/ns3-module-macros.cmake:88 (add_library): add_library ALIAS requires exactly one target argument. Call Stack (most recent call first): contrib/ns3-gym/CMakeLists.txt:40 (build_lib)

-- protobuf_generate command not found -> use a local copy from /home/blackjack/ns3-fresh/ns-3-allinone/ns-3.36.1/contrib/ns3-gym/protobuf-generate.cmake CMake Error at build-support/3rd-party/colored-messages.cmake:78 (_message): Error: protobuf_generate called without any targets or source files Call Stack (most recent call first): contrib/ns3-gym/protobuf-generate.cmake:14 (message) contrib/ns3-gym/CMakeLists.txt:62 (protobuf_generate)

CMake Error at build-support/3rd-party/colored-messages.cmake:78 (_message): Error: protobuf_generate called without any targets or source files Call Stack (most recent call first): contrib/ns3-gym/protobuf-generate.cmake:14 (message) contrib/ns3-gym/CMakeLists.txt:69 (protobuf_generate)

In ns-3.37 I get this:

CMake Error at build-support/custom-modules/ns3-module-macros.cmake:76 (target_precompile_headers): Cannot specify precompile headers for target "REUSE_FROM" which is not built by this project. Call Stack (most recent call first): contrib/ns3-gym/CMakeLists.txt:40 (build_lib)

CMake Error at build-support/custom-modules/ns3-module-macros.cmake:94 (add_library): add_library ALIAS requires exactly one target argument. Call Stack (most recent call first): contrib/ns3-gym/CMakeLists.txt:40 (build_lib)

-- Looking for protobuf_generate -- Looking for protobuf_generate - not found -- protobuf_generate command not found -> use a local copy from /home/blackjack/ns3-fresh/ns-3-allinone/ns-3.37/contrib/ns3-gym/protobuf-generate.cmake CMake Error at build-support/3rd-party/colored-messages.cmake:78 (_message): Error: protobuf_generate called without any targets or source files Call Stack (most recent call first): contrib/ns3-gym/protobuf-generate.cmake:14 (message) contrib/ns3-gym/CMakeLists.txt:62 (protobuf_generate)

CMake Error at build-support/3rd-party/colored-messages.cmake:78 (_message): Error: protobuf_generate called without any targets or source files Call Stack (most recent call first): contrib/ns3-gym/protobuf-generate.cmake:14 (message) contrib/ns3-gym/CMakeLists.txt:69 (protobuf_generate)

Any suggestions?

a-andre commented 1 year ago

CMake Error at /usr/share/cmake-3.26/Modules/FindProtobuf.cmake:493 (file): file STRINGS file "/usr/include/google/protobuf/stubs/common.h" cannot be read.

If you are on ubuntu, it seems you haven't installed libprotobuf-dev.

Shadab442 commented 1 year ago

After installing libprotobuf-dev I get the following errors:

CMake Error at scratch/CMakeLists.txt:54 (target_link_libraries): Target "scratch_scratch-simulator" links to:

protobuf::libprotobuf

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

Call Stack (most recent call first): scratch/CMakeLists.txt:67 (create_scratch)

CMake Error at scratch/CMakeLists.txt:54 (target_link_libraries): Target "scratch_subdir_scratch-simulator-subdir" links to:

protobuf::libprotobuf

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

Call Stack (most recent call first): scratch/CMakeLists.txt:97 (create_scratch)

Any insights?

a-andre commented 1 year ago

At first, please use code blocks.

I looks like you changed something in the scratch directory. If so, please let us know what you have changed.

Does everything build without issues if you remove the opengym directory from contrib/?

You might want to try ns-3.38 (or 3.39, which should be released within the next days).

Shadab442 commented 1 year ago

Sorry, next time I will use code blocks. Also, I have not changed anything in the Scratch directory. Also, everything builds without issues if I remove opengym. I will try with ns-3.38.

Shadab442 commented 1 year ago

With ns-3.38, I did not get any configuration or build error. Thanks for the help.

Shadab442 commented 1 year ago

After a fresh reinstallation, in ns-3.37, it is also working now. In ns-3.36.1, it gives the same error. Thank you for all your help.

xxxxxy211 commented 11 months ago

same question on ns3 3.36.1 for me. my sys is ubuntu20.and i changed ns3 to3.38 its ok.