NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/39649: dlsym(3) does not follow dependencies



>Number:         39649
>Category:       lib
>Synopsis:       dlsym(3) does not follow dependencies
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 29 12:05:00 +0000 2008
>Originator:     Jared D. McNeill
>Release:        NetBSD 4.99.72
>Organization:
        
>Environment:
        
        
System: NetBSD black.invisible.ca 4.99.72 NetBSD 4.99.72 (GENERIC) #98: Tue Sep 
23 14:23:39 EDT 2008 
jmcneill%black.invisible.ca@localhost:/export/home/jmcneill/branches/HEAD/src/sys/arch/amd64/compile/GENERIC
 amd64
Architecture: x86_64
Machine: amd64
>Description:
        After dlopen(3)ing a library and then calling dlsym(3) on the handle,
        symbols in libraries marked as NEEDED are not searched.
>How-To-Repeat:

        Install multimedia/ffmpeg and run the following test application.

        Results on NetBSD -current:

                $ cc -Wl,-R/usr/pkg/lib test.c -o test 
                $ ./test
                couldn't find symbol av_free: Undefined symbol "av_free"

        Results on Ubuntu 8.04LTS:

                $ cc test.c -o test -ldl
                $ ./test
                success

        Test application:

#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
        void *hdl, *fn;

        hdl = dlopen("libavcodec.so", RTLD_NOW);
        if (hdl == NULL) {
                printf("couldn't find libavcodec: %s\n", dlerror());
                return EXIT_FAILURE;
        }

        /* av_free is in libavutil */
        fn = dlsym(hdl, "av_free");
        if (fn == NULL) {
                printf("couldn't find symbol av_free: %s\n", dlerror());
                return EXIT_FAILURE;
        }

        printf("success\n");

        return 0;
}
>Fix:
        

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index