Muxelmann / OpenDSSDirect.make

A set of scripts to download and compile the up to date version of OpenDSS library.
Other
10 stars 4 forks source link

Segmentation fault on Linux #19

Closed kdheepak closed 6 years ago

kdheepak commented 6 years ago

@Muxelmann I'm getting a segmentation fault on CentOS 6.9 when I try to load the shared library. Any thoughts on why this might be happening?

screen shot 2017-11-30 at 3 20 39 am

@tshort, when you built this on CentOS in the past, what version did you use? Do you remember which version of GCC you used and what the version of glibc was on that version of CentOS.

Muxelmann commented 6 years ago

Strange, but I see a similar issue on Travis-CI... It should have been flagged as a warning.

bildschirmfoto 2017-11-30 um 12 09 34

I'm downloading and installing CentOS and will give it a go. I've tested it in Mint and macOS in dedicated VMs. Both builds worked.

kdheepak commented 6 years ago

Awesome! Let me know if there's anything I can do. I tested it with CentOS 6.9 since the shared library in the repo threw an error requesting for a version of GLIBC >= 2.14. CentOS 6.9 has GLIBC 2.12. I tried various combinations of linker flags but they either did not compile or compiled and seg-faulted. I'm starting to wonder if there was a change recently (in the last couple of days) in the electricdss that is causing this?

Muxelmann commented 6 years ago

A similar Segmentation fault persists when compiling for ARM. I have a feeling that fixing it for CentOS may also fix the ARM issue - or at least give us some clue what's wrong.

kdheepak commented 6 years ago

Alternatively, can you try building the shared library on Mint but after you install an older version of GLIBC?

kdheepak commented 6 years ago

I've posted on the sourceforge forum as well, to see if others have thoughts on this.

kdheepak commented 6 years ago

I'm able to build and run this successfully on Ubuntu. I'm not sure what is with Centos / RedHat that is causing the problem.

tshort commented 6 years ago

@kdheepak, I used Centos 6.4. I don't know what version of gcc that comes with.

kdheepak commented 6 years ago

Thanks! I tried this with Centos 6.9 and it segfaulted on loading the shared library. I'll try on Centos 6.4 to see what comes of it.

kdheepak commented 6 years ago

I figured out why it is segfaulting. I'll share more information on the sourceforge forum.

kdheepak commented 6 years ago

I'm quoting from the sourceforge thread for completeness.

I figured out why there is a segmentation fault. ErrorStrings is being initialized on Line 864 https://sourceforge.net/p/electricdss/code/HEAD/tree/trunk/Source/Common/DSSGlobals.pas#l864 However, GetDefaultDataDirectory is called on Line 837 https://sourceforge.net/p/electricdss/code/HEAD/tree/trunk/Source/Common/DSSGlobals.pas#l837 If GetDefaultDataDirectory is not able to create a directory, it tries to add a error string to ErrorStrings, which does not exist and causes a segmentation fault. A minor refactoring is required. Let me know if more information is needed or if you'd like me to submit a patch.

kdheepak commented 6 years ago

It runs tests on Travis successfully now.

@Muxelmann We should tag the svn checkout so that we get a stable working version. OpenDSS seems to be getting a lot of updates and the current trunk (r2093) does not build. The tag r2092 was one that I was able to build and test successively on Mac and Linux. I made some minor changes before compiling to ensure that all my tests pass.

@tshort You can use the libraries from the repo directly. The Windows version is from the svn tag r2085. I'll be adding more information to the commit messages from now on so that it is clear which tag from the svn repo is being used.