[GH-ISSUE #2054] [Linux SDL & Qt Build]Missing LDFLAG -ldl #703

Closed
opened 2026-03-17 15:38:03 +03:00 by kerem · 10 comments
Owner

Originally created by @dogtopus on GitHub (Jun 3, 2013).
Original GitHub issue: https://github.com/hrydgard/ppsspp/issues/2054

Need to add it manually to the end of link.txt (Makefile.PPSSPP for Qt build), otherwise:
Linking CXX executable PPSSPPSDL
/usr/bin/ld: lib/libCore.a(atrac3plus.cpp.o): undefined reference to symbol 'dlopen@@GLIBC_2.1'
/usr/bin/ld: note: 'dlopen@@GLIBC_2.1' is defined in DSO /usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/libdl.so so try adding it to the linker command line
/usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/libdl.so: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[2]: *** [PPSSPPSDL] Error 1
make[1]: *** [CMakeFiles/PPSSPPSDL.dir/all] Error 2
make: *** [all] Error 2

My OS: Ubuntu 13.04

Originally created by @dogtopus on GitHub (Jun 3, 2013). Original GitHub issue: https://github.com/hrydgard/ppsspp/issues/2054 Need to add it manually to the end of link.txt (Makefile.PPSSPP for Qt build), otherwise: Linking CXX executable PPSSPPSDL /usr/bin/ld: lib/libCore.a(atrac3plus.cpp.o): undefined reference to symbol 'dlopen@@GLIBC_2.1' /usr/bin/ld: note: 'dlopen@@GLIBC_2.1' is defined in DSO /usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/libdl.so so try adding it to the linker command line /usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/libdl.so: could not read symbols: Invalid operation collect2: error: ld returned 1 exit status make[2]: **\* [PPSSPPSDL] Error 1 make[1]: **\* [CMakeFiles/PPSSPPSDL.dir/all] Error 2 make: **\* [all] Error 2 My OS: Ubuntu 13.04
kerem closed this issue 2026-03-17 15:38:08 +03:00
Author
Owner

@unknownbrackets commented on GitHub (Jun 3, 2013):

http://forums.ppsspp.org/showthread.php?tid=3723

@xsacha, little help?

-[Unknown]

<!-- gh-comment-id:18846667 --> @unknownbrackets commented on GitHub (Jun 3, 2013): http://forums.ppsspp.org/showthread.php?tid=3723 @xsacha, little help? -[Unknown]
Author
Owner

@xsacha commented on GitHub (Jun 4, 2013):

libdl is already linked with:
Qt 4.8.3
gcc 4.7.2
Ubuntu 12.10 64-bit

Will investigate further.

<!-- gh-comment-id:18889102 --> @xsacha commented on GitHub (Jun 4, 2013): libdl is already linked with: Qt 4.8.3 gcc 4.7.2 Ubuntu 12.10 64-bit Will investigate further.
Author
Owner

@dogtopus commented on GitHub (Jun 4, 2013):

@xsacha
Qt 4.8.4
gcc 4.7.3
Ubuntu 13.04 32-bit here
Oh btw I got same error while building (linking) other programs e.g. MAME

<!-- gh-comment-id:18890509 --> @dogtopus commented on GitHub (Jun 4, 2013): @xsacha Qt 4.8.4 gcc 4.7.3 Ubuntu 13.04 32-bit here Oh btw I got same error while building (linking) other programs e.g. MAME
Author
Owner

@jtliaw commented on GitHub (Jun 4, 2013):

Try update QT creator to 2.5.2, cmake to 2.8.8
My gcc is 4.6.3 can build!
Qt creator use debug build!

<!-- gh-comment-id:18903980 --> @jtliaw commented on GitHub (Jun 4, 2013): Try update QT creator to 2.5.2, cmake to 2.8.8 My gcc is 4.6.3 can build! Qt creator use debug build!
Author
Owner

@xsacha commented on GitHub (Jun 4, 2013):

QtCreator version shouldn't be important. It is just a frontend.
Qt version may be important.

<!-- gh-comment-id:18907812 --> @xsacha commented on GitHub (Jun 4, 2013): QtCreator version shouldn't be important. It is just a frontend. Qt version may be important.
Author
Owner

@jtliaw commented on GitHub (Jun 4, 2013):

O!!! My ubuntu 12.04 qt4 is 4.8.1 , but can not build , so i have install qt5 !
But the qt5 creator is 2.7.0 also can't build , so i go to software center revert qtcretor to 2.5.2.

<!-- gh-comment-id:18909794 --> @jtliaw commented on GitHub (Jun 4, 2013): O!!! My ubuntu 12.04 qt4 is 4.8.1 , but can not build , so i have install qt5 ! But the qt5 creator is 2.7.0 also can't build , so i go to software center revert qtcretor to 2.5.2.
Author
Owner

@jtliaw commented on GitHub (Jun 4, 2013):

xsacha! May i ask you why the ppssppqt sound not smoothly?

<!-- gh-comment-id:18910521 --> @jtliaw commented on GitHub (Jun 4, 2013): xsacha! May i ask you why the ppssppqt sound not smoothly?
Author
Owner

@xsacha commented on GitHub (Jun 4, 2013):

Yeah, it's using a method I thought makes sense. But it seems I'll have to adopt the no-sense one that blackberry/iOS use for better audio :P From: jtliawSent: Tuesday, 4 June 2013 11:59 PMTo: hrydgard/ppssppReply To: hrydgard/ppssppCc: xsachaSubject: Re: [ppsspp] [Linux SDL & Qt Build]Missing LDFLAG -ldl (#2054)xsacha! May i ask you why the ppssppqt sound not smoothly?

—Reply to this email directly or view it on GitHub.

<!-- gh-comment-id:18912654 --> @xsacha commented on GitHub (Jun 4, 2013): Yeah, it's using a method I thought makes sense. But it seems I'll have to adopt the no-sense one that blackberry/iOS use for better audio :P From: jtliawSent: Tuesday, 4 June 2013 11:59 PMTo: hrydgard/ppssppReply To: hrydgard/ppssppCc: xsachaSubject: Re: [ppsspp] [Linux SDL & Qt Build]Missing LDFLAG -ldl (#2054)xsacha! May i ask you why the ppssppqt sound not smoothly? —Reply to this email directly or view it on GitHub.
Author
Owner

@chaserhkj commented on GitHub (Jun 5, 2013):

Confirmed this issue on ArchLinux x86_64

I was just building a SDL version of the application using cmake and this message rasied up....

Here's the output of "LANG=C VERBOSE=1 make " on my box: http://pastebin.com/YHhKQ8Vj

My versions:
Arch: x86_64
Linux: 3.9.4-ARCH
Distro: ArchLinux
SDL: 1.2.15
Qt4: 4.8.4
Qt5: 5.0.2
GLibC: 2.17
GCC: 4.8.1

I think this should be considered a bug in our CMakeLists.txt file, as we used dlopen function in the program yet didn't explicitly inform the compiler to link the target to the library file that contains it.

According to my understanding of how gcc works, here when library A is dynamically linked to library B, and while we are linking target C dynamically to A, the compiler will only resolve all the references that are explicitly DEFINED in A, and will NOT resolve references defined in B. Though any calls to functions defined in B from library A still works, called from C to B would cause a link time error. So all we need to do may be adding -dl library linking flag explicitly to CMakeLists.txt to fix this, right?

I'm still pretty new to programming and am not very familiar with how compiler works, so PLEASE comment on my understanding of compiling and linking if there is anything wrong about it.

<!-- gh-comment-id:18976570 --> @chaserhkj commented on GitHub (Jun 5, 2013): Confirmed this issue on ArchLinux x86_64 I was just building a SDL version of the application using cmake and this message rasied up.... Here's the output of "LANG=C VERBOSE=1 make " on my box: http://pastebin.com/YHhKQ8Vj My versions: Arch: x86_64 Linux: 3.9.4-ARCH Distro: ArchLinux SDL: 1.2.15 Qt4: 4.8.4 Qt5: 5.0.2 GLibC: 2.17 GCC: 4.8.1 I think this should be considered a bug in our CMakeLists.txt file, as we used dlopen function in the program yet didn't explicitly inform the compiler to link the target to the library file that contains it. According to my understanding of how gcc works, here when library A is dynamically linked to library B, and while we are linking target C dynamically to A, the compiler will only resolve all the references that are explicitly _DEFINED_ in A, and will _NOT_ resolve references defined in B. Though any calls to functions defined in B from library A still works, called from C to B would cause a link time error. So all we need to do may be adding -dl library linking flag explicitly to CMakeLists.txt to fix this, right? I'm _still_ pretty new to programming and am not very familiar with how compiler works, so _PLEASE_ comment on my understanding of compiling and linking if there is anything wrong about it.
Author
Owner

@chaserhkj commented on GitHub (Jun 7, 2013):

Inspected the code and found out the problem...

Sent a pull request to fix this... On issue #2124 , please check

<!-- gh-comment-id:19086660 --> @chaserhkj commented on GitHub (Jun 7, 2013): Inspected the code and found out the problem... Sent a pull request to fix this... On issue #2124 , please check
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ppsspp#703
No description provided.