[MDEV-9322] Fatal build error: json.cpp: assigning to 'PSZ' (aka 'char *') from incompatible type 'const char *' Created: 2015-12-24  Updated: 2016-01-22  Resolved: 2015-12-27

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.1.10
Fix Version/s: 10.0.24, 10.1.11

Type: Bug Priority: Major
Reporter: Dan Assignee: Olivier Bertrand
Resolution: Fixed Votes: 1
Labels: None
Environment:

OS X 10.11, Xcode 7.2, Homebrew



 Description   

Hello, compilation fails with clang:

$ clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix

The relevant error message is:

[ 82%] Building CXX object storage/connect/CMakeFiles/connect.dir/json.cpp.o
cd /tmp/mariadb20151224-2853-1xebbq2/mariadb-10.1.10/storage/connect && /usr/local/Library/ENV/4.3/clang++   -DFORCE_INIT_OF_VARS -DHAVE_CONFIG_H -DHUGE_SUPPORT -DLIBXML2_SUPPORT -DLINUX -DMARIADB -DMYSQL_DYNAMIC_PLUGIN -DPIVOT_SUPPORT -DUBUNTU -DUNIX -DXMAP -DZIP_SUPPORT -Dconnect_EXPORTS -I/tmp/mariadb20151224-2853-1xebbq2/mariadb-10.1.10/include -I/tmp/mariadb20151224-2853-1xebbq2/mariadb-10.1.10/sql -I/usr/include/libxml2 -I/usr/local/opt/openssl/include  -pie -fPIC -fstack-protector --param=ssp-buffer-size=4 -DWITH_INNODB_DISALLOW_WRITES -fno-exceptions -fno-rtti -fpermissive -fexceptions -fPIC  -O2 -g -DNDEBUG -D_FORTIFY_SOURCE=2 -DDBUG_OFF -fPIC   -Wall -Wmissing-declarations -Wno-write-strings -Wno-unused-variable -Wno-unused-value -Wno-unused-function -Wno-parentheses -o CMakeFiles/connect.dir/json.cpp.o -c /tmp/mariadb20151224-2853-1xebbq2/mariadb-10.1.10/storage/connect/json.cpp
/tmp/mariadb20151224-2853-1xebbq2/mariadb-10.1.10/storage/connect/json.cpp:597:7: error: assigning to 'PSZ' (aka 'char *') from incompatible type 'const char *'
                str = (err) ? NULL : "Ok";
                    ^ ~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [storage/connect/CMakeFiles/connect.dir/json.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
 

thanks and merry christmas



 Comments   
Comment by Bernard Spil [ 2015-12-28 ]

This applies to 10.0 and 10.1 on FreeBSD as well with clang 3.4.1

Comment by Jan Steinman [ 2016-01-21 ]

10.1.11 doesn't seem to be available yet. Can the problem file (storage/connect/json.cpp) be patched or replaced?

Sorry, I don't know much about git, which I assume would let me download the fixed file... feel free to "RTFM" me – with a URL to the proper reference...

Comment by Sergei Golubchik [ 2016-01-21 ]

This is the file: https://raw.githubusercontent.com/Buggynours/MariaDB/10.1/storage/connect/json.cpp

Comment by Olivier Bertrand [ 2016-01-22 ]

In this file I changed line 597 from:

    str = (err) ? NULL : "Ok";

to:

    str = (err) ? NULL : strcpy(g->Message, "Ok");

However, I couldn't be sure this fix is Ok because using a different compiler.
I'd be glad to have confirmation it works for you.

Comment by Dan [ 2016-01-22 ]

Thank you, I can confirm, that this change fixed the reported MariaDB compilation error.

Generated at Thu Feb 08 07:33:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.