ps2dev / ps2-packer

Create packed ELF files to run on the PS2
GNU General Public License v2.0
72 stars 28 forks source link

"-ldl" still required #14

Closed citronalco closed 6 years ago

citronalco commented 6 years ago

In https://github.com/ps2dev/ps2-packer/commit/235fd72e04dc3c4ab3b394de3fd1ec5587327a07 you removed the linking of libdl. But without that ps2-packer won't compile on current Debian stable.

# make
gcc -O3 -Wall -I. -DVERSION=\"1.1.0\" -DPREFIX=\"/usr/local/ps2dev\" ps2-packer.c dlopen.c -o ps2-packer
/tmp/ccijvjep.o: In function `open_module':
dlopen.c:(.text+0x7): undefined reference to `dlopen'
dlopen.c:(.text+0x1a): undefined reference to `dlerror'
/tmp/ccijvjep.o: In function `get_symbol':
dlopen.c:(.text+0x52): undefined reference to `dlsym'
dlopen.c:(.text+0x5a): undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
Makefile:52: recipe for target 'ps2-packer' failed
make: *** [ps2-packer] Error 1

After re-adding "-ldl" to the Makefile compilation works again.

ps2-packer: ps2-packer.c dlopen.c
-       $(CC) $(CPPFLAGS) ps2-packer.c dlopen.c -o ps2-packer$(EXECSUFFIX)
+       $(CC) $(CPPFLAGS) ps2-packer.c dlopen.c -o ps2-packer$(EXECSUFFIX) -ldl
sp193 commented 6 years ago

Hmm. Looks like I've found something weird about MinGW and Cygwin. Maybe with some other glibc versions out there too. I don't really know what to do about these irregularities, so I've made the LDFLAGS option variable: only MinGW and Cygwin will not link with libdl.

This should be fixed as of af97d3c.

citronalco commented 6 years ago

Thanks!