undefined reference to scalable_aligned_malloc, scalable_aligned_realloc, and scalable_aligned_free?

Hi -

I'm trying to compile LAMMPS using Makefile_intel_cpu_mpich and have run in to an error with the linker:

memory.o: In function `LAMMPS_NS::Memory::smalloc(long, char const*)':
/root/lammps-31Mar17/src/Obj_intel_cpu_mpich/../memory.cpp:51: undefined reference to `scalable_aligned_malloc'
memory.o: In function `LAMMPS_NS::Memory::srealloc(void*, long, char const*)':
/root/lammps-31Mar17/src/Obj_intel_cpu_mpich/../memory.cpp:81: undefined reference to `scalable_aligned_realloc'
memory.o: In function `LAMMPS_NS::Memory::sfree(void*)':
/root/lammps-31Mar17/src/Obj_intel_cpu_mpich/../memory.cpp:111: undefined reference to `scalable_aligned_free'
/root/lammps-31Mar17/src/Obj_intel_cpu_mpich/../memory.cpp:111: undefined reference to `scalable_aligned_free'
make[1]: *** [../lmp_intel_cpu_mpich] Error 1
make[1]: Leaving directory `/root/lammps-31Mar17/src/Obj_intel_cpu_mpich'
make: *** [intel_cpu_mpich] Error 2

Some details. This is a cluster environment with modules, so I loaded both the intel and mpich modules before initiating `make intel_cpu_mpich`:

[[email protected]... src]# module list

Currently Loaded Modules:
   1) intel/17.0.1.132 2) mpich/3.2

I did make a minor edit to the Makefile. On an earlier run I got hundreds of warning messages about -no-offload being deprecated and that I should use -qno-offload instead, so I changed this in the CCFLAGS entry in the Makefile:

Hi -

I'm trying to compile LAMMPS using Makefile_intel_cpu_mpich and have run
in to an error with the linker:

memory.o: In function `LAMMPS_NS::Memory::smalloc(long, char const*)':
/root/lammps-31Mar17/src/Obj_intel_cpu_mpich/../memory.cpp:51: undefined
reference to `scalable_aligned_malloc'
memory.o: In function `LAMMPS_NS::Memory::srealloc(void*, long, char
const*)':
/root/lammps-31Mar17/src/Obj_intel_cpu_mpich/../memory.cpp:81: undefined
reference to `scalable_aligned_realloc'
memory.o: In function `LAMMPS_NS::Memory::sfree(void*)':
/root/lammps-31Mar17/src/Obj_intel_cpu_mpich/../memory.cpp:111: undefined
reference to `scalable_aligned_free'
/root/lammps-31Mar17/src/Obj_intel_cpu_mpich/../memory.cpp:111: undefined
reference to `scalable_aligned_free'
make[1]: *** [../lmp_intel_cpu_mpich] Error 1
make[1]: Leaving directory `/root/lammps-31Mar17/src/Obj_intel_cpu_mpich'
make: *** [intel_cpu_mpich] Error 2

Some details. This is a cluster environment with modules, so I loaded
both the intel and mpich modules before initiating `make intel_cpu_mpich`:

[[email protected]... src]# module list

Currently Loaded Modules:
  1) intel/17.0.1.132 2) mpich/3.2

​you are compiling without need as root. this is a very, very, VERY bad
idea. there is no need for it, and any typo, misconfiguration, or bug in a
script that is called during setup or compilation can result in a complete
disaster and ruin the entire setup (e.g. by rm -rf /${SOME_VARIABLE}
becoming: rm -rf /) and many other, similar problems. best practice is to
create an "install" users and make that use owner of the directory tree
where you install your environment modules.

I did make a minor edit to the Makefile. On an earlier run I got hundreds
of warning messages about -no-offload being deprecated and that I should
use -qno-offload instead, so I changed this in the CCFLAGS entry in the
Makefile:

-
CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload \
                -fno-alias -ansi-alias -restrict \(OPTFLAGS\) \+ CCFLAGS = \-g \-qopenmp \-DLAMMPS\_MEMALIGN=64 \-qno\-offload \\                 \-fno\-alias \-ansi\-alias \-restrict (OPTFLAGS)

Also, the users requested quite a number of add on packages, although I
don't think this is related to this issue.

Looking at memory.cpp, it looks like the problem comes from some
improperly defined identifiers?

#if defined(LMP_USER_INTEL) && defined(__INTEL_COMPILER)
#ifndef LMP_INTEL_NO_TBB
#define LMP_USE_TBB_ALLOCATOR
#include "tbb/scalable_allocator.h"
#else
#include <malloc.h>
#endif
#endif

​try linking with -ltbbmalloc_proxy​

if that fails, look up the proper linker flags for linking with the thread
optimized malloc bundled with your TBB library.

axel.