Thread

  1. Undefined symbol

    Boulat Khakimov <boulat@inet-interactif.com> — 2001-03-06T23:44:31Z

    Hi,
    
    Im writing a function in C (encode) for PG that uses blowfish encryption
    here is how I compile it.
    
    gcc -I/usr/src/postgresql-7.0.3/src/include
    -I/usr/src/postgresql-7.0.3/src/backend  -O2 -Wall -Wmissing-prototypes
    -Wmissing-declarations -lcrypt
    -I/usr/src/postgresql-7.0.3/src/interfaces/libpq
    -I/usr/src/postgresql-7.0.3/src/include -fpic  
    -I/home/boulat/Funio.com/database/libblowfish.a -c -o encode.o
    encode.c   
    
    it compiles nicely with 0 error or warnings, 
    
    then i do
    gcc -shared -o encode.so  encode.o
    rm encode.o 
    
    so now im left we a ready to go encode.so , So now I add that function
    to DB
    
    testdb=# CREATE FUNCTION encode(text,text)
    testdb-# RETURNS text
    testdb-# AS '/home/boulat/Funio.com/database/encode.so'
    testdb-# LANGUAGE 'C';
    CREATE
    
    no problems there either, BUT ...
    
    testdb=# select encode('bob','bob');
    ERROR:  Load of file /home/boulat/Funio.com/database/encode.so failed:
    /home/boulat/Funio.com/database/encode.so: undefined symbol:
    BF_cfb64_encrypt
    
    thats the function that I call from inside my c code...
    but Why??? It compiled with no errors or warning, and I have all the
    right includes in my source code.
    
    Im confused!
    
    Any help would be appreciated.
    
    Regards,
    Boulat Khakimov
    
    -- 
    Nothing Like the Sun
    
    
  2. Re: [SQL] Undefined symbol

    Mathijs Brands <mathijs@ilse.nl> — 2001-03-07T00:47:23Z

    On Tue, Mar 06, 2001 at 06:44:31PM -0500, Boulat Khakimov allegedly wrote:
    > testdb=# select encode('bob','bob');
    > ERROR:  Load of file /home/boulat/Funio.com/database/encode.so failed:
    > /home/boulat/Funio.com/database/encode.so: undefined symbol:
    > BF_cfb64_encrypt
    > 
    > thats the function that I call from inside my c code...
    > but Why??? It compiled with no errors or warning, and I have all the
    > right includes in my source code.
    > 
    > Im confused!
    
    Are you linking against a blowfish library? If so, either include the
    encryption functions in your shared object, or load that shared object
    yourself. Have a look at the dlopen manpage for more information.
    
    I hope this helps a bit,
    
    Mathijs
    -- 
    It's not that perl programmers are idiots, it's that the language
    rewards idiotic behavior in a way that no other language or tool has
    ever done.
                                                        Erik Naggum
    
    
  3. Re: Undefined symbol

    Eric G. Miller <egm2@jps.net> — 2001-03-07T08:05:45Z

    On Tue, Mar 06, 2001 at 06:44:31PM -0500, Boulat Khakimov wrote:
    > Hi,
    > 
    > Im writing a function in C (encode) for PG that uses blowfish encryption
    > here is how I compile it.
    > 
    > gcc -I/usr/src/postgresql-7.0.3/src/include
    > -I/usr/src/postgresql-7.0.3/src/backend  -O2 -Wall -Wmissing-prototypes
    > -Wmissing-declarations -lcrypt
    > -I/usr/src/postgresql-7.0.3/src/interfaces/libpq
    > -I/usr/src/postgresql-7.0.3/src/include -fpic  
    > -I/home/boulat/Funio.com/database/libblowfish.a -c -o encode.o
    > encode.c   
    
    I suspect you want 
            ...
    	-L/usr/src/postgresql-7.0.3/src/interfaces/
    	/home/boulat/Funio.com/database/libblowfish.a -c -o encode -lpq
    
    But I wonder if, libblowfish.a is compiled with position independent
    code *and* if libpq is reachable by the backend database.  I don't think
    your libblowfish is getting linked into the object.
    
    > it compiles nicely with 0 error or warnings, 
    > 
    > then i do
    > gcc -shared -o encode.so  encode.o
    > rm encode.o 
    > 
    > so now im left we a ready to go encode.so , So now I add that function
    > to DB
    > 
    > testdb=# CREATE FUNCTION encode(text,text)
    > testdb-# RETURNS text
    > testdb-# AS '/home/boulat/Funio.com/database/encode.so'
    > testdb-# LANGUAGE 'C';
    > CREATE
    > 
    > no problems there either, BUT ...
    > 
    > testdb=# select encode('bob','bob');
    > ERROR:  Load of file /home/boulat/Funio.com/database/encode.so failed:
    > /home/boulat/Funio.com/database/encode.so: undefined symbol:
    > BF_cfb64_encrypt
    > 
    > thats the function that I call from inside my c code...
    > but Why??? It compiled with no errors or warning, and I have all the
    > right includes in my source code.
    > 
    > Im confused!
    > 
    > Any help would be appreciated.
    > 
    > Regards,
    > Boulat Khakimov
    > 
    > -- 
    > Nothing Like the Sun
    > 
    > ---------------------------(end of broadcast)---------------------------
    > TIP 5: Have you checked our extensive FAQ?
    > 
    > http://www.postgresql.org/users-lounge/docs/faq.html
    > 
    
    -- 
    Eric G. Miller <egm2@jps.net>
    
    
  4. Re: (blowfish in Postgres) Undefined symbol -- YAY!

    Boulat Khakimov <boulat@inet-interactif.com> — 2001-03-07T15:19:44Z

    "Eric G. Miller" wrote:
    > I suspect you want
    >         ...
    >         -L/usr/src/postgresql-7.0.3/src/interfaces/
    >         /home/boulat/Funio.com/database/libblowfish.a -c -o encode -lpq
    > 
    > But I wonder if, libblowfish.a is compiled with position independent
    > code *and* if libpq is reachable by the backend database.  I don't think
    > your libblowfish is getting linked into the object.
    > 
    
    
    libblofish.a wasnt getting linked to encode.so , I fixed that 
    now it works w/o a glitch! :)
    
    two way encoding in Postgres using blowfish!!! 
    
    If anyone is interested im goin to put a source code on a webpage or
    something
    
    
    Life is good again :P
    
    Regards,
    Boulat Khakimov
    
    
  5. Re: (blowfish in Postgres) Undefined symbol -- YAY!

    Brent R. Matzelle <bmatzelle@yahoo.com> — 2001-03-09T21:54:38Z

    --- Boulat Khakimov <boulat@inet-interactif.com> wrote:
    > "Eric G. Miller" wrote:
    > > I suspect you want
    > >         ...
    > >         -L/usr/src/postgresql-7.0.3/src/interfaces/
    > >         /home/boulat/Funio.com/database/libblowfish.a -c -o
    > encode -lpq
    > > 
    > > But I wonder if, libblowfish.a is compiled with position
    > independent
    > > code *and* if libpq is reachable by the backend database.  I
    > don't think
    > > your libblowfish is getting linked into the object.
    > > 
    > 
    > 
    > libblofish.a wasnt getting linked to encode.so , I fixed that 
    > now it works w/o a glitch! :)
    > 
    > two way encoding in Postgres using blowfish!!! 
    > 
    > If anyone is interested im goin to put a source code on a
    > webpage or
    > something
    
    Encrypted authentication is always good :)  Please provide the
    code.  I'm very interested in seeing it.  Thanks.
    
    Brent
    
    __________________________________________________
    Do You Yahoo!?
    Get email at your own domain with Yahoo! Mail. 
    http://personal.mail.yahoo.com/