Re: [Gems-users] Link errors on Ruby


Date: Thu, 28 May 2009 10:31:44 +0800
From: Ricky <rv.rvicky@xxxxxxxxx>
Subject: Re: [Gems-users] Link errors on Ruby
You are correct, all malloc/free functions are overloaded by mm_* like functions.
for instance, in ruby/tester/test_framework.C line 140 there is
  char *default_param = (char *) malloc( sizeof(char) * param_len );
and the link error is
tester/test_framework.C:140: undefined reference to `mm_malloc'
 
The reason why this happened is that in simics' include dir I have a header file simics/util/alloc.h in which the malloc/free is overloaded (see following codes).

====================================
/* take over any stray use of normal malloc()s */
#if !defined(IGNORE_VTMEM)
#undef malloc
#undef calloc
#undef realloc
#undef free
#undef strdup
#define malloc(size) mm_malloc(size, 1, "char", __FILE__, __LINE__)
#define calloc(size, n) mm_zalloc((size) * (n), 1, "char", \
      __FILE__, __LINE__)
#define realloc(p, size) mm_realloc(p, size, 1, "char", __FILE__, __LINE__)
#define free(p) mm_free(p, __FILE__, __LINE__)
#define strdup(s) mm_strdup(s, __FILE__, __LINE__)
#endif /* not IGNORE_VTMEM */
=====================================
Do you have any idea about the cause of my link error?
 
BR
Ricky


 
On Thu, May 28, 2009 at 9:56 AM, Philip Garcia <pcgarcia@xxxxxxxx> wrote:
Do you know where this mm_malloc is declared?  I just greped through a fresh tarball of gems 2.1, and only found 2 mentions of it in opal, but none in ruby, or other directories it might link against.   I haven't tried using simics 3.2.x for anything myself (I'm using simics 3.0.31).  do any of the headers included with simics 3.2.49 make reference to mm_malloc?  It seems like the headers might be overloading references to malloc.   Also, what version of gcc are you using?  I personally have only used gems 2.1 with simics 3.0.x using gcc-3.4.

Phil
On May 27, 2009, at 7:15 PM, Ricky wrote:

Hi Phil,
 
The logfile of make is in the attachment at the beginning of this thread.
It seems that some functions defined in the api.h (util.h or core/processor.h ) could not be located in some *.so libfiles. I have added some lib path in to $LD_LIBRARY_PATH,
====================
/gems/gems-2.1/simics-model-builder-3.2.19/x86-linux/lib:
/gems/gems-2.1/simics-3.2.49/x86-linux/lib:
/gems/gems-2.1/simics-3.2.49/x86-linux/sys/lib:
/gems/gems-2.1/simics-3.2.49/x86-linux/bin:/lib:
/usr/dt/lib:/usr/X11R6/lib:/usr/openwin/lib:/usr/lib:/usr/ucblib:/exec/local/lib:/usr/local/lib
====================
Hope these information could help.
 
Ricky
 
 
On Thu, May 28, 2009 at 5:42 AM, Philip Garcia <pcgarcia@xxxxxxxx> wrote:
What files are giving the errors?  I remember it wasn't that hard to get GEMS to run under simics 3.x.  I know there are a handful of posts in the mailing list archives that discuss how to fix them.  Otherwise, paste what the errors are, and I can show you how I changed the files to get it to work properly (I don't know the difference between my copy of GEMS and the default offhand as I've made quite a number of other changes).

Phil

 
_______________________________________________

Gems-users mailing list
Gems-users@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/gems-users
Use Google to search the GEMS Users mailing list by adding "site:https://lists.cs.wisc.edu/archive/gems-users/" to your search.



_______________________________________________
Gems-users mailing list
Gems-users@xxxxxxxxxxx
https://lists.cs.wisc.edu/mailman/listinfo/gems-users
Use Google to search the GEMS Users mailing list by adding "site:https://lists.cs.wisc.edu/archive/gems-users/" to your search.



[← Prev in Thread] Current Thread [Next in Thread→]