keroscarel / s3backer

Automatically exported from code.google.com/p/s3backer
GNU General Public License v2.0
0 stars 0 forks source link

Problems with headers on FreeBSD #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Attempt to compile on freebsd
2. Errors relating to locating libraries and then header issues

What is the expected output? What do you see instead?

When you try to compile on FreeBSD configure seems to skip searching /usr/local 
for headers and libraries. Also it doesn't seem to have the command line 
options to pass in curl's path as I've seen previously (e.g. 
--with-curl=/usr/local). Those were easily fixed though. (Via setting 
LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include)

When trying to compile however I got a ton of header errors. Once I added 
"#include <sys/types.h>" to all files that included s3backer.h things were able 
to compile successfully under both GCC and CLANG. I did note one minor warning 
under clang however:
s3b_config.c:1047:39: warning: comparison of unsigned expression < 0 is always 
false [-Wtautological-compare]
        if (config.http_io.key_length < 0 || config.http_io.key_length > EVP_MAX_KEY_LENGTH) {
            ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~

Original issue reported on code.google.com by ejsteig...@gmail.com on 4 Nov 2013 at 3:12

GoogleCodeExporter commented 8 years ago
A sample of the header errors are:
./s3backer.h:157:45: error: unknown type name 'u_char'; did you mean 'char'?
./s3backer.h:164:87: error: unknown type name 'u_int'

These happened multiple times for at least two files (block_cache.h and 
s3backer.h)

Original comment by ejsteig...@gmail.com on 4 Nov 2013 at 4:21

GoogleCodeExporter commented 8 years ago
Thanks.

Re: compiler warning: fixed in r499.

Re: /usr/local - this is normal with FreeBSD. Typically it is handled when a 
package is built as part of the ports system. When building manually you have 
to add the flags you mentioned.

Re: header errors. Not sure I understand.. the first lines of "s3backer.h" are:

    #include "config.h"

    #include <sys/types.h>

So this should define u_int, etc. prior to any use.

Can you help me understand why that doesn't work? I don't have a FreeBSD system 
handy to test with myself.

Original comment by archie.c...@gmail.com on 4 Nov 2013 at 2:41

GoogleCodeExporter commented 8 years ago
If I swap the order of those two lines then everything compiles fine. I'm not 
sure how config.h is being generated and causing it to fail to include 
sys/types.h.

Attached is the config.h and configure output generated with:
CC=gcc LDFLAGS=-L/usr/lib CPPFLAGS=-I/usr/local/include ./configure 
--prefix=/usr/local

Let me know how else I can debug this.

Original comment by ejsteig...@gmail.com on 5 Nov 2013 at 2:48

Attachments:

GoogleCodeExporter commented 8 years ago
Must be the feature macros at the bottom of config.h. Looks like __BSD_VISIBLE 
is not being set to a non-zero value in <sys/cdefs.h> as it should be (on line 
731).

But I don't see how it can be happening unless your environment has one of 
these set: _ANSI_SOURCE, _C99_SOURCE, or _C11_SOURCE.

What does the output of "grep _SOURCE config.log" say?

Please try the following tests by editing "config.h" (after running 
./configure). These are just guesses.

1. Change _XOPEN_SOURCE from 500 to 700
2. Comment out #define _BSD_SOURCE 1
3. Comment out #define _DARWIN_C_SOURCE 1
4. Comment out #define _GNU_SOURCE 1
5. Comment out #define _XOPEN_SOURCE 500

Original comment by archie.c...@gmail.com on 5 Nov 2013 at 3:22

GoogleCodeExporter commented 8 years ago

Original comment by archie.c...@gmail.com on 5 Nov 2013 at 3:26

GoogleCodeExporter commented 8 years ago
None of those environmental variables are being set, unless configure is doing 
it at some point.

Attached is the grep output.

If I commented out #define _XOPEN_SOURCE 500 then it compiles fine with no 
errors. So that seems to be the issue.

Original comment by ejsteig...@gmail.com on 6 Nov 2013 at 5:51

Attachments:

GoogleCodeExporter commented 8 years ago
OK thanks.

The _XOPEN_SOURCE definition is obsolete. I've removed it in r500.

Original comment by archie.c...@gmail.com on 6 Nov 2013 at 2:13