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

Fixes #10

Merged
merged 2 commits into from
Apr 7, 2020
Merged

Fixes #10

merged 2 commits into from
Apr 7, 2020

Conversation

ac000
Copy link
Contributor

@ac000 ac000 commented Apr 6, 2020

Hi,

Here are some fixes for compiling on older systems such as CentOS 7 and hopefully will also fix issue #9

Secondly there is a commit to clean up the LD_FLAGS Makefile variable. Its options just mirrored CC_FLAGS, but those only affect compilation and not linking.

Cheers,
Andrew

When compiling on CentOS 7 (GCC 4.8, Glibc 2.17) there were numerous
build failures.

1) C99 loop initial declarations used

src/config.c: In function ‘ff_parse_arguments’:
src/config.c:31:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
     for (int i = 1; i < argc; i++)
     ^
src/config.c:31:5: note: use option -std=c99 or -std=gnu99 to compile your code

   GCC 4.8 defaults[0] to gnu90 (C90 + GNU extensions)

   ff-proxy doesn't seem to be using any GNU extensions so just compile
   with -std=c99.

2) strcasecmp(3) technically requires strings.h, glibc does declare this
   in string.h depending on what feature test macros are defined. But
   lets just include strings.h in src/config.c

3) getaddrinfo(3)/freeaddrinfo(3) requires sys/types.h in src/server.c,
   also the following item

4) A lot of errors relating to not knowing about struct addrinfo and
   various AI_ flags. The simplest thing to do here is to just define
   _GNU_SOURCE at compilation time.

5) The server needs to link against -lm for ceil(3)

[0]: https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Standards.html
The various options set in LD_FLAGS don't have any effect in the linker,
they all control the compilation stage.

So set LD_FLAGS to empty.

This does require a slight change to the test_build recipe as this does
some compilation and linking. Use CC (although it's the same as LD) and
use CC_FLAGS (as well as LD_FLAGS, although it's currently empty).
@TimeToogo TimeToogo merged commit 651b191 into TimeToogo:master Apr 7, 2020
@TimeToogo
Copy link
Owner

Thanks!

@ac000 ac000 deleted the fixes branch April 7, 2020 15:24
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 this pull request may close these issues.

2 participants