LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-25-2007, 11:23 AM   #1
madkris
LQ Newbie
 
Registered: Sep 2007
Posts: 4

Rep: Reputation: 0
undefined reference to `rpl_malloc'


hi,
i am trying to install the libnss_pgsql module following carefully the steps from a guide i found on the net. I was on the compilation part and did the following:
1)./configure --with-gnu-ld
2)make
3)ld src/.libs/libnss_pgsql.so
ld: warning: cannot find entry symbol _start; not setting start address
src/.libs/libnss_pgsql.so: undefined reference to `rpl_malloc'
src/.libs/libnss_pgsql.so: undefined reference to `rpl_realloc'

it is said that there should be no more warning/error than the first line for the module to work, i tried google unfortunately i have yet to find a solution. i am fairly new to linux so please bear with me

Regards,
kris
 
Old 09-25-2007, 12:33 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 76
This is just autotools stupidness, which will produce the results you describe on some non-glibc systems (e.g., uClibc). If you give us some specifics (e.g., platform, c library, whether you are cross-compiling, what tutorial you are following, where you got your source, etc.), we might better help you.

If you try something like this
Code:
$ ac_cv_func_malloc_0_nonnull=yes ./configure --with-gnu-ld
$ make
$ ld src/.libs/libnss_pgsql.so
you should correctly compile, but the module may experience a bug where it assumes a valid pointer (to who knows where) on the call malloc(0).

If such a bug exists, the it is the software developersí fault for writing such non-portable code. In order to remedy the situation, just add something like this to a source file you expect will be linked:
Code:
#if HAVE_CONFIG_H
# include <config.h>
#endif
#undef malloc
     
#include <sys/types.h>

void *malloc ();

/* Allocate an N-byte block of memory from the heap.
   If N is zero, allocate a 1-byte block.  */
    
void* rpl_malloc (size_t n)
{
  if (n == 0)
    n = 1;
  return malloc (n);
}
Note that when you use this bugfix, donít tell configure you have a nonnull malloc(0) implementation. So just do what you did before, with the added edit:
Code:
$ vi file/to/edit.c
$ ./configure --with-gnu-ld
$ make
$ ld src/.libs/libnss_pgsql.so
 
Old 10-01-2007, 09:58 AM   #3
madkris
LQ Newbie
 
Registered: Sep 2007
Posts: 4

Original Poster
Rep: Reputation: 0
-fedora core 6
-postgresql 7.2.4(source)
-modules found here
-tutorial found here


probably cross-compiling if im not mistaken since i read on the modules homepage "Operating System: BSD, Linux"

i tried both your suggestions this time only rpl_realloc came out
Code:
ld: warning: cannot find entry symbol _start; not setting start address
src/.libs/libnss_pgsql.so: undefined reference to `rpl_realloc'
i have checked the queries for my conf files and they work fine when i tested them on the database.

Last edited by madkris; 10-02-2007 at 08:56 AM.
 
Old 10-02-2007, 09:03 AM   #4
madkris
LQ Newbie
 
Registered: Sep 2007
Posts: 4

Original Poster
Rep: Reputation: 0
a few other referrences for the tutorial i was following
- postgres archieve link 1
- postgres archieve link 2
- portuguese tutorial link

note: i dont speak portuguese
 
Old 10-02-2007, 10:48 AM   #5
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 76
Quote:
Originally Posted by madkris View Post
-fedora core 6
-postgresql 7.2.4(source)
-modules found here
-tutorial found here
Ok. So you are on a GNU libc system compiling for use on the same system? And itís still giving you problems! This is very strange.

Quote:
Originally Posted by madkris View Post
probably cross-compiling if im not mistaken since i read on the modules homepage "Operating System: BSD, Linux"
From the tutorial it does not look like youíre cross-compiling. Cross-compiling means to compile on one system (host) with the intent to use on a different system (target).
Quote:
Originally Posted by madkris View Post
i tried both your suggestions this time only rpl_realloc came out
Code:
ld: warning: cannot find entry symbol _start; not setting start address
src/.libs/libnss_pgsql.so: undefined reference to `rpl_realloc'
This is because I must have overlooked the second error message in your original post . In any case, if you are relatively confident that this will be used on a glibc system (so you donít have to worry about the bugs), just issue this command for configuration:
Code:
$ ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes ./configure --with-gnu-ld
 
Old 10-02-2007, 02:22 PM   #6
madkris
LQ Newbie
 
Registered: Sep 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by osor View Post
Ok. So you are on a GNU libc system compiling for use on the same system? And it’s still giving you problems! This is very strange.
yes, im compiling for the use of the same system.
i was browsing thru the project mailing list found here
it says that the project i am trying to configure has not released a module for a 64-bit architecture but someone says he has successfully setup up works fine (the box im using is also 64-bit)

Quote:
Originally Posted by osor View Post
This is because I must have overlooked the second error message in your original post . In any case, if you are relatively confident that this will be used on a glibc system (so you don’t have to worry about the bugs), just issue this command for configuration:
Code:
$ ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes ./configure --with-gnu-ld
it worked! unfortunately i am again back at where i started which is nowhere.. i followed all the steps read and read again.. i just cant seem to make it work.. not sure where i made a mistake.. in the installation or the configuration(queries worked fine)

ive been trying to setup my box for user authentication via a postgres database for a month now with following the steps to install the module here and configuration instructions from the portuguese tutorial and also reading the documentation which came with the module. Of course i have to make the libnss module work first before i can proceed with the second-half of the tutorial.

frankly id really be thankful if someone can help me debug or just be the one laughing while pointing at my stupid mistake

Last edited by madkris; 10-02-2007 at 04:24 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined reference, why? george_mercury Programming 4 05-07-2009 12:15 AM
Undefined reference to: ashlesha Programming 5 11-08-2006 01:07 PM
undefined reference? Sharky01252 Programming 3 11-07-2006 11:36 AM
Undefined Reference ChemicalBurn Programming 2 02-14-2005 03:01 AM
undefined reference mp4-10 Programming 3 01-25-2005 12:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration