Closed thekad closed 8 years ago
Forgot to add: the CFLAGS come from an rpm spec macro, not specifying it all manually.
Thanks for reporting. First warning is not plugin specific all stats_pusher plugins at least have the same issue. More on that we have a blacklist of cflags that we are supposed to remove in uwsgiconfig.py (p_cflags_blacklist) where -Werror=write-strings is included so failure is somewhat expected, said that fixing that error is trivial. The second one is quite interesting because when a C++ compiler is used we may need to define the struct differently. Is there any reason for CC=g++?
No reason for changing the compiler other than trying to make it work. Are you saying I should stick with gcc and this patch will solve it?
@thekad the patch would silence the -Werror=write-strings error which should be the one you are getting in fedora but am not sure it's the right thing to do as it is an error for g++ but not for gcc. BTW the plugin builds just fine on debian with gcc 5.3.1
@xrmx interesting, this builds just fine in fedora 22 but not in fedora 23 (both using gcc, not g++), like I said I am using the common rpm spec macros on both but there's a real difference between the two. Here are the expanded options in fedora 22:
CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wno-unused-but-set-variable'
And the expanded flags for fedora 23:
CFLAGS='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -Wno-unused-but-set-variable'
The difference is the addition of -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
in fedora 23, and here's the contents of this particular file:
*cc1_options:
+ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}
Not entirely sure how these extra flags may make the build to fail...
could you please pastebin all the output when rpm building the plugin?
Sure thing https://kojipkgs.fedoraproject.org//work/tasks/1869/12381869/build.log is my last attempt
This is the main build page, you can check the other logs for versions and etc http://koji.fedoraproject.org/koji/taskinfo?taskID=12381869
Which version of mongodb are you compiling against? Does something like this works for you?
diff --git a/plugins/stats_pusher_mongodb/uwsgiplugin.py b/plugins/stats_pusher_mongodb/uwsgiplugin.py
index cc4dd0b..4479cc8 100644
--- a/plugins/stats_pusher_mongodb/uwsgiplugin.py
+++ b/plugins/stats_pusher_mongodb/uwsgiplugin.py
@@ -5,6 +5,8 @@ NAME = 'stats_pusher_mongodb'
CFLAGS = [
'-I/usr/include/mongo',
'-I/usr/local/include/mongo',
+ '-std=c++11',
+ '-Wno-error'
]
LDFLAGS = []
Also _Patch #5 (uwsgi_fixmongodb.patch) would be interesting to see
This is the full list of patches and spec file used to build this, I will try your patch above later today http://pkgs.fedoraproject.org/cgit/rpms/uwsgi.git/tree/
Using the CFLAGS posted does work, fwiw
@thekad do you have logs for the build with the patch please?
@xrmx sure thing http://koji.fedoraproject.org/koji/taskinfo?taskID=12456410
python uwsgiconfig.py --plugin plugins/stats_pusher_mongodb fedora cc1: warning: command line option '-std=gnu++11' is valid for C++/ObjC++ but not for C using profile: buildconf/fedora.ini detected include path: ['/usr/lib/gcc/x86_64-redhat-linux/5.3.1/include', '/usr/local/include', '/usr/include'] *** uWSGI building and linking plugin plugins/stats_pusher_mongodb *** [gcc -pthread] stats_pusher_mongodb_plugin.so build time: 2 seconds *** stats_pusher_mongodb plugin built and available in stats_pusher_mongodb_plugin.so ***
'-std=gnu++11' is valid for C++/ObjC++ but not for C, that's right. F23 has changed the CXX ABI(Follow https://lwn.net/Articles/632118/)
@thekad pushed patch in master and uwsgi-2.0. Thanks!
-Wno-error
is not a good practice for packagers :joy: But it's fine now. Thanks.
@cicku -Wno-error is not a good practice for developers too, but all the errors are in mongodb files so that's the only workaround for us.
Hello,
The stats pusher for mongodb stopped compiling in fedora 23. I am the maintainer and was trying to update to latest 2.0.12 but the compilation step fails. This is how I am building it
CFLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -Wno-unused-but-set-variable" python uwsgiconfig.py --plugin plugins/stats_pusher_mongodb fedora
and this is the fedora.ini file used:Building the plugin yields the following error:
I attempted to pass CXXFLAGS instead but that proved fruitless, until I also overrode the compiler. Now this
CXXFLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -std=gnu++11" CC="g++" python uwsgiconfig.py --plugin plugins/stats_pusher_mongodb fedora
yields now the next error:
I am unsure on how to proceed here. This could very well be GCC version from fedora 22 to 23 (the last time this got compiled, it was on fedora 22. Relevant versions:
gcc (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2) mongo-cxx-driver-devel.x86_64 1.0.7-1.fc23