<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Just remove all of added code, rebase the phosphor-hwmon source to commit </div><div>"5906173 (12 months ago) Brad Bishop: build: add support for building with meson"</div><div><br></div><div>Add the include:</div><div><span style="font-family:Menlo,Monaco,"Courier New",monospace;font-size:18px;white-space:pre;background-color:rgb(30,30,30);color:rgb(197,134,192)">#include</span><span style="font-family:Menlo,Monaco,"Courier New",monospace;font-size:18px;white-space:pre;background-color:rgb(30,30,30);color:rgb(86,156,214)"> </span><span style="font-family:Menlo,Monaco,"Courier New",monospace;font-size:18px;white-space:pre;background-color:rgb(30,30,30);color:rgb(206,145,120)"><sdbusplus/asio/connection.hpp></span><br></div><div>I can see the error </div><div><div>| /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld: phosphor_hwmon_readd-readd.<span style="background-color:rgb(255,0,0)">o</span><span style="background-color:rgb(255,0,0)">: undefined reference to symbol 'pthread_key_delete@@GLIBC_2.4'</span></div><div>| /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot-native/usr/bin/arm-openbmc-linux-gnueabi/../../libexec/arm-openbmc-linux-gnueabi/gcc/arm-openbmc-linux-gnueabi/10.1.0/ld: /openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi<span style="background-color:rgb(255,0,0)">/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0: error adding symbols: DSO missing from command line</span></div><div>| collect2: error: ld returned 1 exit status</div><div>| make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1</div><div>| make[2]: Leaving directory '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'</div><div>| make[1]: *** [Makefile:801: all-recursive] Error 1</div><div>| make[1]: Leaving directory '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/build'</div><div>| make: *** [Makefile:524: all] Error 2</div><div>| ERROR: oe_runmake failed</div><div>| WARNING: exit code 1 from a shell command.</div><div>| ERROR: Execution of '/openbmc/jade_build/tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/temp/run.do_compile.2045' failed with exit code 1:</div><div>| Makefile:800: target 'check-valgrind-recursive' given more than once in the same rule</div><div>| Makefile:800: target 'check-valgrind-memcheck-recursive' given more than once in the same rule</div><div>| Makefile:800: target 'check-valgrind-helgrind-recursive' given more than once in the same rule</div><div>| Makefile:800: target 'check-valgrind-drd-recursive' given more than once in the same rule</div><div>| Makefile:800: target 'check-valgrind-sgcheck-recursive' given more than once in the same rule</div><div>| make all-recursive</div></div><div><br></div><div>I think we should add thread lib.</div><div><br></div><div>Regards.</div><div>Thu Nguyen.</div><div dir="ltr"></div><div dir="ltr"><span style="font-family:Menlo,Monaco,"Courier New",monospace;font-size:18px;white-space:pre;background-color:rgb(30,30,30);color:rgb(206,145,120)"><br></span></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 22, 2020 at 10:51 PM Matt Spinler <<a href="mailto:mspinler@linux.ibm.com">mspinler@linux.ibm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br>
<br>
On 10/22/2020 9:49 AM, Thu Ba Nguyen wrote:<br>
> I started on supporting enable/disable host sensors. Everythings is <br>
> fine until I...<br>
> This Message Is From an External Sender<br>
> This message came from outside your organization.<br>
><br>
> I started on supporting enable/disable host sensors.<br>
> Everythings is fine until I add code to monitor host status as below.<br>
> bool MainLoop::isHostOn(void)<br>
> {<br>
> char buff[128];<br>
> if (!powerMatch)<br>
> {<br>
> log<level::ERR>("Power Match Not Created");<br>
> }<br>
> sprintf(buff, "isHostOn powerStatusOn: %d\n",powerStatusOn);<br>
> log<level::INFO>(buff);<br>
> return powerStatusOn;<br>
> }<br>
> std::shared_ptr<sdbusplus::bus::match::match><br>
> MainLoop::startHostStateMonitor(void) {<br>
> return std::make_shared<sdbusplus::bus::match::match>(<br>
> *conn,<br>
> "type='signal',interface='org.freedesktop.DBus.Properties',"<br>
> "member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",<br>
> [](sdbusplus::message::message &msg) {<br>
> std::string interfaceName;<br>
> boost::container::flat_map<std::string, std::variant<std::string>><br>
> propertiesChanged;<br>
> try {<br>
> msg.read(interfaceName, propertiesChanged);<br>
> } catch (std::exception &e) {<br>
> log<level::ERR>("Unable to read host state\n");<br>
> return;<br>
> }<br>
> // We only want to check for CurrentHostState<br>
> if (propertiesChanged.begin()->first != "CurrentHostState") {<br>
> return;<br>
> }<br>
> auto findState = propertiesChanged.find(powProperty);<br>
> if (findState != propertiesChanged.end())<br>
> {<br>
> powerStatusOn = boost::ends_with(<br>
> std::get<std::string>(findState->second), "Running");<br>
> }<br>
> powerMatch = true;<br>
> });<br>
> }<br>
> void MainLoop::read()<br>
> {<br>
> // TODO: Issue#3 - Need to make calls to the dbus sensor cache here to<br>
> // ensure the objects all exist?<br>
> /* Host changed state from On to Off */<br>
> if (!isHostOn() && (lastPowerState == HOST_ON ||<br>
> lastPowerState == HOST_NA)) {<br>
> removeHostSensors();<br>
> lastPowerState = HOST_OFF;<br>
> }<br>
> /* Host changed state from Off to On */<br>
> if (isHostOn() && lastPowerState == HOST_OFF) {<br>
> addDroppedHostSensors();<br>
> lastPowerState = HOST_ON;<br>
> }<br>
> When build openBMC I got error:<br>
> tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0: <br>
> error adding symbols: DSO missing from command line<br>
> | collect2: error: ld returned 1 exit status<br>
> | make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1<br>
><br>
> It seems I need adding the threads lib to defend lib.<br>
> Any suggestion to add threads lib to build configuration?<br>
><br>
<br>
That must be because you're using that single boost function? While you <br>
could add the dependency,<br>
the ideal thing to do since this repo already uses <br>
phosphor-dbus-interfaces is to use the function:<br>
<br>
/** @brief Convert a string to an appropriate enum value.<br>
* @param[in] s - The string to convert in the form of<br>
* "xyz.openbmc_project.State.Host.<value name>"<br>
* @return - The enum value.<br>
*/<br>
static HostState convertHostStateFromString(const std::string& s);<br>
<br>
to convert it to the actual HostState enum to check against:<br>
<br>
enum class HostState<br>
{<br>
Off,<br>
Running,<br>
Quiesced,<br>
DiagnosticMode,<br>
};<br>
<br>
This is all in xyz/openbmc_project/State/Host/server.hpp provided by <br>
phosphor-dbus-interfaces.<br>
<br>
> Thanks.<br>
> Thu.<br>
><br>
> On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen <<a href="mailto:tbnguyen1985@gmail.com" target="_blank">tbnguyen1985@gmail.com</a> <br>
> <mailto:<a href="mailto:tbnguyen1985@gmail.com" target="_blank">tbnguyen1985@gmail.com</a>>> wrote:<br>
><br>
> Hi Vijay,<br>
><br>
> I took a look on entity-manager and openbmc source.<br>
> Don't have many companies using entity-manager model to support<br>
> sensors.<br>
><br>
> Regards<br>
> Thu Nguyen.<br>
><br>
><br>
> On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka <<a href="mailto:vijaykhemka@fb.com" target="_blank">vijaykhemka@fb.com</a><br>
> <mailto:<a href="mailto:vijaykhemka@fb.com" target="_blank">vijaykhemka@fb.com</a>>> wrote:<br>
><br>
> *From: *openbmc<br>
> <openbmc-bounces+vijaykhemka=<a href="mailto:fb.com@lists.ozlabs.org" target="_blank">fb.com@lists.ozlabs.org</a><br>
> <mailto:<a href="mailto:fb.com@lists.ozlabs.org" target="_blank">fb.com@lists.ozlabs.org</a>>> on behalf of Thu Ba Nguyen<br>
> <<a href="mailto:tbnguyen1985@gmail.com" target="_blank">tbnguyen1985@gmail.com</a> <mailto:<a href="mailto:tbnguyen1985@gmail.com" target="_blank">tbnguyen1985@gmail.com</a>>><br>
> *Date: *Monday, October 19, 2020 at 11:23 AM<br>
> *To: *Ed Tanous <<a href="mailto:ed@tanous.net" target="_blank">ed@tanous.net</a> <mailto:<a href="mailto:ed@tanous.net" target="_blank">ed@tanous.net</a>>><br>
> *Cc: *OpenBMC Maillist <<a href="mailto:openbmc@lists.ozlabs.org" target="_blank">openbmc@lists.ozlabs.org</a><br>
> <mailto:<a href="mailto:openbmc@lists.ozlabs.org" target="_blank">openbmc@lists.ozlabs.org</a>>><br>
> *Subject: *Re: Enable/Disable some sensors when Host On/Off<br>
><br>
> Hi Ed Tanous,<br>
><br>
> > Thanks for your info,<br>
><br>
> > But in your platform we are using phosphor-hwmon to manage<br>
> sensors.<br>
><br>
> > We don't use entity-manager.<br>
><br>
> > As I knew we can't use both entity-manager and<br>
> phosphor-hwmon for one project.<br>
><br>
> You can use both but for different sensors. You can decide<br>
> what sensors to configure<br>
><br>
> via EM/dbus-sensors and which one for phosphor-hwmon.<br>
><br>
> Regards<br>
><br>
> Thu Nguyen.<br>
><br>
<br>
</blockquote></div>