Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to `mem_fail_event_trigger_setup' when just enabling some features #170

Open
tai271828 opened this issue Jul 25, 2024 · 1 comment

Comments

@tai271828
Copy link

Description

When compiling the source, we will get the error of ras-events.c:309: undefined reference to mem_fail_event_trigger_setup'`.

Build environment:

  • Ubuntu 22.04.4
  • x86
  • Ubuntu Linux_ kernel 6.8.0-38-generic

Steps to Reproduce

  1. Clone the master branch with git clone https://github.com/mchehab/rasdaemon.git. At the time of writing, the corresponding commit is 6250251dd35c88c299ad24789084b53ce707202f.
  2. autoreconf -vfi
  3. ./configure --enable-mce --enable-aer --enable-sqlite3 --enable-extlog --enable-abrt-report
  4. make

Expected Result

Compiled successfully.

Actual Result

The corresponding configuration options:

$ ./configure --enable-mce --enable-aer --enable-sqlite3 --enable-extlog --enable-abrt-report

<Skipped Output Here for Bug Reporting>

compile time options summary                                                                                         
============================                                                                                         
                                                                                                                     
    Sqlite3             : yes                                                                                        
    AER                 : yes                                                                                        
    MCE                 : yes                                                                                        
    EXTLOG              : yes                                                                                        
    CPER non-standard   : no                                                                                         
    ABRT report         : yes                                                                                        
    HISI Kunpeng errors : no                                                                                         
    ARM events          : no                                                                                             DEVLINK             : no                                                                                         
    Disk I/O errors     : no                                                                                         
    Memory Failure      : no                                                                                         
    CXL events          : no                                                                                         
    Memory CE PFA       : no                                                                                         
    AMP RAS errors      : no                                                                                         
    CPU fault isolation : no                                                                                         
    YITIAN RAS errors   : no                                                                                             JAGUAR RAS errors   : no

The error message:

$ make
make  all-recursive
make[1]: Entering directory '/home/ubuntu/workspace-rasdaemon-deb/rasdaemon'
Making all in util
make[2]: Entering directory '/home/ubuntu/workspace-rasdaemon-deb/rasdaemon/util'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ubuntu/workspace-rasdaemon-deb/rasdaemon/util'
Making all in man
make[2]: Entering directory '/home/ubuntu/workspace-rasdaemon-deb/rasdaemon/man'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ubuntu/workspace-rasdaemon-deb/rasdaemon/man'
make[2]: Entering directory '/home/ubuntu/workspace-rasdaemon-deb/rasdaemon'
  CC       rasdaemon-rasdaemon.o
  CC       rasdaemon-ras-events.o
ras-events.c:301:12: warning: ‘filter_ras_mc_event’ defined but not used [-Wunused-function]
  301 | static int filter_ras_mc_event(struct ras_events *ras, char *group, char *event,
      |            ^~~~~~~~~~~~~~~~~~~
  CC       rasdaemon-ras-mc-handler.o
  CC       rasdaemon-bitfield.o
  CC       rasdaemon-trigger.o
  CC       rasdaemon-ras-record.o
  CC       rasdaemon-ras-aer-handler.o
  CC       rasdaemon-ras-mce-handler.o
  CC       rasdaemon-mce-intel.o
  CC       rasdaemon-mce-amd.o
  CC       rasdaemon-mce-intel-p4-p6.o
  CC       rasdaemon-mce-intel-nehalem.o
  CC       rasdaemon-mce-intel-dunnington.o
  CC       rasdaemon-mce-intel-tulsa.o
  CC       rasdaemon-mce-intel-sb.o
  CC       rasdaemon-mce-intel-ivb.o
  CC       rasdaemon-mce-intel-haswell.o
  CC       rasdaemon-mce-intel-knl.o
  CC       rasdaemon-mce-intel-broadwell-de.o
  CC       rasdaemon-mce-intel-broadwell-epex.o
  CC       rasdaemon-mce-intel-skylake-xeon.o
  CC       rasdaemon-mce-amd-k8.o
  CC       rasdaemon-mce-amd-smca.o
  CC       rasdaemon-mce-intel-i10nm.o
  CC       rasdaemon-ras-extlog-handler.o
  CC       rasdaemon-ras-report.o
  CCLD     rasdaemon
/usr/bin/ld: rasdaemon-ras-events.o: in function `setup_event_trigger':
/home/ubuntu/workspace-rasdaemon-deb/rasdaemon/ras-events.c:292: undefined reference to `mem_fail_event_trigger_setup'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:706: rasdaemon] Error 1
make[2]: Leaving directory '/home/ubuntu/workspace-rasdaemon-deb/rasdaemon'
make[1]: *** [Makefile:1394: all-recursive] Error 1
make[1]: Leaving directory '/home/ubuntu/workspace-rasdaemon-deb/rasdaemon'
make: *** [Makefile:600: all] Error 2

Additional Information

  • Even if you check out to v0.8.1, you can still reproduce this issue.
  • You won't reproduce this issue with v0.8.0 source.
tai271828 added a commit to tai271828/rasdaemon-deb that referenced this issue Aug 4, 2024
Enable all features by default rather than partially in the past.

There is no reason that we only enable some features instead of all of
them.

Besides, since v0.8.1, we found the previous configuration options would
raise compilation error. By enabling all features, we can have
successful compilation. Please refer to the upstream bug report for more
details: mchehab/rasdaemon#170
@t-msn
Copy link
Contributor

t-msn commented Aug 9, 2024

Hi,
I think this simply comes from lacking of ifdef.

diff --git a/ras-events.c b/ras-events.c
index b6e80b2..c60e976 100644
--- a/ras-events.c
+++ b/ras-events.c
@@ -55,7 +55,9 @@ char *choices_disable;

 static const struct event_trigger event_triggers[] = {
        { "mc_event", &mc_event_trigger_setup },
+#ifdef HAVE_MEMORY_FAILURE
        { "memory_failure_event", &mem_fail_event_trigger_setup },
+#endif
 };

 static int get_debugfs_dir(char *tracing_dir, size_t len)

If necessary, I would make PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants