Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing against a installed GD library fails #652

Open
fila43 opened this issue Aug 10, 2020 · 6 comments
Open

testing against a installed GD library fails #652

fila43 opened this issue Aug 10, 2020 · 6 comments
Labels

Comments

@fila43
Copy link

fila43 commented Aug 10, 2020

Hi,
I was trying to test installed GD 2.3.0 and after running make it ended up with :

Building C object tests/gdtest/CMakeFiles/gdTest.dir/gdtest.c.o
/root/rpmbuild/BUILD/libgd-2.3.0/tests/gdtest/gdtest.c: In function ‘_clean_dir’:
/root/rpmbuild/BUILD/libgd-2.3.0/tests/gdtest/gdtest.c:82:2: error: unknown type name ‘DIR’
82 | DIR *d;
| ^~~

after fix missing types I got:

[ 98%] Linking C executable ../Bin/gif
/usr/bin/ld: CMakeFiles/gif.dir/gif.c.o: in function main': /tmp/libgd-gd-2.3.0/examples/gif.c:14: undefined reference to gdImageCreate'
/usr/bin/ld: /tmp/libgd-gd-2.3.0/examples/gif.c:26: undefined reference to gdImageColorAllocate' /usr/bin/ld: /tmp/libgd-gd-2.3.0/examples/gif.c:27: undefined reference to gdImageGifAnimBegin'
/usr/bin/ld: /tmp/libgd-gd-2.3.0/examples/gif.c:31: undefined reference to gdImageCreate' /usr/bin/ld: /tmp/libgd-gd-2.3.0/examples/gif.c:36: undefined reference to gdImageColorAllocate'
/usr/bin/ld: /tmp/libgd-gd-2.3.0/examples/gif.c:37: undefined reference to gdImageColorAllocate' /usr/bin/ld: /tmp/libgd-gd-2.3.0/examples/gif.c:39: undefined reference to gdImageFilledRectangle'
/usr/bin/ld: /tmp/libgd-gd-2.3.0/examples/gif.c:40: undefined reference to gdImageGifAnimAdd' /usr/bin/ld: /tmp/libgd-gd-2.3.0/examples/gif.c:43: undefined reference to gdImageDestroy'
/usr/bin/ld: /tmp/libgd-gd-2.3.0/examples/gif.c:48: undefined reference to `gdImageGifAnimEnd'
collect2: error: ld returned 1 exit status

I wrote a simple patch which works for me.

@willson-chen
Copy link
Member

Hi @fila43, thanks for your feedback.

Here is your patch:

Fix problems with testing against installed GD library

--- libgd-gd-2.3.0/CMakeLists.txt	2020-03-22 14:40:02.000000000 +0100
+++ ../libgd-gd-2.3.0/CMakeLists.txt	2020-08-10 11:04:59.670292207 +0200
@@ -56,11 +56,18 @@
 	INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR})
 	FIND_PACKAGE(GD)
 	if (GD_FOUND)
-		INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR})
+		INCLUDE_DIRECTORIES(BEFORE ${GD_INCLUDE_DIR} ${GD_SOURCE_DIR}/src/ )
 		LINK_DIRECTORIES(${GD_LIBRARIES})
 		SET(GD_LIB ${GD_LIBRARIES})
 		SET(GD_LIBS_DIR ${GD_LIBRARY})
 
+		add_compile_definitions(HAVE_DIRENT_H)
+		add_compile_definitions(HAVE_UNISTD_H)
+		add_compile_definitions(HAVE_SYS_STAT_H)
+		add_compile_definitions(HAVE_SYS_TYPES_H)
+
+		SET(BUILD_SHARED_LIBS TRUE)
+
 		message("GD libs #: ${GD_LIBRARIES}")
 		message("GD lib #: ${GD_LIBRARY}")
 		message("GD include: ${GD_INCLUDE_DIR}")

I wonder why you set BUILD_SHARED_LIBS, which is true by default.

And could you please offer your build environment information, such as cpu arch and os type?

@fila43
Copy link
Author

fila43 commented Aug 13, 2020

I was wondering how to enable testing against the already installed library. And without setting up BUILD_SHARED_LIBS to TRUE build fails because the build of examples fails on missing library during linking.

Build was made on Fedora with hw

@vapier vapier added the tests label Mar 16, 2021
@pierrejoye
Copy link
Contributor

I think we should drop this and use binding or other projects tests suites to valid BC.

Thoughts?

@vapier @cmb69 @willson-chen

@vapier
Copy link
Member

vapier commented Sep 2, 2021

I don't think running source tests against an installed library is that common. I'm not sure I've really seen it done before. if it's easy to pull off, I'm not against it, but the proposed patch won't cut it.

so I'm ok with just letting this feature request go.

not sure what you mean by "BC".

@pierrejoye
Copy link
Contributor

pierrejoye commented Sep 2, 2021 via email

@vapier
Copy link
Member

vapier commented Sep 2, 2021

we should integrate https://lvc.github.io/abi-compliance-checker/ for that kind of coverage. we should be able to get it into our CI to make sure it doesn't break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants