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

Implicit function _IceTransNoListen in fsm.c #1031

Closed
kro-cat opened this issue Jun 5, 2024 · 4 comments · Fixed by #1032
Closed

Implicit function _IceTransNoListen in fsm.c #1031

kro-cat opened this issue Jun 5, 2024 · 4 comments · Fixed by #1032

Comments

@kro-cat
Copy link
Contributor

kro-cat commented Jun 5, 2024

With libICE installed, autoconf successfully detects _IceTransNoListen, but fsm.c doesn't correctly declare this function (nor does its included header files). This causes the build to fail due to the implicit declaration of function _IceTransNoListen; this is located in fsm.c:

fvwm3/libs/fsm.c

Line 1048 in f036638

_IceTransNoListen("tcp");

Since _IceTransNoListen is neither defined nor declared in libICE headers (it is in fact declared in Xtrans.h, not packaged with libICE), it would be appropriate to use an extern declaration for the function:

#ifdef HAVE__ICETRANSNOLISTEN
extern void _IceTransNoListen(char *protocol);
#endif
@ThomasAdam
Copy link
Member

Maybe. I'd rather fix the headers though so we're including the correct things, rather than chucking extern at it, as you're suggesting.

Can you open a PR when you've done that, please?

@kro-cat
Copy link
Contributor Author

kro-cat commented Jun 7, 2024

Not a problem, I'll use the header and make sure that's set up correctly. If that's somehow not possible, I'll make a note of it here. Should have a PR up sometime soon.

@kro-cat
Copy link
Contributor Author

kro-cat commented Jun 7, 2024

On my system, and perhaps other systems, xtrans.h is in a separate package (ie xtrans) from libICE (ie libice), and is not one of it's dependencies.

In the case that libice is installed and xtrans isn't (or perhaps it may be useful to consider the case in which xtrans.h isn't packaged at all), I could either switch how the function is declared:

/* example 1 */
#if defined(HAVE_XTRANS_H) && defined(HAVE__ICETRANSNOLISTEN)
#include <X11/Xtrans/Xtrans.h>
#elif defined(HAVE__ICETRANSNOLISTEN)
#warn "Maybe warn something? Probably don't need to."
extern void _IceTransNoListen(char *protocol);
#endif

or whether the function is used:

/* example 2 */
/* up top */
#if defined(HAVE_XTRANS_H) && defined(HAVE__ICETRANSNOLISTEN)
#include <X11/Xtrans/Xtrans.h>
#endif

/* ... */

/* in fsm_init() */
#if defined(HAVE_XTRANS_H) && defined(HAVE__ICETRANSNOLISTEN)
        _IceTransNoListen("tcp");
#endif

If you prefer one way or another, let me know. For now, I'll use the first example since that appears to me to be the traditional approach.

kro-cat added a commit to kro-cat/fvwm3 that referenced this issue Jun 7, 2024
A declaration is required for `_IceTransNoListen` to link against libICE.

`_IceTransNoListen` is declared in X11/Xtrans/Xtrans.h (`xtrans-dev`) only when
configured for libICE by defining the following symbols: `ICE_t`
`TRANS_SERVER`.

(see [libICE configure.ac](https://gitlab.freedesktop.org/xorg/lib/libice/-/blob/master/configure.ac))

Add a check in configure.ac to determine if the build system has
X11/Xtrans/Xtrans.h, and define `ICE_t` and `TRANS_SERVER` if it does.

Add a preprocessor step in lib/fsm.c to switch between using Xtrans.h or
an extern declaration for the `_IceTransNoListen` symbol depending on
whether or not the build system has Xtrans.h.

Fixes fvwmorg#1031

Signed-off-by: Kara <33235324+kro-cat@users.noreply.github.com>
@ThomasAdam
Copy link
Member

Hi @kro-cat

I think the first option you've suggested makes the most sense.

Thanks!

ThomasAdam pushed a commit that referenced this issue Jun 10, 2024
A declaration is required for `_IceTransNoListen` to link against libICE.

`_IceTransNoListen` is declared in X11/Xtrans/Xtrans.h (`xtrans-dev`) only when
configured for libICE by defining the following symbols: `ICE_t`
`TRANS_SERVER`.

(see [libICE configure.ac](https://gitlab.freedesktop.org/xorg/lib/libice/-/blob/master/configure.ac))

Add a check in configure.ac to determine if the build system has
X11/Xtrans/Xtrans.h, and define `ICE_t` and `TRANS_SERVER` if it does.

Add a preprocessor step in lib/fsm.c to switch between using Xtrans.h or
an extern declaration for the `_IceTransNoListen` symbol depending on
whether or not the build system has Xtrans.h.

Fixes #1031

Signed-off-by: Kara <33235324+kro-cat@users.noreply.github.com>
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.

2 participants