hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.33k stars 2.18k forks source link

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

Closed dogtopus closed 11 years ago

dogtopus commented 11 years ago

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

unknownbrackets commented 11 years ago

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

@xsacha, little help?

-[Unknown]

xsacha commented 11 years ago

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

Will investigate further.

dogtopus commented 11 years ago

@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

jtliaw commented 11 years ago

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!

xsacha commented 11 years ago

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

jtliaw commented 11 years ago

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.

jtliaw commented 11 years ago

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

xsacha commented 11 years ago

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.

chaserhkj commented 11 years ago

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.

chaserhkj commented 11 years ago

Inspected the code and found out the problem...

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