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

Unable to build 0.99.beta20 (common-image.c:164: undefined reference to `_caca_alloc2d') #59

Open
thesamesam opened this issue Oct 22, 2021 · 3 comments · May be fixed by #70
Open

Unable to build 0.99.beta20 (common-image.c:164: undefined reference to `_caca_alloc2d') #59

thesamesam opened this issue Oct 22, 2021 · 3 comments · May be fixed by #70

Comments

@thesamesam
Copy link

thesamesam commented Oct 22, 2021

When looking at packaging the new beta20 release for Gentoo, I hit the following error:

x86_64-pc-linux-gnu-gcc -m32 -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20/src -I..  -I/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20 -I/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20/caca -I../caca -DLIBCACA=1 -DX_DISPLAY_MISSING=1   -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches     -ggdb3 -UCACA_ENABLE_VISIBILITY -g -O2 -fno-strength-reduce -fomit-frame-pointer -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare -fvisibility=hidden -DCACA_ENABLE_VISIBILITY -c -o cacaview-common-image.o `test -f 'common-image.c' || echo '/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20/src/'`common-image.c
/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20/src/common-image.c: In function ‘load_image’:
/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20/src/common-image.c:164:18: warning: implicit declaration of function ‘_caca_alloc2d’ [-Wimplicit-function-declaration]
  164 |     im->pixels = _caca_alloc2d(im->w, im->h, depth);
      |                  ^~~~~~~~~~~~~
/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20/src/common-image.c:164:18: warning: nested extern declaration of ‘_caca_alloc2d’ [-Wnested-externs]
/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20/src/common-image.c:164:16: warning: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
  164 |     im->pixels = _caca_alloc2d(im->w, im->h, depth);
      |                ^
/bin/sh ../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc -m32  -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches     -ggdb3 -UCACA_ENABLE_VISIBILITY -g -O2 -fno-strength-reduce -fomit-frame-pointer -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare -fvisibility=hidden -DCACA_ENABLE_VISIBILITY  -fuse-ld=bfd -Wl,--as-needed -o cacaview cacaview-cacaview.o cacaview-common-image.o ../caca/libcaca.la ../caca/libcaca.la -lncurses -ltinfo
libtool: link: x86_64-pc-linux-gnu-gcc -m32 -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -ggdb3 -UCACA_ENABLE_VISIBILITY -g -O2 -fno-strength-reduce -fomit-frame-pointer -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare -fvisibility=hidden -DCACA_ENABLE_VISIBILITY -fuse-ld=bfd -o .libs/cacaview cacaview-cacaview.o cacaview-common-image.o  -Wl,--as-needed ../caca/.libs/libcaca.so -lncursesw -lz -lncurses -ltinfo
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld.bfd: cacaview-common-image.o: in function `load_image':
/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20/src/common-image.c:164: undefined reference to `_caca_alloc2d'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:583: cacaview] Error 1
make[2]: Leaving directory '/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20-abi_x86_32.x86/src'
make[1]: *** [Makefile:546: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/media-libs/libcaca-0.99_beta20/work/libcaca-0.99.beta20-abi_x86_32.x86'
make: *** [Makefile:440: all] Error 2
 * ERROR: media-libs/libcaca-0.99_beta20::gentoo failed (compile phase):
 *   emake failed

Seems like the use of _caca_alloc2d was introduced in 96ff990 and the common-image usage is outside of the library, so might be exacerbated by 726ede6.

Attached the full build.log.gz.

@samhocevar
Copy link
Contributor

Thanks for the report, I will address this soon.

Note however that cacaview is rather useless when not built with the imlib2 library. If you do not distribute that binary then it is not really a problem, of course.

@shoober420
Copy link

shoober420 commented Dec 15, 2021

I'm getting this same error as well when compiling current master commit f42aa68. Full build log attached.

DXMPZUVRY.txt

libtool: link: x86_64-pc-linux-gnu-gcc -m32 -march=native -O3 -pipe -fno-plt -fno-common -fipa-pta -falign-functions=32 -fdevirtualize-at-ltrans -fuse-linker-plugin -floop-nest-optimize -fgraphite-identity -fexcess-precision=fast -w -flto=auto -g -O2 -fno-strength-reduce -fomit-frame-pointer -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare -fvisibility=hidden -DCACA_ENABLE_VISIBILITY -Wl,-O1 -Wl,--as-needed -o .libs/cacadraw cacadraw.o  -L/usr/lib ../caca/.libs/libcaca.so -lncursesw -lX11 -lGL -lGLU -lglut -lz
/usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/media-libs/libcaca-9999/temp/ccTkO2fm.ltrans0.ltrans.o: in function `load_image':
/var/tmp/portage/media-libs/libcaca-9999/work/libcaca-9999/src/common-image.c:164: undefined reference to `_caca_alloc2d'
libtool: link: x86_64-pc-linux-gnu-gcc -m32 -march=native -O3 -pipe -fno-plt -fno-common -fipa-pta -falign-functions=32 -fdevirtualize-at-ltrans -fuse-linker-plugin -floop-nest-optimize -fgraphite-identity -fexcess-precision=fast -w -flto=auto -g -O2 -fno-strength-reduce -fomit-frame-pointer -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare -fvisibility=hidden -DCACA_ENABLE_VISIBILITY -Wl,-O1 -Wl,--as-needed -o .libs/cacademo cacademo.o  -lm -L/usr/lib ../caca/.libs/libcaca.so -lncursesw -lX11 -lGL -lGLU -lglut -lz
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:588: img2txt] Error 1

JohannesKauffmann added a commit to JohannesKauffmann/libcaca that referenced this issue Sep 18, 2022
It is used by the image viewer:

/usr/bin/ld: img2txt-common-image.o: in function `load_image':
../../src/common-image.c:164: undefined reference to `_caca_alloc2d'

Fixes cacalabs#59.
@JohannesKauffmann JohannesKauffmann linked a pull request Sep 18, 2022 that will close this issue
@hartwork
Copy link

@samhocevar any thoughts on related pull request #70?

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

Successfully merging a pull request may close this issue.

4 participants