account arrowhead-down arrowhead-up cart mobile-menu search sm-bold-x x-skinny-rounded x-skinny arrowhead-right social-facebook social-googleplus social-instagram social-linkedin social-pinterest social-qzone social-renren social-tencent social-twitter social-vkontakt social-weibo social-youku social-youtube

Please help us improve our website

Take our customer survey to evaluate your visit.

It should only take a few minutes to answer five quick questions. Just click the Launch survey button at the end of your visit to begin.

cancel
Showing results for 
Search instead for 
Did you mean: 
Welcome to the Open Devices community!

This is where we discuss open source and development related questions on our Open Devices initiative.

Compilation problem: undefined reference to 'dlopen'

SOLVED
Highlighted
Regular
Message 1 of 5
2,200 Views
Message 1 of 5

Compilation problem: undefined reference to 'dlopen'

I tried to build AOSP Lollipop 5.1 using build instructions on page https://developer.sonymobile.com/open-devices/aosp-build-instructions/how-to-build-aosp-lollipop-for..., but compilation of macaddrsetup.c (folder vendor/sony-oss/macaddrsetup) failed with following errors:

 

vendor/sony-oss/macaddrsetup/macaddrsetup.c:38: error: undefined reference to 'dlopen'
vendor/sony-oss/macaddrsetup/macaddrsetup.c:42: error: undefined reference to 'dlsym'
vendor/sony-oss/macaddrsetup/macaddrsetup.c:43: error: undefined reference to 'dlsym'
vendor/sony-oss/macaddrsetup/macaddrsetup.c:44: error: undefined reference to 'dlsym'
vendor/sony-oss/macaddrsetup/macaddrsetup.c:45: error: undefined reference to 'dlsym'
vendor/sony-oss/macaddrsetup/macaddrsetup.c:124: error: undefined reference to 'dlclose'
collect2: error: ld returned 1 exit status

 

I could successfully build Marshmallow and Nougat. For this reason I am quite astonished, that I got problems with Lollipop. Has somebody experiences the same problem or knows a solution?

1 ACCEPTED SOLUTION

Accepted Solutions
Regular
Message 5 of 5
3,310 Views
Message 5 of 5

Re: Compilation problem: undefined reference to 'dlopen'

I found a solution for my compilation problem: I changed the variable LOCAL_SHARED_LIBRARIES in file vendor/sony-oss/macaddrsetup/Android.mk to include libraries libdl and libta:

 

LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
libdl \
libta

 

I can't say if build logic of Lollipop is different than Marshmallow or if different behavior comes from different build environments. Marshmallow verison of Android.mk doesn't contain libdl and libta like original Lollipop version. To build Marshmallow I used Linux Mint 18.2 'Sonya' (a little adapted for Marshmallow build). To build Lollipop I used a Docker Image of Ubuntu Trusty (16.04) where I installed necessary libraries.

 

Mobile booted successfully with built Lollipop images. File Transfer between computer and mobile worked too. Camera can take one picture successfully, zooming does not work and a second image can't be saved or taken.

4 REPLIES 4
Developer World
Message 2 of 5
2,195 Views
Message 2 of 5

Re: Compilation problem: undefined reference to 'dlopen'

Hi,

 

you are missing libta.so from the vendor zip

 

Regards

Alin

 

Regular
Message 3 of 5
2,190 Views
Message 3 of 5

Re: Compilation problem: undefined reference to 'dlopen'

It does not seem, that library libta.so contains the missing functions. My libta.so contains the following (nm -D libta.so):

 

U abort
         U __aeabi_memcpy
         U __aeabi_memset
         U __android_log_buf_print
00005008 A __bss_start
         U close
         U __cxa_atexit
         U __cxa_finalize
         U dladdr
00005008 A _edata
0000500a A _end
         U fprintf
         U free
         U __gnu_Unwind_Find_exidx
         U malloc
         U memcpy
         U memset
         U read
         U realloc
         U __register_atfork
         U __snprintf_chk
         U socket_local_client
         U stderr
00000cb5 T ta_close
00000e5d T ta_delete
000011e3 T tadif_read_array
000010a1 T tadif_read_socket
000011a1 T tadif_read_uint32
000011c3 T tadif_read_uint8
0000120d T tadif_send_request
0000115f T tadif_write_array
000010cd T tadif_write_socket
000010f9 T tadif_write_uint32
0000112d T tadif_write_uint8
00000eb1 T ta_format
00000f7d T ta_getmode
00000fe5 T ta_getnextid
00000cf9 T ta_getsize
00000f15 T ta_getversion
00000c4d T ta_open
0000104d T ta_print_info
00000d69 T ta_read
00000de9 T ta_write
         U write

 

I found the library, which contains the missing functions: libdl.so:

 

U abort
00000785 T android_dlopen_ext
00000785 T android_get_application_target_sdk_version
00000789 T android_get_LD_LIBRARY_PATH
00000789 T android_set_application_target_sdk_version
00000789 T android_update_LD_LIBRARY_PATH
U __cxa_atexit
w __cxa_begin_cleanup
w __cxa_call_unexpected
U __cxa_finalize
w __cxa_type_match
00000785 T dladdr
00000785 T dlclose
00000785 T dlerror
00000785 T dl_iterate_phdr
00000785 T dlopen
00000785 T dlsym
00000785 T dl_unwind_find_exidx
w __gnu_Unwind_Find_exidx
00000000 A LIBC
00000000 A LIBC_PRIVATE
U memcpy
U __register_atfork

Regular
Message 4 of 5
2,175 Views
Message 4 of 5

Re: Compilation problem: undefined reference to 'dlopen'

I think that I need to link against libdl.so in folder out/target/product/amami/obj/lib. Is there a documentation about build process or does anybody know where to adapt build process to link the library?

Regular
Message 5 of 5
3,311 Views
Message 5 of 5

Re: Compilation problem: undefined reference to 'dlopen'

I found a solution for my compilation problem: I changed the variable LOCAL_SHARED_LIBRARIES in file vendor/sony-oss/macaddrsetup/Android.mk to include libraries libdl and libta:

 

LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
libdl \
libta

 

I can't say if build logic of Lollipop is different than Marshmallow or if different behavior comes from different build environments. Marshmallow verison of Android.mk doesn't contain libdl and libta like original Lollipop version. To build Marshmallow I used Linux Mint 18.2 'Sonya' (a little adapted for Marshmallow build). To build Lollipop I used a Docker Image of Ubuntu Trusty (16.04) where I installed necessary libraries.

 

Mobile booted successfully with built Lollipop images. File Transfer between computer and mobile worked too. Camera can take one picture successfully, zooming does not work and a second image can't be saved or taken.