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

Cannot Compile Profanity #1241

Closed
myzinsky opened this issue Dec 19, 2019 · 12 comments
Closed

Cannot Compile Profanity #1241

myzinsky opened this issue Dec 19, 2019 · 12 comments
Assignees

Comments

@myzinsky
Copy link

Expected Behavior

running make and profanity compiles

Current Behavior

src/xmpp/avatar.c: In function ‘_free_avatar_data’:
src/xmpp/avatar.c:65:9: error: implicit declaration of function ‘free’ [-Werror=implicit-function-declaration]
         free(data->type);
         ^
src/xmpp/avatar.c:65:9: error: incompatible implicit declaration of built-in function ‘free’ [-Werror]
src/xmpp/avatar.c: In function ‘avatar_get_by_nick’:
src/xmpp/avatar.c:83:5: error: incompatible implicit declaration of built-in function ‘free’ [-Werror]
     free(looking_for);
     ^
src/xmpp/avatar.c:85:5: error: implicit declaration of function ‘strdup’ [-Werror=implicit-function-declaration]
     looking_for = strdup(nick);
     ^
src/xmpp/avatar.c:85:19: error: incompatible implicit declaration of built-in function ‘strdup’ [-Werror]
     looking_for = strdup(nick);
                   ^
src/xmpp/avatar.c: In function ‘_avatar_metadata_nofication’:
src/xmpp/avatar.c:135:9: error: implicit declaration of function ‘malloc’ [-Werror=implicit-function-declaration]
         avatar_metadata *data = malloc(sizeof(avatar_metadata));
         ^
src/xmpp/avatar.c:135:33: error: incompatible implicit declaration of built-in function ‘malloc’ [-Werror]
         avatar_metadata *data = malloc(sizeof(avatar_metadata));
                                 ^
src/xmpp/avatar.c:136:22: error: incompatible implicit declaration of built-in function ‘strdup’ [-Werror]
         data->type = strdup(type);
                      ^
src/xmpp/avatar.c: In function ‘_avatar_request_item_handler’:
src/xmpp/avatar.c:172:5: error: incompatible implicit declaration of built-in function ‘free’ [-Werror]
     free(looking_for);
     ^
src/xmpp/avatar.c:209:9: error: implicit declaration of function ‘strerror’ [-Werror=implicit-function-declaration]
         char *errmsg = strerror(errno);
         ^
src/xmpp/avatar.c:209:24: error: initialization makes pointer from integer without a cast [-Werror]
         char *errmsg = strerror(errno);
                        ^

Possible Solution

no idea so far

Environment

*Debian 8.11

@jubalh jubalh closed this as completed in 6c2fd1a Dec 19, 2019
@jubalh jubalh self-assigned this Dec 19, 2019
@jubalh
Copy link
Member

jubalh commented Dec 19, 2019

Funny that it compiled on my end :)
Please give feedback if the last commit fixed it.

@myzinsky
Copy link
Author

still does not work:

src/xmpp/avatar.c: In function ‘avatar_get_by_nick’:
src/xmpp/avatar.c:86:5: error: implicit declaration of function ‘strdup’ [-Werror=implicit-function-declaration]
     looking_for = strdup(nick);
     ^
src/xmpp/avatar.c:86:19: error: incompatible implicit declaration of built-in function ‘strdup’ [-Werror]
     looking_for = strdup(nick);
                   ^
src/xmpp/avatar.c: In function ‘_avatar_metadata_nofication’:
src/xmpp/avatar.c:137:22: error: incompatible implicit declaration of built-in function ‘strdup’ [-Werror]
         data->type = strdup(type);
                      ^
src/xmpp/avatar.c: In function ‘_avatar_request_item_handler’:
src/xmpp/avatar.c:210:9: error: implicit declaration of function ‘strerror’ [-Werror=implicit-function-declaration]
         char *errmsg = strerror(errno);
         ^
src/xmpp/avatar.c:210:24: error: initialization makes pointer from integer without a cast [-Werror]
         char *errmsg = strerror(errno);
                        ^
cc1: all warnings being treated as errors
Makefile:1780: recipe for target 'src/xmpp/avatar.o' failed
make[1]: *** [src/xmpp/avatar.o] Error 1

and also here:

cc1: all warnings being treated as errors
Makefile:1780: recipe for target 'src/xmpp/avatar.o' failed
make[1]: *** [src/xmpp/avatar.o] Error 1
make[1]: *** Waiting for unfinished jobs....
src/event/server_events.c: In function ‘_clean_incoming_message’:
src/event/server_events.c:1446:19: error: universal character names are only valid in C++ and C99 [-Werror]
     _cut(message, "\u200E");
                   ^
src/event/server_events.c:1447:19: error: universal character names are only valid in C++ and C99 [-Werror]
     _cut(message, "\u200F");
                   ^
cc1: all warnings being treated as errors

jubalh added a commit that referenced this issue Dec 19, 2019
@jubalh
Copy link
Member

jubalh commented Dec 19, 2019

Pushed another commit which adds string.h.

For the other. Yeah I use C99 a lot.
So use a new compiler or tell it to use C99 or newer.

What compiler are you using, which version?

It works fine with 9.2.1 and the stuff that we test on travis (debian, arch, openSUSE).

@myzinsky
Copy link
Author

Even if I use -std=c99 as CFLAG I have many errors:

src/xmpp/contact.c: In function ‘p_contact_new’:
src/xmpp/contact.c:67:5: error: implicit declaration of function ‘strdup’ [-Werror=implicit-function-declaration]
     contact->barejid = strdup(barejid);
     ^
src/xmpp/contact.c:67:22: error: assignment makes pointer from integer without a cast [-Werror]
     contact->barejid = strdup(barejid);
                      ^
src/xmpp/contact.c:71:23: error: assignment makes pointer from integer without a cast [-Werror]
         contact->name = strdup(name);
                       ^
src/xmpp/contact.c:81:31: error: assignment makes pointer from integer without a cast [-Werror]
         contact->subscription = strdup(subscription);
                               ^
src/xmpp/contact.c:83:31: error: assignment makes pointer from integer without a cast [-Werror]
         contact->subscription = strdup("none");
                               ^
src/xmpp/contact.c:86:34: error: assignment makes pointer from integer without a cast [-Werror]
         contact->offline_message = strdup(offline_message);
                                  ^
src/xmpp/contact.c: In function ‘p_contact_set_name’:
src/xmpp/contact.c:107:23: error: assignment makes pointer from integer without a cast [-Werror]
         contact->name = strdup(name);
                       ^
src/xmpp/contact.c: In function ‘p_contact_set_presence’:
src/xmpp/contact.c:405:56: error: passing argument 2 of ‘g_hash_table_replace’ makes pointer from integer without a cast [-Werror]
     g_hash_table_replace(contact->available_resources, strdup(resource->name), resource);
                                                        ^
In file included from /usr/include/glib-2.0/glib.h:50:0,
                 from src/xmpp/contact.c:40:
/usr/include/glib-2.0/glib/ghash.h:71:13: note: expected ‘gpointer’ but argument is of type ‘int’
 gboolean    g_hash_table_replace           (GHashTable     *hash_table,
             ^
src/xmpp/contact.c: In function ‘p_contact_set_subscription’:
src/xmpp/contact.c:414:31: error: assignment makes pointer from integer without a cast [-Werror]
         contact->subscription = strdup(subscription);
                               ^
cc1: all warnings being treated as errors
Makefile:1780: recipe for target 'src/xmpp/contact.o' failed

This is the gcc version:

$ g++ --version
g++ (Debian 4.9.2-10+deb8u2) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@jubalh
Copy link
Member

jubalh commented Dec 19, 2019

Debian 8.11 -> maybe use a newer system :-)

@myzinsky
Copy link
Author

Not possible, because the Server hoster always relies on debian old-stable ... any work arounds?

@jubalh
Copy link
Member

jubalh commented Dec 19, 2019

@pasis do you have an idea?

@jubalh
Copy link
Member

jubalh commented Dec 19, 2019

src/xmpp/contact.c: In function ‘p_contact_new’:
src/xmpp/contact.c:67:5: error: implicit declaration of function ‘strdup’ [-Werror=implicit-function-declaration]
     contact->barejid = strdup(barejid);

strdup is in string.h which is included in src/xmpp/contact.c.

@myzinsky
Copy link
Author

okay one step further by compiling with this config:

CFLAGS="-std=c99 -D_SVID_SOURCE" PKG_CONFIG_PATH=/opt/libstrophe/lib/pkgconfig/ ./configure --prefix=/opt/profanity/

here the error:

src/ui/inputwin.c: In function ‘inp_readline’:
src/ui/inputwin.c:165:5: error: implicit declaration of function ‘fileno’ [-Werror=implicit-function-declaration]
     FD_SET(fileno(rl_instream), &fds);
     ^
cc1: all warnings being treated as errors
Makefile:1780: recipe for target 'src/ui/inputwin.o' failed

@myzinsky
Copy link
Author

this is the solution:

CFLAGS="-std=c99 -D_SVID_SOURCE -D_XOPEN_SOURCE=700" PKG_CONFIG_PATH=/opt/libstrophe/lib/pkgconfig/ ./configure --prefix=/opt/profanity/

@myzinsky
Copy link
Author

Thank you so much for your help :)

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

No branches or pull requests

2 participants