[SOLVED] Segmentation fault on successfully compiled and run program lazarus / 32-Linux ---------------------------------------------------------------------- vrull · 2017-08-13 04:17 Hi, I have got a strange situation, when my LCL GUI program runs on one PC, where it was compiled, but fails with segmentation fault on others with similar OS. Edit: It is not really SOLVED, but I have discovered that if the program was properly installed it would work all right without any issues. So I made a .deb package, installed it and got the program working. What I tried before was running it under local user account from ~/bin folder. Why these attempts failed on all, but my development computer, I still have no idea. end of Edit My system: Quote$ uname -a Linux main 4.10.0-32-generic #36~16.04.1-Ubuntu SMP Wed Aug 9 09:19:02 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux which means Linux Mint 18.2 (Sonya);  Mate desktop environment Quote$ cat /proc/cpuinfo processor   : 0 vendor_id   : AuthenticAMD cpu family   : 16 model      : 6 model name   : AMD Athlon(tm) II X2 255 Processor stepping   : 2 microcode   : 0x10000c7 cpu MHz      : 800.000 cache size   : 1024 KB physical id   : 0 siblings   : 2 core id      : 0 cpu cores   : 2 apicid      : 0 initial apicid   : 0 fpu      : yes fpu_exception   : yes cpuid level   : 5 wp      : yes flags      : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt hw_pstate vmmcall npt lbrv svm_lock nrip_save bugs      : tlb_mmatch fxsave_leak sysret_ss_attrs null_seg bogomips   : 6228.39 TLB size   : 1024 4K pages clflush size   : 64 cache_alignment   : 64 address sizes   : 48 bits physical, 48 bits virtual power management: ts ttp tm stc 100mhzsteps hwpstate AMD Athlon II 64 bit processor (two cores) Lazarus ver. 1.6 stable x86_64-linux-GTK2 FPC ver. 3.0.0 Project targets x86_64 Linux GTK2 On the above configuration the program runs all right. Other machines are all Intel ultra-low power PCs Quote$ uname -a Linux kodi-main 4.10.0-30-generic #34~16.04.1-Ubuntu SMP Wed Aug 2 02:13:56 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux Lubuntu 16.4 Quote$ cat /proc/cpuinfo processor   : 0 vendor_id   : GenuineIntel cpu family   : 6 model      : 76 model name   : Intel(R) Celeron(R) CPU  N3150  @ 1.60GHz stepping   : 3 microcode   : 0x362 cpu MHz      : 479.882 cache size   : 1024 KB physical id   : 0 siblings   : 4 core id      : 0 cpu cores   : 4 apicid      : 0 initial apicid   : 0 fpu      : yes fpu_exception   : yes cpuid level   : 11 wp      : yes flags      : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology tsc_reliable nonstop_tsc aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch epb tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm ida arat bugs      : bogomips   : 3200.00 clflush size   : 64 cache_alignment   : 64 address sizes   : 36 bits physical, 48 bits virtual power management: this is info for one core of four (Intel Celeron 4 core ULW) This was the only system which gave me something sensible: Quote$ ./watermarker -bash: ./watermarker: cannot execute binary file: Exec format error The other two just said "segmentation fault". Another system is: Quote$ uname -a Linux 4.4.0-91-generic #114-Ubuntu SMP Tue Aug 8 11:56:56 UTC 2017 x86_64 x86_64 x86_64 GNU/LinuxLinux Mint 18.1, Mate desktop CPU model name   : Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz The program does not do anything fancy, It provides GUI for user to enter some parameters and fill them into command templates to run ImageMagick commands; they generate watermark images and apply them to user's pictures. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program watermarker; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}{$IFDEF UseCThreads}  cthreads,  {$ENDIF}{$ENDIF}  Interfaces, // this includes the LCL widgetset  Forms, uMain, XMLFile, uparamlist; {$R *.res} begin  RequireDerivedFormResource := True;  Application.Initialize;  Application.CreateForm(TfrmMain, frmMain);  Application.Run;end.       frmMain writes a lot of debug info into StdOut at OnCreate event, but it crashes well before it - I see none of them, when I run it in terminal. Any ideas or suggestions where to look? Surprisingly the previous version of this program ran OK on all systems. Thank you. ---------------------------------------------------------------------- Thaddy · 2017-08-13 06:12 Can it be a wrong or missing install of libmagick? That would be the most likely cause. Can it be a missing file or insufficient rights? (chmod +x) What happens when you compile with {$IOCHECKS ON}{$RANGECHECKS ON} ---------------------------------------------------------------------- vrull · 2017-08-13 06:42 Thank you for your reply. The program itself does not know anything about ImageMagick; it runs external Process and looks for expected file to exist after that. The execution rights are certainly set up, I checked this many times. It crashes somewhere before even reaching OnCreate event of the main form. I will wait until 13th is finished then see what can be done.