LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   error for undefined rpl_malloc compiling scalpel (https://www.linuxquestions.org/questions/slackware-14/error-for-undefined-rpl_malloc-compiling-scalpel-4175598165/)

GrumpyGnome 01-24-2017 04:13 PM

error for undefined rpl_malloc compiling scalpel
 
Hello,
I am building scalpel 2.0 on Slackware 14.2 and after successful ./configure the make fails with multiple errors:

Code:

./.libs/libscalpel.a(syncqueue.o): In function `syncqueue_init(char const*, unsigned long)':
/usr/local/docs/recov-ware/scalpel-2.0/src/syncqueue.cpp:84: undefined reference to `rpl_malloc'
/usr/local/docs/recov-ware/scalpel-2.0/src/syncqueue.cpp:86: undefined reference to `rpl_malloc'
/usr/local/docs/recov-ware/scalpel-2.0/src/syncqueue.cpp:88: undefined reference to `rpl_malloc'
./.libs/libscalpel.a(prioque.o): In function `nolock_add_to_queue(Queue*, void*, int)':
/usr/local/docs/recov-ware/scalpel-2.0/src/prioque.cpp:152: undefined reference to `rpl_malloc'
/usr/local/docs/recov-ware/scalpel-2.0/src/prioque.cpp:158: undefined reference to `rpl_malloc'
./.libs/libscalpel.a(prioque.o):/usr/local/docs/recov-ware/scalpel-2.0/src/prioque.cpp:482: more undefined references to `rpl_malloc' follow

I have not found much on rpl_malloc. I read that this could be caused by an automake tool or cross compiling problem. I am not cross compiling. In the configure.ac I commented out the test for AC_FUNC_MALLOC. This did not help. My error reads like a missing function definition to me rather than a makefile error.
Do I need to add a lib to my 14.2 install or ...?

Happy Trails

55020 01-24-2017 04:43 PM

Any reason why you're not using the SlackBuild?
https://slackbuilds.org/repository/14.2/system/scalpel/

It requires something called tre
https://slackbuilds.org/repository/14.2/libraries/tre/

Edit: Do you have multilib installed? If you didn't have a full Slackware installation, you would tell us, right?

phenixia2003 01-25-2017 07:42 AM

Hello,

Quote:

Originally Posted by GrumpyGnome (Post 5659675)
Hello,
I am building scalpel 2.0 on Slackware 14.2 and after successful ./configure the make fails with multiple errors:

Code:

./.libs/libscalpel.a(syncqueue.o): In function `syncqueue_init(char const*, unsigned long)':
/usr/local/docs/recov-ware/scalpel-2.0/src/syncqueue.cpp:84: undefined reference to `rpl_malloc'
/usr/local/docs/recov-ware/scalpel-2.0/src/syncqueue.cpp:86: undefined reference to `rpl_malloc'
/usr/local/docs/recov-ware/scalpel-2.0/src/syncqueue.cpp:88: undefined reference to `rpl_malloc'
./.libs/libscalpel.a(prioque.o): In function `nolock_add_to_queue(Queue*, void*, int)':
/usr/local/docs/recov-ware/scalpel-2.0/src/prioque.cpp:152: undefined reference to `rpl_malloc'
/usr/local/docs/recov-ware/scalpel-2.0/src/prioque.cpp:158: undefined reference to `rpl_malloc'
./.libs/libscalpel.a(prioque.o):/usr/local/docs/recov-ware/scalpel-2.0/src/prioque.cpp:482: more undefined references to `rpl_malloc' follow

I have not found much on rpl_malloc. I read that this could be caused by an automake tool or cross compiling problem. I am not cross compiling. In the configure.ac I commented out the test for AC_FUNC_MALLOC. This did not help. My error reads like a missing function definition to me rather than a makefile error.
Do I need to add a lib to my 14.2 install or ...?

Happy Trails

A possible cause of this issue is when you have a library in a non standard directory.

In fact, I guess, that you have build tre with ./configure && make && make install, which leads libtre.* libraries to be installed in /usr/local/lib instead of /usr/lib{64} :

Code:

$ cd tre-0.8.0/
$ ./configure && make && make install
...
Libraries have been installed in:
  /usr/local/lib

$ cd ../scalpel-git
$ ./bootstrap && ./configure && make
...
./.libs/libscalpel.a(dig.o):/home/seb/scalpel-git/scalpel/src/dig.cpp:2692: more undefined references to `rpl_malloc' follow

When tre is configured with --prefix=/usr and --libdir=/usr/lib64 (or /usr/lib on slackware 32-bit), scalpel build fine :

Code:

$ cd tre-0.8.0/
$ ./configure --prefix=/usr --libdir=/usr/lib64 && make && make install
...
Libraries have been installed in:
  /usr/lib64

...
$ cd ../scalpel-git
$ make clean
$ ./bootstrap && ./configure && make
...
cc/x86_64-slackware-linux/5.3.0/../../../../lib64/libtre.so /usr/lib64/../lib64/libstdc++.so /usr/lib64/libtre.so -lpthread -lm -Wl,-rpath -Wl,/usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../lib64 -Wl,-rpath -Wl,/usr/lib64/../lib64 -Wl,-rpath -Wl,/usr/lib64/gcc/x86_64-slackware-linux/5.3.0/../../../../lib64 -Wl,-rpath -Wl,/usr/lib64/../lib64
make[1]: Leaving directory '/home/seb/TEST/scalpel.git'

Anyway, the easiest way to fix your issue is to use the tre and scalpel slackbuilds from slackbuilds.org as 55020 has suggested that earlier.

--
SeB

GrumpyGnome 01-25-2017 12:58 PM

Thank you both, the reason I didn't go to slackbuild is ignorance. I let slackware64-14.2-install-dvd.iso do a default install and did install tre using the defaults. I don't know Slackware very well; I'm helping a friend who uses Slackware recover some files. I had tried a search for scalpel and Slackware but missed slackbuild. Thanks for the details on the tre lib. I'll press on to slackbuild but also will study the config and make files I used to understand what went wrong.

A part of me wants to do this the hard way but I have not had time in the last 10 years to keep up with Linux. I am a Unix and Linux user from many decades ago as in when we had to write our own serial port drivers for printers and then rebuild the OS to install them.
Thank you for that help it is much appreciated.

Happy Trails from a shiny head with a fuzzy brain

phenixia2003 01-25-2017 01:51 PM

Hello,

Quote:

Originally Posted by GrumpyGnome (Post 5660085)
Thanks for the details on the tre lib. I'll press on to slackbuild but also will study the config and make files I used to understand what went wrong.

When configure checks for gnu libc compatible malloc, it writes a small program, called conftest.c, and builds it by running :
Code:

$ gcc -o conftest -g -O2  conftest.c -ltre -lpthread -lm  >&5
When the build fails, the variable ac_cv_func_malloc_0_nonnull is set to no, and thus, the option -Dmalloc=rpl_malloc is added to the scalpel compiler options. This is what happens when tre is not in any of the standard system directories. Snippet of config.log in this case :

Code:

...
configure:16673: checking for GNU libc compatible malloc
configure:16697: gcc -o conftest -g -O2  conftest.c -ltre -lpthread -lm  >&5
configure:16697: $? = 0
configure:16697: ./conftest
./conftest: error while loading shared libraries: libtre.so.5: cannot open shared object file: No such file or directory
configure:16697: $? = 127
configure: program exited with status 127

...
ac_cv_func_malloc_0_nonnull=no
...

DEFS='-DPACKAGE_NAME=\"scalpel\" -DPACKAGE_TARNAME=\"scalpel\"
-DPACKAGE_VERSION=\"2.0\" -DPACKAGE_STRING=\"scalpel\ 2.0\"
-DPACKAGE_BUGREPORT=\"scalpel@digdeeply.com\" -DPACKAGE_URL=\"\"
-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1
-DLT_OBJDIR=\".libs/\" -DPACKAGE=\"scalpel\" -DVERSION=\"2.0\"
-DHAVE_LIBM=1 -DHAVE_LIBPTHREAD=1 -DHAVE_LIBTRE=1 -DHAVE_FCNTL_H=1
-DHAVE_LIMITS_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_MOUNT_H=1 -DHAVE_SYS_PARAM_H=1
-DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMEB_H=1 -DHAVE_UNISTD_H=1
-DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DHAVE_FSEEKO=1 -DHAVE_STDLIB_H=1
-DHAVE_MALLOC=0 -Dmalloc=rpl_malloc -DHAVE_STDLIB_H=1
-DHAVE_REALLOC=0 -Drealloc=rpl_realloc -DHAVE_BZERO=1
-DHAVE_GETTIMEOFDAY=1 -DHAVE_MKDIR=1 -DHAVE_REALPATH=1 -DHAVE_REGCOMP=1
-DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRERROR=1 -DHAVE_STRNCASECMP=1
-DHAVE_STRTOUL=1 -DHAVE_STRTOULL=1'

--
SeB


All times are GMT -5. The time now is 03:06 AM.