1

Morning,

I would like to import my own library to Veins (v4.4) project.

I followed this tutorial to compile a shared library. I've also stripped the shared library with this command:

strip --strip-unneeded libfoo.so

since I've noticed that system libraries such as sqlite3 are compiled in stripped mode.

Then I imported the library from

1.Project->Properties->Paths and Symbols :

1.1 includes

1.2 Libraries

1.3 Library Paths

2.Makemake-> Src->Options->Link-> Additional Libraries

However, the problem is that when I use the imported library I still get an error of "undefined symbol "; so I suppose the library is not correctly imported or read by the simulator.

Any suggestion?

Thanks for helping

moi
  • 13
  • 5
  • Do you get an error while compiling, while linking, or while running? – Christoph Sommer Jan 23 '17 at 08:50
  • while running: <!> Warning: opp_run: Cannot check library ../../src/veins: ../../src//libveins.so: undefined symbol: _Z3foov <!> Error during startup: Cannot load library '../../src//libveins.so': ../../src//libveins.so: undefined symbol: _Z3foov. – moi Jan 23 '17 at 09:09
  • What command line parameters are you using to run the simulation? – Christoph Sommer Jan 24 '17 at 03:32
  • @ChristophSommer I run it form the IDE, not from command line. If I run it in debug mode I get this "$1 = 0xff The target endianness is set automatically (currently little endian) [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [Inferior 1 (process 4837) exited with code 01] Quit" – moi Jan 24 '17 at 08:27

1 Answers1

0

How to load additional libraries in your simulation is documented in the user manual's chapter on running simulations.

In brief, you will need to add -l foo to the command line parameters to make the simulation load libfoo.so when it starts.

If you use the IDE to start the simulation, you can edit your simulation's run configuration: Choose menu item Run > Run Configurations..., then on the Main tab click on More >>, append the name of your library (e.g. foo if your library is called libfoo.so, or foo bar if you want your simulation to load libfoo.so and libbar.so on startup) to the Dynamic libraries text field. After launching, you will see the aforementioned command line parameter -l foo being used by the IDE to run the simulation.

If you are unsure about where to put your library, a related question has a discussion on this: <!> Error during startup: Cannot load library in OMNET++ project while using sqlite3

Community
  • 1
  • 1
Christoph Sommer
  • 6,893
  • 1
  • 17
  • 35
  • How to append the library to the veins one in the Dynamic libraries field? Beacuse I already did all the other steps in the correct way; this could be the only one which causes my simulation not to run properly. Does it need a semicolumn, coma, copying the lib in the veins project,etx? I really tried lots of stuffs, but it doesn't work, although I can use sqlite3 library without any problem. – moi Jan 25 '17 at 11:52
  • Dynamic libraries : ${opp_shared_libs:/veins/examples/veins} foo , but still getting error of "undefined symbol" . I also tried with foo inside brackets, but it doesn't work. – moi Jan 25 '17 at 13:28