Skip to content

Installation issue: dmtcp (undefined refs in mtcp_strlen) #3691

@payerle

Description

@payerle

Steps to reproduce the issue

$ spack spec -I <spec>
spack --env zen2-gcc13 spec -l dmtcp
 -   wxwl5xk  dmtcp@3.2.0 cflags='-O3 -fPIC' cxxflags='-O3 -fPIC' fflags='-O3 -fPIC'  build_system=autotools platform=linux os=rhel8 target=zen2 %c,cxx=gcc@13.4.0
[+]  c4lvqa5      ^compiler-wrapper@1.0 build_system=generic platform=linux os=rhel8 target=zen2
[e]  gw3zygo      ^gcc@13.4.0+binutils~bootstrap+graphite~mold+nvptx~piclibs~strip build_system=autotools build_type=RelWithDebInfo languages:='c,c++,fortran,lto' platform=linux os=rhel8 target=x86_64
[+]  gd56l37      ^gcc-runtime@13.4.0 build_system=generic platform=linux os=rhel8 target=zen2
[e]  3kzdcra      ^glibc@2.28 build_system=autotools platform=linux os=rhel8 target=x86_64
[+]  ymb7dyf      ^gmake@4.4.1~guile build_system=generic platform=linux os=rhel8 target=zen2 %c=gcc@13.4.0
...

Error message

Error message
==> No binary for dmtcp-3.2.0-wxwl5xkiryptmqpzyukw3qklds6n3cib found: installing from source
==> Using cached archive: /afs/shell.umd.edu/software/spack/cache/swinst26/_source-cache/archive/d6/d6954423769027ecfdcc4ff7e382d01974f64aa395a90775276f65df81117d55.tar.gz
==> No patches needed for dmtcp
==> dmtcp: Executing phase: 'autoreconf'
==> dmtcp: Executing phase: 'configure'
==> dmtcp: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    '/cvmfs/hpcsw.umd.edu/spack-software/2025.11.0/linux-zen2/gmake-4.4.1-ymb7dyfcziesq5brhndx4pxrqb2g4l25/bin/make' '-j4' 'V=1'

5 errors found in build log:
     192    /cvmfs/hpcsw.umd.edu/spack-software/2025.11.0/linux-zen2/compiler-w
            rapper-1.0-c4lvqa5ekdyxfibdcfh6hfepzpfknhp5/libexec/spack/gcc/gcc -
            I../../include -I.  -g -O2 -pthread -c -o stdlibfnc.o -DPIC -fPIC -
            fno-stack-protector -g -O0 stdlibfnc.c
     193    /cvmfs/hpcsw.umd.edu/spack-software/2025.11.0/linux-zen2/compiler-w
            rapper-1.0-c4lvqa5ekdyxfibdcfh6hfepzpfknhp5/libexec/spack/gcc/gcc -
            I../../include -I.  -g -O2 -pthread -c -o mtcp_util.o -DPIC -fPIC -
            fno-stack-protector -g -O0 mtcp_util.c
     194    /cvmfs/hpcsw.umd.edu/spack-software/2025.11.0/linux-zen2/compiler-w
            rapper-1.0-c4lvqa5ekdyxfibdcfh6hfepzpfknhp5/libexec/spack/gcc/gcc -
            I../../include -I.  -g -O2 -pthread -c -o mtcp_check_vdso.o -DPIC -
            fPIC -fno-stack-protector -g -O0 mtcp_check_vdso.c
     195    ar rcs libmtcprestart.a mtcp_restart.o stdlibfnc.o mtcp_util.o mtcp
            _check_vdso.o
     196    /cvmfs/hpcsw.umd.edu/spack-software/2025.11.0/linux-zen2/compiler-w
            rapper-1.0-c4lvqa5ekdyxfibdcfh6hfepzpfknhp5/libexec/spack/gcc/gcc -
            g -O2 -pthread  -o ../../bin/mtcp_restart -fPIC -g -O0 -nodefaultli
            bs -static  main.o libmtcprestart.a
     197    /cvmfs/hpcsw.umd.edu/binutils/2.44/rhel8-x86_64/bin/ld: libmtcprest
            art.a(mtcp_util.o): in function `mtcp_strlen':
  >> 198    /tmp/swinst26/spackswinst26/spack-stage/spack-stage-dmtcp-3.2.0-wxw
            l5xkiryptmqpzyukw3qklds6n3cib/spack-src/src/mtcp/mtcp_util.c:111:(.
            text+0x21): undefined reference to `strlen'
  >> 199    collect2: error: ld returned 1 exit status
  >> 200    make[2]: *** [Makefile:103: ../../bin/mtcp_restart] Error 1
     201    make[2]: Leaving directory '/tmp/swinst26/spackswinst26/spack-stage
            /spack-stage-dmtcp-3.2.0-wxwl5xkiryptmqpzyukw3qklds6n3cib/spack-src
            /src/mtcp'
  >> 202    make[1]: *** [Makefile:1097: all-recursive] Error 1
     203    make[1]: Leaving directory '/tmp/swinst26/spackswinst26/spack-stage
            /spack-stage-dmtcp-3.2.0-wxwl5xkiryptmqpzyukw3qklds6n3cib/spack-src
            /src'
  >> 204    make: *** [Makefile:180: dmtcp] Error 2

See build log for details:
  /tmp/swinst26/spackswinst26/spack-stage/spack-stage-dmtcp-3.2.0-wxwl5xkiryptmqpzyukw3qklds6n3cib/spack-build-out.txt

Information on your system

* **Spack:** 1.1.0
* **Builtin repo:** https://github.com/spack/spack-packages/commit/119680aeee8ea802c6111b7167583bddef97e82f
* **Python:** 3.6.8
* **Platform:** linux-rhel8-zen2

Additional information

Maintainers: @karya0

spack-build-env.txt
spack-build-out.txt

The issue appears to be with the Spack compiler wrappers and the compilation of src/mtcp/mtcp_util.c --- I am not very familiar with the innards of dmtcp, but the package is apparently trying to build a static linked executable that avoids using the standard libraries --- the whole point of the mtcp_utils.c file is to provide a bunch of copies of standard functions like strlen for use when not linking to the std libraries.

However, when compiled with the Spack compiler wrappers, the mtcp_utils.o object file picks up a reference to the std library strlen function, despite it not being explicitly used in the file. This can be seen by grepping for strlen in the attached file nm-a.mtcp_util.o.spack-build.txt (this is the output of the "nm -a mtcp_utils.o"
command on the file after running spack install)

If I instead run the same compilation command using the gcc compiler directly (instead of going through the spack wrapper), the resulting object file does not reference strlen, only the mtcp_strlen defined in the file (see the attached file nm-a.mtcp_util.o.manual-build.txt, which is the same nm -a command as above after the manual compilation using the real gcc path not the spack wrapper).

I am not familiar enough with what the compiler wrapper is doing (and I confess, I am not really experienced with static builds either), so any insights into what is happening and possible clues for fixing would be appreciated.

nm-a.mtcp_util.o.manual-build.txt
nm-a.mtcp_util.o.spack-build.txt

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have run spack maintainers <name-of-the-package> and @mentioned any maintainers
  • I have uploaded the build log and environment files
  • I have searched the issues of this repo and believe this is not a duplicate

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions