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

Fix build using musl libc #344

Closed
wants to merge 1 commit into from
Closed

Fix build using musl libc #344

wants to merge 1 commit into from

Conversation

bkuhls
Copy link

@bkuhls bkuhls commented Jan 30, 2016

Fixes #331

@bmah888
Copy link
Contributor

bmah888 commented Feb 1, 2016

Thanks for the pull request. In most (all?) places where we including <stdint.h> we do this conditionally like this:

#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif

Do you think your change would work if the #include was done this way? Perhaps I'm being pedantic but everyplace else we make sure that GNU autoconf actually found that header file before trying to include it.

If you're not sure, you can search for STDINT in the file src/iperf_config.h after you've run configure...we want to see something that looks like:

#define HAVE_STDINT_H 1

@bmah888 bmah888 self-assigned this Feb 1, 2016
@joerg-krause
Copy link

From Header Portability - Autoconf:

inttypes.h vs. stdint.h
The C99 standard says that inttypes.h includes stdint.h, so there's no need to include stdint.h separately in a standard environment. Some implementations have inttypes.h but not stdint.h (e.g., Solaris 7), but we don't know of any implementation that has stdint.h but not inttypes.h.

From Solaris Porting FAQ

Solaris only includes stdint.h starting from version 10. For previous versions, use sys/inttypes.h instead. To make it suitable for upstream inclusion, you can shield it for Solaris.

#ifdef HAVE_STDINT_H
#  include <stdint.h>
#  else
#  ifdef HAVE_INTTYPES_H
#    include <inttypes.h>
#  endif
#endif

@bkuhls Any plans for an updated PR?

@doughdemon
Copy link

This PR is also not enough to fix compilation with musl. In addition, _GNU_SOURCE needs to be globally defined so that musl exposes struct tcp_info in <netinet/tcp.h>, which is used in iperf.h. (Defining _GNU_SOURCE just in iperf.h is not enough because <netinet/tcp.h> is included in iperf_server_api.c before iperf.h.) See http://patchwork.ozlabs.org/patch/572187/raw/ for the patch actually used in buildroot.

@bmah888 bmah888 closed this in #518 Mar 22, 2017
bmah888 pushed a commit that referenced this pull request Mar 22, 2017
* Include stdint.h in files where its types are used

Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>

* Fix type of len parameter passed to getsockopt

getsockopt expects socklen_t instead of int as its fifth argument

Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>

* Remove unnecassary includes of netinet/tcp.h

also cleanup the second include of stdint.h in main.c

This commit fixes #331 and is a replacement for #344.

Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>
@bmah888
Copy link
Contributor

bmah888 commented Mar 22, 2017

This pull request has been replaced by #518...thanks for the submission.

bmah888 pushed a commit that referenced this pull request Mar 30, 2017
* Include stdint.h in files where its types are used

Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>

* Fix type of len parameter passed to getsockopt

getsockopt expects socklen_t instead of int as its fifth argument

Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>

* Remove unnecassary includes of netinet/tcp.h

also cleanup the second include of stdint.h in main.c

This commit fixes #331 and is a replacement for #344.

Signed-off-by: Moritz Kick <f1rebird@users.noreply.github.com>

(cherry picked from commit a8ee9c6)
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.

None yet

4 participants