{"action":"created","issue":{"url":"https://api.github.com/repos/simbody/simbody/issues/543","repository_url":"https://api.github.com/repos/simbody/simbody","labels_url":"https://api.github.com/repos/simbody/simbody/issues/543/labels{/name}","comments_url":"https://api.github.com/repos/simbody/simbody/issues/543/comments","events_url":"https://api.github.com/repos/simbody/simbody/issues/543/events","html_url":"https://github.com/simbody/simbody/issues/543","id":197378677,"number":543,"title":"Segmentation fault when creating Inertia object","user":{"login":"david-haber","id":1696004,"avatar_url":"https://avatars.githubusercontent.com/u/1696004?v=3","gravatar_id":"","url":"https://api.github.com/users/david-haber","html_url":"https://github.com/david-haber","followers_url":"https://api.github.com/users/david-haber/followers","following_url":"https://api.github.com/users/david-haber/following{/other_user}","gists_url":"https://api.github.com/users/david-haber/gists{/gist_id}","starred_url":"https://api.github.com/users/david-haber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-haber/subscriptions","organizations_url":"https://api.github.com/users/david-haber/orgs","repos_url":"https://api.github.com/users/david-haber/repos","events_url":"https://api.github.com/users/david-haber/events{/privacy}","received_events_url":"https://api.github.com/users/david-haber/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-23T14:31:39Z","updated_at":"2016-12-23T20:10:31Z","closed_at":null,"body":"We ran into a segmentation fault when executing the following code on Debian 8.5 and Simbody 3.4 (installed from apt-get).\r\n\r\n\r\nrigid_test.cc:\r\n```\r\n#include \"Simbody.h\"\r\n\r\nint main() {\r\n  SimTK::Inertia in(1.0);\r\n  return 0;\r\n}\r\n```\r\n\r\nWe used the following compiler command:\r\n\r\n`g++ -std=c++11 -std=gnu++11 -isystem /usr/include/simbody -Wall -g -Wfatal-errors -c -o rigid_test.o rigid_test.cc\r\ng++ -L/usr/lib/ -lSimTKsimbody -lSimTKmath -lSimTKcommon  rigid_test.o lib.a -o rigid_test`\r\n\r\nand receive the following error:\r\n\r\n```\r\nRunning rigid_test: Segmentation fault\r\n../mk/Makefile.inc:65: recipe for target 'rigid_test.run' failed\r\nmake: *** [rigid_test.run] Error 139\r\n\r\n0x00007ffff6bfc401 in ?? () from /usr/lib/x86_64-linux-gnu/libSimTKcommon.so.3.4\r\n(gdb) bt\r\n#0  0x00007ffff6bfc401 in ?? () from /usr/lib/x86_64-linux-gnu/libSimTKcommon.so.3.4\r\n#1  0x00007ffff7dea9ba in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffffffe6b8, env=env@entry=0x7fffffffe6c8) at dl-init.c:78\r\n#2  0x00007ffff7deaaa3 in call_init (env=0x7fffffffe6c8, argv=0x7fffffffe6b8, argc=1, l=<optimized out>) at dl-init.c:36\r\n#3  _dl_init (main_map=0x7ffff7ffe1a8, argc=1, argv=0x7fffffffe6b8, env=0x7fffffffe6c8) at dl-init.c:126\r\n#4  0x00007ffff7ddd1ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2\r\n#5  0x0000000000000001 in ?? ()\r\n#6  0x00007fffffffe8af in ?? ()\r\n#7  0x0000000000000000 in ?? ()\r\n```\r\n\r\nOur compiler version is: g++ (Debian 4.9.2-10) 4.9.2\r\n\r\nThis code seems quite trivial so we are wondering what is going on."},"comment":{"url":"https://api.github.com/repos/simbody/simbody/issues/comments/269040297","html_url":"https://github.com/simbody/simbody/issues/543#issuecomment-269040297","issue_url":"https://api.github.com/repos/simbody/simbody/issues/543","id":269040297,"user":{"login":"sherm1","id":4088016,"avatar_url":"https://avatars.githubusercontent.com/u/4088016?v=3","gravatar_id":"","url":"https://api.github.com/users/sherm1","html_url":"https://github.com/sherm1","followers_url":"https://api.github.com/users/sherm1/followers","following_url":"https://api.github.com/users/sherm1/following{/other_user}","gists_url":"https://api.github.com/users/sherm1/gists{/gist_id}","starred_url":"https://api.github.com/users/sherm1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sherm1/subscriptions","organizations_url":"https://api.github.com/users/sherm1/orgs","repos_url":"https://api.github.com/users/sherm1/repos","events_url":"https://api.github.com/users/sherm1/events{/privacy}","received_events_url":"https://api.github.com/users/sherm1/received_events","type":"User","site_admin":false},"created_at":"2016-12-23T20:10:31Z","updated_at":"2016-12-23T20:10:31Z","body":"The apt-gettable binary for Simbody 3.4 was built using C++03. The gcc ABIs for C++03 and C++11 are not compatible, so it is *possible* that specifying c++11 here is the problem -- try it without that. If you want to use Simbody with C++11 you'll need to build Simbody from source with -std=c++11 using the most recent release, 3.5.4 which you can get [here](https://github.com/simbody/simbody/releases). Build instructions are provided in the `README.md` file.\r\n\r\nHowever, the compile command you used may also be causing a problem. On Ubuntu 16.04 (a Debian descendant) I obtained Simbody with this command:\r\n```\r\n sudo apt-get install libsimbody-dev simbody-doc\r\n```\r\nwhich gave me Simbody version 3.5.3, which I believe is also a C++03 binary.\r\n\r\nI then compiled this version of your code in a file t.cpp:\r\n```c++\r\n#include <iostream>\r\n#include \"Simbody.h\"\r\n\r\nint main() {\r\n  SimTK::Inertia in(1.0);\r\n  std::cout << in << std::endl;\r\n  return 0;\r\n}\r\n```\r\nwith this command line:\r\n```\r\ng++ -I/usr/include/simbody t.cpp -lSimTKsimbody -lSimTKmath -lSimTKcommon\r\n``` \r\n(using g++ 5.4.0) and got the expected output when I ran `a.out` afterwards:\r\n```\r\n[1,0,0]\r\n[0,1,0]\r\n[0,0,1]\r\n```\r\nBut ... this also worked fine when I compiled it with `-std=c++11` or `-std=c++14`. I don't know what to make of that, but I suggest you try using the simplified compile line here to see if there may be some problem other than ABI compatibility."}}
{"actor":{"display_login":"sherm1"}}