Would be interesting if anyone else was able to compile Voxelands, and run it for more than 12 hours without getting one of these segfaults (it takes a while). It is addictive.
I tried Valgrind (I think it was this program). It tried for about 10 minutes then came back that the program was doing something that it does not support, then it gave up. All the exceptions alone might have thrown it off. I have looked at CMAKE docs about how to specify your choice of compiler. Any CMAKE supported way to specify that, so far eludes me. Trying to do this within a Slackbuild script that wants to rebuild EVERYTHING does not help. I have modified that slackbuild script into a build debug version that can get around that problem. Amazing that this thing will compile without warnings. It saves its weirdness for run-time. I did notice that it specifies the optimization, and then respecifies differently for debugging. I wonder if the debugging and optimization combination is adding to the confusion. That would be another CMAKE issue that probably is difficult to override. That this many programmers cannot see what the problem with this, and can come up so many possibilities, indicates that it is mostly a C++ language problem. Trying CLANG just to avoid the issue is not a real solution, but it might give indications as CLANG has it own error detection. The solution is to avoid the questionable constructor practices, and put in ones that are safe and sure. The compiler can be trusted to see the duplicated effort and optimize it out. Do not really need the programmer playing tricks just to avoid assigning to a field after it was default initialized. As I already have put this much effort into it, this should get fixed (instead of just using CLANG, even if it worked better). I was wondering about the fix where putting a test for an empty vector, before using an iterator on it. I would think that those std:: operators were more robust than that. Anyone sure about whether iterators need protection against empty vector lists ? I would still like to have an upgrade on GCC though. Getting GCC up to 11.4 may be a small step, but it avoids whatever they did that required jumping to 12.0. If I have to do this myself, I am likely going to have to replace the slack package entirely. My code is not having these problems because I avoid these kind of iffy constructs. Having a alternative version in /opt will not help if I cannot use it in place of the installed GCC with these problem slackbuilds. I really need some way to switch out the compiler that the whole slackbuild sees. |
Quote:
Quote:
The last update to the project was in May 2018. |
Quote:
|
For cmake something like :
cmake -DCMAKE_C_COMPILER=... -DCMAKE_CXX_COMPILER=... added aside the usuals -DCMAKE_CXX_FLAGS and -DCMAKE_C_FLAGS |
Quote:
Quote:
Quote:
|
Quote:
Code:
export CC=clang |
Thank you Bruno, that may be the secret incantation that I was looking for. I wonder where you found that. I must not be getting far enough into the CMAKE docs.
I am familiar with the CC, and CXX, but I was afraid that CMAKE might just ignore or override them. CMAKE might honor environment variables, I don't know. You did not say if that worked in general or specifically did work with CMAKE. I will give up on them and will keep an eye out for those in the CMAKE docs. I do not think that I am done with those CMAKE docs. Thank you all for your comments. I will make what use of them that I can. This may not be immediate, as I have two other major Linux projects to work on, and they may actually produce income so I really should get some work done on them. Voxelands: that project has been abandoned, and resurrected more times than I can keep track. That it has such a high burnout rate is not surprising considering what their code look like. I have the itch for wholesale renaming of functions at minimum, and a few other re-arrangements. These are the more reachable bugs. It runs threads, that seem to do something that may be database management. What is it doing with this separate MeshMake structure. This of course is perfect for out-of-sync updates and accesses causing spontaneous mystery bugs. My last fix was putting a try/catch around a particular call to a particular getBlock call. That stopped that. It ran better for a while (several hours), then started throwing the same exception from the handler for point and click on an block, but this time because of an unguarded getNode call. Why it repeatedly cannot find specific blocks is still a mystery (the exact same block repeatedly, but different for each run). How it treats blocks it cannot find (are they AIR, should they be automatically created?) is not documented, and I have not found anything systemic in the code that would give me a clue. |
Quote:
Here is a page about that super secret, but anyway, it is pretty well documented. Here is the official: https://cmake.org/cmake/help/latest/..._COMPILER.html |
Quote:
|
I tried to use clang.
I used the CMAKE options specified by BRUNO. It compiled, and I got some additional warning messages, about several things not directly relevant. The package that was made would not run. Something is missing. The package is too small. That is all I know at this time. If you want to join in the fun, here is my current work snapshot. Most every debugging is in DEBUG #ifdef. Voxelands 1709, as downloaded at slackbuilds. The link or URL you must send to the recipient(s) of your file(s) is: http://www.fileconvoy.com/dfl.php?id...66473d16e58211 The file(s) that can be retrieved with the above link is (are): voxelands-v1709_debug_01.diff.tar.bz2 (24.323 KB) The file(s) will be available on the server for the next 10 days. In some strange way I am making it more stable, at least. It will run for a hour, and then crash several times in the next 20 minutes. It must have something to do with what actions are being done. Most of the crashes now are failing to destroy a vector owned by one of the Mesh structures. It often starts with the QueuedMeshUpdate destructor. Have not been able to catch what it is that is corrupted. C++ fights me in every way with checking ptrs for validity. It will not let me do any void* comparisons, like setting a valid range for the heap and checking if the ptr in in that range. |
Quote:
There are several different ways to check pointers, but in general a pointer can point to anywhere and can be anything on that location. Especially if the memory is overwritten for any reason. |
Quote:
|
To check ptr for validity you have to check that it is within some bounds.
I tried to get a valid bounds by getting the ADDR of an early item allocated off the stack, and the MAX of other items allocated off the stack as the other limit. The code is in the tar file that I provided 2 posts up. The C++ compiler would not let me cast them to void, nor would it let me compare them to any ptr in that structure. Please note that radically changing the compiler compile settings would disrupt the entire program that I am trying to debug. It is not even a trick. It is just trying to treat a ptr to something allocated as a ptr to a memory area. How does Malloc and new get away with doing this. Does the compiler give Malloc some special rules. Yes, this new compiler is a problem, see original post. I was hoping to see if Bruno got the same results I did, or if his machine behaves significantly different. |
Got another seqfault, in a place this time where I could examine variables.
I get about 5 to 8 segfaults per 2 hour session, usually grouped together. I work on this computer all day long, and do not see this behavior with other programs. This is the first time I have seen this one. InventoryList inventory.cpp:1453 segfault Code:
(gdb) l inventory.cpp:1453 Code:
// Declaration Note: m_lists size just returns the used field. Note: The loop has no guard, it just relies upon size(). Note: This core: may be part of the irrlicht library, however I have seen the similar kinds of problems with a std: vector. Note: this is the first time, in weeks of running this program, that I have seen this particular segfault. Possibilities: 1. the library is not initializing the m_lists correctly 2. the user is required to check for empty list before looping over content, or using size(). Don't know how. 3. the user is required to initialize this item explicitly. 4. the compiler is optimizing away something that it should not. 5. Something is writing random values. Comments based on your experience with C++ constructs and the C++ compiler please. Please note that I can not make this segfault happen again, so I cannot "try something" and see immedidate results. |
valgrind looks for exactly this kind of errors.
|
All times are GMT -5. The time now is 11:42 AM. |