Path problems when building a ROS project


#1

Hello-I’m on Ubuntu 18.04 and I have a ROS project that builds and runs as expected. However, when I try to create a snap, I get the following build errors.

First, it can not seem to find any header files that would be below /usr/include. For example I get

file.c: fatal error: net-snmp/net-snmp-config.h: No such file or directory
** #include <net-snmp/net-snmp-config.h>**
** ^~~~~~~~~~~~~~~~~~~~~~~~~~~~**

If I look in /root/parts/workspace/install/usr/include, I do not see the net-snmp subdirectory of course and it seems to be a small subset of what is in /usr/include.

Second, if I just try and link an app that uses libsnmp, I get linker error:

/root/parts/workspace/install/usr/bin/ld: cannot find -lsnmp

Any insight on how to fix this would be appreciated. Not sure it’s needed, but my yaml is below. The errors occur when building package2.

name: my-code
base: core18
version: '1.2'
summary:  Software
description: |
  The Software

grade: devel
confinement: devmode

parts:
  workspace:
    plugin: catkin
    source: .
    source-space: src
    source-type: local
    catkin-packages: [package1, package2] 

apps:
  roscore:
    command: roscore
    plugs: [network, network-bind]

#2

I know very little about ROS/catkin, but I assume SNMP dev libraries are outside the scope of catkin packages? If so, you might try a build-packages section under workspace that contains all the apt packages required to do a build of stuff that is not a part of catkin:

E.g.

parts:
  workspace:
  ...
  build-packages:
    - libsnmp-dev
    ...

Similarly, for runtime, you might need:

  stage-packages:
    - libsnmp

Again, I’m not sure how much catkin covers, but it might be worth a try.