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

Compilation error #1

Open
ShevaDavid opened this issue Mar 24, 2024 · 2 comments
Open

Compilation error #1

ShevaDavid opened this issue Mar 24, 2024 · 2 comments

Comments

@ShevaDavid
Copy link

When I run make

rm -f xoop
cc -Wall -Wextra -pedantic -lxcb -lxcb-randr -lxcb-xinput -lxcb-xfixes xoop.c -o xoop
xoop.c:27:10: fatal error: xcb/randr.h: No such file or directory
27 | #include <xcb/randr.h>
| ^~~~~~~~~~~~~
compilation terminated.
make: *** [: xoop] Error 1

@m-col
Copy link
Owner

m-col commented Mar 24, 2024 via email

@limasierra
Copy link
Contributor

limasierra commented May 4, 2024

Hi!

I installed the required libraries and still got compilation errors:

$ make

rm -f xoop 
cc -Wall -Wextra -pedantic -lxcb -lxcb-randr -lxcb-xinput -lxcb-xfixes    xoop.c   -o xoop
xoop.c: In function ‘exit_angrily’:
xoop.c:53:5: warning: format not a string literal and no format arguments [-Wformat-security]
   53 |     fprintf(stderr, msg);
      |     ^~~~~~~
/usr/bin/ld: /tmp/ccqOwLTk.o: warning: relocation against `xcb_input_id' in read-only section `.text'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `exit_angrily':
xoop.c:(.text+0x36): undefined reference to `xcb_disconnect'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `create_barrier':
xoop.c:(.text+0x78): undefined reference to `xcb_generate_id'
/usr/bin/ld: xoop.c:(.text+0xb5): undefined reference to `xcb_xfixes_create_pointer_barrier_checked'
/usr/bin/ld: xoop.c:(.text+0xd0): undefined reference to `xcb_request_check'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `delete_barriers':
xoop.c:(.text+0x298): undefined reference to `xcb_xfixes_delete_pointer_barrier'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `exit_nicely':
xoop.c:(.text+0x2c7): undefined reference to `xcb_disconnect'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `check_xfixes':
xoop.c:(.text+0x2f6): undefined reference to `xcb_xfixes_query_version'
/usr/bin/ld: xoop.c:(.text+0x304): undefined reference to `xcb_xfixes_id'
/usr/bin/ld: xoop.c:(.text+0x30f): undefined reference to `xcb_get_extension_data'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `check_randr':
xoop.c:(.text+0x36a): undefined reference to `xcb_randr_id'
/usr/bin/ld: xoop.c:(.text+0x375): undefined reference to `xcb_get_extension_data'
/usr/bin/ld: xoop.c:(.text+0x3c8): undefined reference to `xcb_randr_select_input'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `check_xinput':
xoop.c:(.text+0x3f4): undefined reference to `xcb_input_id'
/usr/bin/ld: xoop.c:(.text+0x3ff): undefined reference to `xcb_get_extension_data'
/usr/bin/ld: xoop.c:(.text+0x45c): undefined reference to `xcb_input_xi_select_events'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `loop_cursor':
xoop.c:(.text+0x581): undefined reference to `xcb_warp_pointer'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `event_loop':
xoop.c:(.text+0x63a): undefined reference to `xcb_flush'
/usr/bin/ld: xoop.c:(.text+0x6a4): undefined reference to `xcb_flush'
/usr/bin/ld: xoop.c:(.text+0x6bf): undefined reference to `xcb_wait_for_event'
/usr/bin/ld: /tmp/ccqOwLTk.o: in function `main':
xoop.c:(.text+0x7ca): undefined reference to `xcb_connect'
/usr/bin/ld: xoop.c:(.text+0x7e0): undefined reference to `xcb_connection_has_error'
/usr/bin/ld: xoop.c:(.text+0x7fd): undefined reference to `xcb_get_setup'
/usr/bin/ld: xoop.c:(.text+0x805): undefined reference to `xcb_setup_roots_iterator'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make: *** [<builtin>: xoop] Error 1

This is due to the Makefile itself: The libaries are included in CFLAGS, but they should be listed in LDLIBS. The order of the parameters for cc matters, and as you can see in the cc -Wall -Werror ... line above, the libraries are listed before xoop.c, but would need to be listed after xoop.c .

@m-col I'll send you a PR 🙂
Edit: Here it is: #4

And of course, thank you for this amazing tool!

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

3 participants