Closed denizzzka closed 7 years ago
Previous versions from ~ 23 Feb 2017 worked fine.
Thanks for reporting. I'm looking into it. What GCC version are you using?
@denizzzka could you tell me which of the setlocale
calls is crashing? According to the setlocale
man page we use the function correctly, either passing in NULL
or whatever the first call to setlocale
returned.
You could comment those setlocale lines and your programm should work as previously. But I'd like to understand why your system isn't POSIX compliant.
What GCC version are you using?
$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 6.3.0-11' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 6.3.0 20170321 (Debian 6.3.0-11)
@denizzzka could you tell me which of the setlocale calls is crashing?
$ locale LANG=ru_RU.utf8 LANGUAGE= LC_CTYPE="ru_RU.utf8" LC_NUMERIC="ru_RU.utf8" LC_TIME="ru_RU.utf8" LC_COLLATE="ru_RU.utf8" LC_MONETARY="ru_RU.utf8" LC_MESSAGES="ru_RU.utf8" LC_PAPER="ru_RU.utf8" LC_NAME="ru_RU.utf8" LC_ADDRESS="ru_RU.utf8" LC_TELEPHONE="ru_RU.utf8" LC_MEASUREMENT="ru_RU.utf8" LC_IDENTIFICATION="ru_RU.utf8" LC_ALL=
But also I tried C locale:
(platformer
is my program what uses spine-c)
$ LANG=C locale && ./platformer
LANG=C
LANGUAGE=
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=
Ошибка сегментирования (core dumped)
Thanks. Can you tell me which line of code crashes? There are multiple setlocal calls.
On Oct 6, 2017 6:05 PM, "Denis Feklushkin" notifications@github.com wrote:
@denizzzka https://github.com/denizzzka could you tell me which of the setlocale calls is crashing?
$ locale LANG=ru_RU.utf8 LANGUAGE= LC_CTYPE="ru_RU.utf8" LC_NUMERIC="ru_RU.utf8" LC_TIME="ru_RU.utf8" LC_COLLATE="ru_RU.utf8" LC_MONETARY="ru_RU.utf8" LC_MESSAGES="ru_RU.utf8" LC_PAPER="ru_RU.utf8" LC_NAME="ru_RU.utf8" LC_ADDRESS="ru_RU.utf8" LC_TELEPHONE="ru_RU.utf8" LC_MEASUREMENT="ru_RU.utf8" LC_IDENTIFICATION="ru_RU.utf8" LC_ALL=
But also I tried C locale:
$ LANG=C locale && ./platformer LANG=C LANGUAGE= LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_PAPER="C" LC_NAME="C" LC_ADDRESS="C" LC_TELEPHONE="C" LC_MEASUREMENT="C" LC_IDENTIFICATION="C" LC_ALL= Ошибка сегментирования (core dumped)
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/EsotericSoftware/spine-runtimes/issues/1009#issuecomment-334798734, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfYBFa7N_8fwMC1vXLOOIO-C8Tc-2Zxks5spk_JgaJpZM4PvIJZ .
SceletonJson.c:590 causes warning. I think bug near of it.
In general, it is unclear why there is a need to manipulate the locale. Here is only graphics!
The warning is unrelated. Please debug the binary and tell me on what line it crashes. I would do so myself, but I can not reproduce the issue on my machine.
Modifying the local is necessary so the JSON parser can parse floating point values correctly (decimal point). You can remove those lines to continue working while we figure out what's going on on your machine.
On Oct 6, 2017 6:25 PM, "Denis Feklushkin" notifications@github.com wrote:
SceletonJson.c:590 causes warning. I think bug near of it.
In general, it is unclear why there is a need to manipulate the locale. This is just graphics!
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/EsotericSoftware/spine-runtimes/issues/1009#issuecomment-334803774, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfYBLBPGMSoX3k7e-LqOlc1E7lKS274ks5splRtgaJpZM4PvIJZ .
Modifying the local is necessary so the JSON parser can parse floating point values correctly (decimal point).
My life will never be the same! A terrible decision of the standardization committee...
You can remove those lines to continue working while we figure out what's going on on your machine.
Strange thing: it isn't fails if I commit out any of two these setlocale
s!
But then it fails on
spBone* bone = skeleton.findBoneByAttachment(bba);
assert(bone !is null); // fails here
in my own code.
As I said before, if we can't reproduce it, there's no way to fix it.
Also, do you export from a Spine editor version that is the same as the spine-c runtime version?
Can you try to compile and run the spine-sfml example and see if that works on your machine?
On Oct 6, 2017 6:52 PM, "Denis Feklushkin" notifications@github.com wrote:
Modifying the local is necessary so the JSON parser can parse floating point values correctly (decimal point).
My life will never be the same! A terrible decision of the standardization committee...
You can remove those lines to continue working while we figure out what's going on on your machine.
Strange thing: it isn't fails if I commit out any of these setlocale! But then it fails on
spBone* bone = skeleton.findBoneByAttachment(bba); assert(bone !is null); // fails here
in my own code.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/EsotericSoftware/spine-runtimes/issues/1009#issuecomment-334810442, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfYBFqSkAbx9_jbgyMPzm2miBtd1lS5ks5splqugaJpZM4PvIJZ .
Also, do you export from a Spine editor version that is the same as the spine-c runtime version?
No, my Spine editor files dated about ~ Feb 2017
Can you try to compile and run the spine-sfml example and see if that works on your machine?
spine-sfml isn't compiles (commit 43f37ce5657f8c5a3812b467811b7ee85296ea13)
[ 80%] Building CXX object spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/main.cpp.o
cd /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-sfml/build/spine-c/spine-c-unit-tests && /usr/bin/c++ -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/teamcity -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/minicppunit -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/tests -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/memory -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c/include -D_CRT_SECURE_NO_WARNINGS -DKANJI_MEMTRACE -DUSE_CPP11_MUTEX -std=c++11 -o CMakeFiles/spine_unit_test.dir/main.cpp.o -c /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp: In function 'void RegisterMemoryLeakDetector()':
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:25:30: error: '_setDebugMalloc' was not declared in this scope
_setDebugMalloc(_kanjimalloc);
^
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:27:25: error: '_setMalloc' was not declared in this scope
_setMalloc(_kanjimalloc);
^
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:28:27: error: '_setRealloc' was not declared in this scope
_setRealloc(_kanjirealloc);
^
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:29:21: error: '_setFree' was not declared in this scope
_setFree(_kanjifree);
^
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp: In function 'char* _spUtil_readFile(const char*, int*)':
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:77:32: error: '_readFile' was not declared in this scope
return _readFile(path, length);
^
spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/build.make:65: recipe for target 'spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/main.cpp.o' failed
make[2]: *** [spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/main.cpp.o] Error 1
make[2]: Leaving directory '/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-sfml/build'
CMakeFiles/Makefile2:238: recipe for target 'spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/all' failed
make[1]: *** [spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/all] Error 2
make[1]: Leaving directory '/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-sfml/build'
Makefile:130: recipe for target 'all' failed
make: *** [all] Error 2
The editor and runtime versions must match. The file format changes occassionally.
Regarding the SFML error, please pull in the latest changes on the 3.6 branch from today.
Thanks for helping figuring this out.
On Oct 6, 2017 7:02 PM, "Denis Feklushkin" notifications@github.com wrote:
Also, do you export from a Spine editor version that is the same as the spine-c runtime version?
No, my Spine editor files dated about ~ Feb 2017
Can you try to compile and run the spine-sfml example and see if that works on your machine?
spine-sfml isn't compiles (commit 43f37ce https://github.com/EsotericSoftware/spine-runtimes/commit/43f37ce5657f8c5a3812b467811b7ee85296ea13 )
[ 80%] Building CXX object spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/main.cpp.o cd /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-sfml/build/spine-c/spine-c-unit-tests && /usr/bin/c++ -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/teamcity -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/minicppunit -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/tests -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/memory -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c/include -D_CRT_SECURE_NO_WARNINGS -DKANJI_MEMTRACE -DUSE_CPP11_MUTEX -std=c++11 -o CMakeFiles/spine_unit_test.dir/main.cpp.o -c /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp: In function 'void RegisterMemoryLeakDetector()': /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:25:30: error: '_setDebugMalloc' was not declared in this scope _setDebugMalloc(_kanjimalloc); ^ /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:27:25: error: '_setMalloc' was not declared in this scope _setMalloc(_kanjimalloc); ^ /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:28:27: error: '_setRealloc' was not declared in this scope _setRealloc(_kanjirealloc); ^ /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:29:21: error: '_setFree' was not declared in this scope _setFree(_kanjifree); ^ /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp: In function 'char _spUtil_readFile(const char, int*)': /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:77:32: error: '_readFile' was not declared in this scope return _readFile(path, length); ^ spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/build.make:65: recipe for target 'spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/main.cpp.o' failed make[2]: [spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/main.cpp.o] Error 1 make[2]: Leaving directory '/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-sfml/build' CMakeFiles/Makefile2:238: recipe for target 'spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/all' failed make[1]: [spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/all] Error 2 make[1]: Leaving directory '/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-sfml/build' Makefile:130: recipe for target 'all' failed make: *** [all] Error 2
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/EsotericSoftware/spine-runtimes/issues/1009#issuecomment-334813019, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfYBGxVWeSfKzIuSDG3b8w3UCy15eQJks5spl0cgaJpZM4PvIJZ .
(As I know, _readFile
was renamed to _spReadFile
)
please pull in the latest changes on the 3.6 branch from today.
I am on 3.7-beta with same errors
Please try the stable 3.6 branch from today.
On Oct 6, 2017 7:06 PM, "Denis Feklushkin" notifications@github.com wrote:
please pull in the latest changes on the 3.6 branch from today.
I am on 3.7-beta with same errors
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/EsotericSoftware/spine-runtimes/issues/1009#issuecomment-334814128, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfYBOVtnVJI2wKqEyB2RfIKnuQdIGxlks5spl4kgaJpZM4PvIJZ .
The editor and runtime versions must match. The file format changes occassionally.
I would like to hope for a error (exception) in this case, rather than segfault :-)
Please try the stable 3.6 branch from today.
Tried at https://github.com/EsotericSoftware/spine-runtimes/issues/1009#issuecomment-334813019
Please try the stable 3.6 branch from today.
Also tried for sfml with same errors
The commit you linked to is not from today...
Please pull in the changes up until and including today, from the 3.6 branch. Then please try running the sfml example.
branch 3.6, commit 38c8c870e804ec2ba6365e7d16ae27db4e440a9f
spine-sfml isn't compiles with errors:
[ 80%] Building CXX object spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/main.cpp.o
cd /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-sfml/build/spine-c/spine-c-unit-tests && /usr/bin/c++ -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/teamcity -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/minicppunit -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/tests -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/memory -I/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c/include -D_CRT_SECURE_NO_WARNINGS -DKANJI_MEMTRACE -DUSE_CPP11_MUTEX -std=c++11 -o CMakeFiles/spine_unit_test.dir/main.cpp.o -c /home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp: In function 'void RegisterMemoryLeakDetector()':
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:25:30: error: '_setDebugMalloc' was not declared in this scope
_setDebugMalloc(_kanjimalloc);
^
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:27:25: error: '_setMalloc' was not declared in this scope
_setMalloc(_kanjimalloc);
^
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:28:27: error: '_setRealloc' was not declared in this scope
_setRealloc(_kanjirealloc);
^
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:29:21: error: '_setFree' was not declared in this scope
_setFree(_kanjifree);
^
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp: In function 'char* _spUtil_readFile(const char*, int*)':
/home/denizzz/Dev/2D_Game/Platformer/spine-runtimes/spine-c/spine-c-unit-tests/main.cpp:77:32: error: '_readFile' was not declared in this scope
return _readFile(path, length);
^
spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/build.make:65: recipe for target 'spine-c/spine-c-unit-tests/CMakeFiles/spine_unit_test.dir/main.cpp.o' failed
same commit for spine-c fails on the runtime with segfault same as described in https://github.com/EsotericSoftware/spine-runtimes/issues/1009#issue-263135994
error: '_readFile' was not declared in this scope
I think at least this error isn't bug of build system etc because same error I am fixed in my own D spine binding yesterday: https://github.com/denizzzka/dspine/commit/22564744c4dfc6e665c34d5d86b7de57dbe5e6bb
3dbab21
spine-sfml compiles ok. Then fails with same segfault:
Core was generated by `./build/spine-sfml/spine-sfml-example'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f9dc64eec26 in __strcmp_sse2 () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007f9dc64eec26 in __strcmp_sse2 () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f9dc64997e7 in setlocale () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x000056387804dda1 in spSkeletonJson_readSkeletonData ()
#3 0x000056387804dcce in spSkeletonJson_readSkeletonDataFile ()
#4 0x0000563878039ad9 in readSkeletonJsonData(char const*, spAtlas*, float) ()
#5 0x0000563878039bdc in testcase(void (*)(spSkeletonData*, spAtlas*), char const*, char const*, char const*, float) ()
#6 0x000056387803b6ed in main ()
The editor and runtime versions must match. The file format changes occassionally.
I changed my integration tests to loading spineboy-ess.json skeleton from actual version of spine-runtimes
instead of my own skeleton. Nothing was changed, it still fails on setlocale
after spSkeletonJson_readSkeletonData
.
Strange thing: it isn't fails if I commit out any of two these setlocales! But then it fails on
My mistake: it isn't fails when I am comment out both setlocale sections. Then spine-sfml examples work ok.
Tried to update libc6 - isn't helps.
There are 3 calls to setlocale https://github.com/EsotericSoftware/spine-runtimes/blob/3.6/spine-c/spine-c/src/spine/SkeletonJson.c#L590
Could you tell me which one crashes?
I was tried to comment out all setlocales except to first one - crashes. Except second one - crashes.
Thanks for testing. I'll try to reproduce your Debian setup and the crash you see. Worst case, we'll have to add a define that lets you disable locale handling. It's a bit beyond me why the call would crash. It strictly follows the contract set out by the POSIX standard. I must overlook something.
My (stupid) idea: why you don't hardcode dot as floats delimiter? Both in spine-runtimes and in Spine editor?
The Spine editor always outputs the same float delimiter size. However, depending on the locale, the float parser may use .
or ,
. We could look into making the float parser in the runtime always use the same delimiter. The parser uses strtof
or strtod
, which use the current C locale (http://en.cppreference.com/w/c/string/byte/strtof). We could write a replacement for that, but that's not necessarily trivial either if we want to support all float formats permissible in the JSON format (users may provide custom JSON not exported from our editor, but processed by a custom tool). Worse, parsing floats from JSON is a performance bottleneck at load time (you should use .skel!), and I fear a custom float parser may be slower than atof and strtof. I'll investigate!
This should be fixed now. In the end, I replaced the call to the locale dependent strtof
with a custom float parser. The fix is in both the latest 3.6 and 3.7-beta branch. Thanks for reporting!
This should be fixed now.
It works fine! Thanks!
Versions checked: ~master and latest release
While compiling it shows some warnings:
Then after I start to use spine-c library it crashes: