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

Build system fixes #47

Merged
merged 6 commits into from
Apr 9, 2016
Merged

Build system fixes #47

merged 6 commits into from
Apr 9, 2016

Conversation

mbiebl
Copy link
Contributor

@mbiebl mbiebl commented Apr 7, 2016

Various smaller fixes / improvements.

The next step would be, moving the private header files from libfastjsoninclude_HEADERS to libfastjson_internal_la_SOURCES, i.e. make sure those are no longer installed.

I've updated this PR to include the changes for the header files.
Please comment on d6d5a0c, especially if you'd prefer a json_internal.h for the tests.

Running -Werror during development is fine, but not in released code.
See [1] for further details.

[1] https://blog.flameeyes.eu/2009/02/future-proof-your-code-dont-use-werror
@rgerhards rgerhards self-assigned this Apr 7, 2016
@rgerhards
Copy link
Member

While I think removing the private files from json.h is definitely the right thing to do, I am not sure I can merge immediately. I have not yet checked if currently rsyslog and helpers depend on some of these definitions. If they do, let's see if I manage to get all changed until the next release. If not, we need to postpone that part of the merge as well, because I would like to do as much cleanup as possible with that release.

@@ -25,7 +25,6 @@ libfastjsoninclude_HEADERS = \

libfastjson_la_LDFLAGS = -version-info 3:0:0 -no-undefined @JSON_BSYMBOLIC_LDFLAGS@ \
-export-symbols-regex '^fjson_.*'
libfastjson_la_CPPFLAGS = -Werror
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you consider to be an alternative when release building? Using -Werror in CFLAGS does not play well with configure (there are many post on that problem on the Internet). So would you recommend to do - a configure option?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly is the problem with passing -Werror via CFLAGS? Do you have any references?

That said, a good middle ground could be something like [1].
During development you could build with
--enable-more-warnings=error.

The important part is, that hard-coding -Werror is bad and should be removed.

[1] https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/m4/compiler_warnings.m4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016-04-07 16:09 GMT+02:00 Michael Biebl [email protected]:

In Makefile.am
#47 (comment):

@@ -25,7 +25,6 @@ libfastjsoninclude_HEADERS = \

libfastjson_la_LDFLAGS = -version-info 3:0:0 -no-undefined @JSON_BSYMBOLIC_LDFLAGS@
-export-symbols-regex '^fjson_.*'
-libfastjson_la_CPPFLAGS = -Werror

What exactly is the problem with passing -Werror via CFLAGS? Do you have
any references?

The problem is that -Werror make autoconf AC_CHECK_FUNC checks think
features are not available, just because the way configure works. Check
here for a sample using strcmp:

https://gist.github.com/rgerhards/723c3777158fb882e15c9179c1fa76c8#file-config-log-L415

That said, I noticed that in the mean time I was able to remove all
AC_CHECK_FUNC, so it is not an issue at the moment.

That said, a good middle ground could be something like [1].
During development you could build with
--enable-more-warnings=error.

That's probably a better method anyhow.

The important part is, that hard-coding -Werror is bad and should be
removed.

[1]
https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/m4/compiler_warnings.m4

read it and agree, do not question the need, but think about how to do
it. I need to say that I just recently added -Werror after I banged my head
for some hours in not getting travis up due to above-mentioned problem.

Rainer


You are receiving this because you were assigned.
Reply to this email directly or view it on GitHub
https://github.com/rsyslog/libfastjson/pull/47/files/14be0062e7fe2f79d0428596c15b3e609d8d195a#r58877067

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's remove it and I'll promise to prepare a follow-up fix which steals the NM macro and includes that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I see that this has been included in autoconf-archive [1].
Actually, I don't know if the NM is based on that or inspired that macro.
I guess we should prefer the one from autoconf-archive.

[1] https://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ie., let's just drop the usage of Werror until we re-introduce it via AX_COMPILER_FLAGS

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016-04-07 16:55 GMT+02:00 Michael Biebl [email protected]:

In Makefile.am
#47 (comment):

@@ -25,7 +25,6 @@ libfastjsoninclude_HEADERS = \

libfastjson_la_LDFLAGS = -version-info 3:0:0 -no-undefined @JSON_BSYMBOLIC_LDFLAGS@
-export-symbols-regex '^fjson_.*'
-libfastjson_la_CPPFLAGS = -Werror

Why does removing Werror from libfastjson_la_CPPFLAGS break AC_CHECK_FUNCS?
I can understand that adding -Werror via CFLAGS can have an influence on
AC_CHECK_FUNCS, but dropping it should be safe.

At this point, my main concern is travis and not to re-open old problems. I
have now managed to get travis require warning-free builds, I would like to
keep this while we improve the system.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016-04-07 16:56 GMT+02:00 Michael Biebl [email protected]:

In Makefile.am
#47 (comment):

@@ -25,7 +25,6 @@ libfastjsoninclude_HEADERS = \

libfastjson_la_LDFLAGS = -version-info 3:0:0 -no-undefined @JSON_BSYMBOLIC_LDFLAGS@
-export-symbols-regex '^fjson_.*'
-libfastjson_la_CPPFLAGS = -Werror

ie., let's just drop the usage of Werror until we re-introduce it via
AX_COMPILER_FLAGS

OK, that works. But I would like to check on the internal headers before
merging. It's easy if I complete my current task, but mixing this merge and
the tasks costs me much more coordination over the projects. So bear with
me for a couple of hours. (As I wrote in the overall issue, that commit
breaks rsyslog build).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2016-04-07 16:59 GMT+02:00 Rainer Gerhards [email protected]:

2016-04-07 16:56 GMT+02:00 Michael Biebl [email protected]:

In Makefile.am:

@@ -25,7 +25,6 @@ libfastjsoninclude_HEADERS = \

libfastjson_la_LDFLAGS = -version-info 3:0:0 -no-undefined
@JSON_BSYMBOLIC_LDFLAGS@
-export-symbols-regex '^fjson_.*'
-libfastjson_la_CPPFLAGS = -Werror

ie., let's just drop the usage of Werror until we re-introduce it via
AX_COMPILER_FLAGS

OK, that works. But I would like to check on the internal headers before
merging. It's easy if I complete my current task, but mixing this merge and
the tasks costs me much more coordination over the projects. So bear with me
for a couple of hours. (As I wrote in the overall issue, that commit breaks
rsyslog build).

In other words: I don't think it doesn't really matter if we merge
today, tomorrow or monday, but it eases my life considerably if we do
not merge immediately.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. Please take the time to review carefully before you merge.

@rgerhards
Copy link
Member

I tried in a temporary branch. Without the internal includes, at least some things break. Hopefully all is related to #46 (which uses internal structures). I am working on that one, will retry the merge when I am finished with it.

@mbiebl
Copy link
Contributor Author

mbiebl commented Apr 7, 2016

Ok, so should I close this PR, open a new one without the header file changes for now and we deal with that in a separate PR?

@rgerhards
Copy link
Member

keep it open at the moment. Hopefully I am done with the other work in a day or two. More comments follow.

mbiebl added 5 commits April 7, 2016 18:09
The atomic.h header file was added in
81a7081.
Make sure it is distributed in the dist tarball and also installed as
public header file, as it is referenced in json_object_private.h.

This basically reverts 95c76f1.
This also reduces the visual clutter when updating the version info.
Since 99eb6a3 we no longer export any
private symbols. The tests do require those private symbols though.
Instead of compiling the source twice, as done in
f415452, create a convenience library
and link the tests against it.
Those are no longer public ABI, so they shouldn't be public API either.
Fix json.h to no longer reference those files.
Since json.h after commit 25daae3 no
longer includes the private headers, make the test suite include the
individual headers as needed.
An alternative would be to create a "json_internal.h", which the tests
can include and which reference all internal headers.
@mbiebl mbiebl force-pushed the build-system-fixes branch from d6d5a0c to 6fafb53 Compare April 7, 2016 16:14
@rgerhards
Copy link
Member

FYI: I have this basically working on my test branch, but it triggers some problems in rsyslog which I need to look into before finally merging (else I break CI).

@rgerhards rgerhards merged commit 6fafb53 into rsyslog:master Apr 9, 2016
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