Skip to content

[0.4.x] libvisual + libvisual-plugins: Fix compilation for Debian "bullseye" - #237

Merged
hartwork merged 4 commits into
0.4.xfrom
0.4.x-debian-bullseye
Feb 3, 2023
Merged

hartwork merged 4 commits into
0.4.xfrom
0.4.x-debian-bullseye

Conversation

@hartwork

@hartwork hartwork commented Feb 2, 2023

Copy link
Copy Markdown
Member

@hartwork hartwork added this to the 0.4.2 milestone Feb 2, 2023
@hartwork
hartwork requested a review from kaixiong February 2, 2023 19:30
Comment thread libvisual-plugins/configure.ac Outdated
dnl Library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([floor gettimeofday memmove memset pow sqrt])
AC_CHECK_FUNCS([malloc floor gettimeofday memmove memset pow sqrt])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of these checks except for gettimeofday(). The rest are part of the C99 standard.

@hartwork hartwork Feb 2, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaixiong I have reverted addition of malloc and realloc to these lists just now. When checking the C99 draft linked from https://stackoverflow.com/questions/4883212/html-version-of-c-standard-draft-n1256-pdf there are more of these that I find not mentioned in there. sqrt and pow is libm (or at least can be). I'm not sure what would be the best approach here. I guess our key mission here is to catch later complete errors at configure stage. I can drop some entries but then it should be correct down to the last bit. What do you think?

@hartwork hartwork Feb 2, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: @kaixiong I was replying here for the lists in both halves, if that matters. E.g. usleep is one of those not found but it's not up here but in core libvisual.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaixiong I have dropped all names that I could find in the C99 PDF now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hartwork thanks!

As an alternative to combing through the C standard documents, I look at manpages e.g. man strdup . They contain a section named 'Conforming To' that lists down all the standards (C, POSIX, etc.) the function is included in. It also mentions if the function is a compiler-specific extension. Quite a bit more informative than the C standard.

libm is a glibc specific thing, probably separated out to improve link times. It's not even necessary when building C++ programs against libstdc++, libm is indirectly linked. The C/C++ libraries I've seen on other platforms do not do this.

So when we're using glibc and expect C99 conformance, then libm has to include all of mathematics functions from the standard.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaixiong I was using man pages initially, but overlooked their STANDARDS section — good to know! 👍

@hartwork
hartwork force-pushed the 0.4.x-debian-bullseye branch from 354778e to 1b42908 Compare February 2, 2023 22:39
Link errors for examples on Debian bullseye:
> [..]
> make[2]: Entering directory '[..]/libvisual/examples'
> /bin/bash ../libtool  --tag=CC   --mode=link gcc -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL  -O1 -pipe -g -fsanitize=address -fno-omit-frame-pointer    -g -fsanitize=address -o simplesdl simplesdl.o -lSDL ../libvisual/libvisual-0.4.la -lm -ldl
> libtool: link: gcc -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -O1 -pipe -g -fsanitize=address -fno-omit-frame-pointer -g -fsanitize=address -o .libs/simplesdl simplesdl.o  -lSDL ../libvisual/.libs/libvisual-0.4.so -lm -ldl -Wl,-rpath -Wl,[..]/INSTALL_PREFIX/lib
> /usr/bin/ld: ../libvisual/.libs/libvisual-0.4.so: undefined reference to `rpl_malloc'
> /usr/bin/ld: ../libvisual/.libs/libvisual-0.4.so: undefined reference to `rpl_realloc'
> collect2: error: ld returned 1 exit status
> [..]

Compile error for lv-tool on Debian bullseye:
> [..]
> make[2]: Entering directory '[..]/libvisual/tools/lv-tool'
> [..]
> In file included from /usr/include/c++/10/stdlib.h:36,
>                  from /usr/include/SDL/SDL_stdinc.h:40,
>                  from /usr/include/SDL/SDL_main.h:26,
>                  from /usr/include/SDL/SDL.h:30,
>                  from lv-tool.cpp:30:
> /usr/include/c++/10/cstdlib:151:11: error: ‘malloc’ has not been declared in ‘::’
>   151 |   using ::malloc;
>       |           ^~~~~~
> /usr/include/c++/10/cstdlib:164:11: error: ‘realloc’ has not been declared in ‘::’
>   164 |   using ::realloc;
>       |           ^~~~~~~
> In file included from /usr/include/SDL/SDL_stdinc.h:40,
>                  from /usr/include/SDL/SDL_main.h:26,
>                  from /usr/include/SDL/SDL.h:30,
>                  from lv-tool.cpp:30:
> /usr/include/c++/10/stdlib.h:65:12: error: ‘malloc’ has not been declared in ‘std’
>    65 | using std::malloc;
>       |            ^~~~~~
> /usr/include/c++/10/stdlib.h:73:12: error: ‘realloc’ has not been declared in ‘std’
>    73 | using std::realloc;
>       |            ^~~~~~~
> [..]
@hartwork
hartwork force-pushed the 0.4.x-debian-bullseye branch from 1b42908 to 361bfb0 Compare February 2, 2023 22:39
@hartwork
hartwork requested a review from kaixiong February 2, 2023 22:40
Compile error on Debian bullseye:
> [..]
> make[4]: Entering directory '[..]/plugins/actor/corona'
> /bin/bash ../../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../..   -I../../..  -I[..]/include/libvisual-0.4 -O1 -pipe -g -fsanitize=address -fno-omit-frame-pointer   -DUNIX_X -D_REENTRANT -MT actor_corona.lo -MD -MP -MF .deps/actor_corona.Tpo -c -o actor_corona.lo actor_corona.cpp
> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../.. -I../../.. -I[..]/include/libvisual-0.4 -O1 -pipe -g -fsanitize=address -fno-omit-frame-pointer -DUNIX_X -D_REENTRANT -MT actor_corona.lo -MD -MP -MF .deps/actor_corona.Tpo -c actor_corona.cpp  -fPIC -DPIC -o .libs/actor_corona.o
> In file included from /usr/include/c++/10/stdlib.h:36,
>                  from actor_corona.cpp:29:
> /usr/include/c++/10/cstdlib:151:11: error: ‘malloc’ has not been declared in ‘::’
>   151 |   using ::malloc;
>       |           ^~~~~~
> In file included from actor_corona.cpp:29:
> /usr/include/c++/10/stdlib.h:65:12: error: ‘malloc’ has not been declared in ‘std’
>    65 | using std::malloc;
>       |            ^~~~~~
> [..]
@hartwork
hartwork merged commit 996b714 into 0.4.x Feb 3, 2023
@hartwork
hartwork deleted the 0.4.x-debian-bullseye branch February 3, 2023 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants