dbus-sdr: fix undefined symbols error
- When enable hybrid-sensors option, it will include sensordatahandler
in sensorcommands.cpp. So need to add some src and dependency in
meson.build.
Test:
Before:
```
ipmitool sdr elist
Err in cmd get sensor sdr info
Unable to open SDR for reading
journalctl -o json-pretty MESSAGE="ERROR opening IPMI provider"
{
"SYSLOG_IDENTIFIER" : "ipmid",
"_MACHINE_ID" : "0e6c70e7379c41fc9388fd64e1433923",
"_BOOT_ID" : "2cfdedb0cafd43758e2469ea1bc81a19",
"_PID" : "1306",
"ERROR" : "/usr/lib/ipmid-providers/libdynamiccmds.so.0.1: undefined symbol: _ZN4ipmi6sensor7sensorsE",
"MESSAGE" : "ERROR opening IPMI provider",
"_SYSTEMD_UNIT" : "phosphor-ipmi-host.service",
"_SYSTEMD_INVOCATION_ID" : "fd19f671e20147aea359bef0fc59c2c6",
"_SYSTEMD_SLICE" : "system.slice",
"_CAP_EFFECTIVE" : "1ffffffffff",
"_GID" : "0",
"_SOURCE_REALTIME_TIMESTAMP" : "1678071749865544",
"__REALTIME_TIMESTAMP" : "1678071749865607",
"_EXE" : "/usr/bin/ipmid",
"CODE_LINE" : "77",
"_COMM" : "ipmid",
"_TRANSPORT" : "journal",
"__MONOTONIC_TIMESTAMP" : "45349903",
"PRIORITY" : "3",
"CODE_FUNC" : "helper_log",
"PROVIDER" : "/usr/lib/ipmid-providers/libdynamiccmds.so.0.1",
"_HOSTNAME" : "gsz",
"CODE_FILE" : "/usr/include/phosphor-logging/log.hpp",
"__CURSOR" : "s=d8544f6ea872488fa319e44a1e5da636;i=39d;b=2cfdedb0cafd43758e2469ea1bc81a19;m=2b3fc0f;t=5f632868ef087;x=c4b27446a5eae068",
"_RUNTIME_SCOPE" : "system",
"_UID" : "0",
"TRANSACTION_ID" : "2224375320",
"_CMDLINE" : "ipmid",
"_SYSTEMD_CGROUP" : "/system.slice/phosphor-ipmi-host.service"
}
```
After:
```
ipmitool sdr elist
power | 00h | ok | 23.2 |
reset | 01h | ok | 23.1 |
CATERR | 02h | ok | 65.2 |
...
...
```
Signed-off-by: Harvey Wu <Harvey.Wu@quantatw.com>
Change-Id: I02132cd734e098f1d858628094b911a461821a80
diff --git a/dbus-sdr/meson.build b/dbus-sdr/meson.build
index b8dce8e..7cbd8cb 100644
--- a/dbus-sdr/meson.build
+++ b/dbus-sdr/meson.build
@@ -6,6 +6,22 @@
sensorutils_dep = declare_dependency(link_with: sensorutils_lib)
+hybrid_dep = []
+hybrid_src = []
+
+if not get_option('hybrid-sensors').disabled()
+ hybrid_dep = [
+ mapper,
+ ]
+
+ hybrid_src = [
+ 'sensorhandler.cpp',
+ 'sensordatahandler.cpp',
+ 'ipmisensor.cpp',
+ generated_src,
+ ]
+endif
+
dbus_sdr_pre = declare_dependency(
include_directories: root_inc,
dependencies: [
@@ -14,10 +30,12 @@
phosphor_logging_dep,
ipmid_dep,
sensorutils_dep,
+ hybrid_dep,
])
dbus_sdr_src = [
'dbus-sdr/sdrutils.cpp',
'dbus-sdr/sensorcommands.cpp',
- 'dbus-sdr/storagecommands.cpp'
+ 'dbus-sdr/storagecommands.cpp',
+ hybrid_src,
]