Crash on Linux

Linux specific forum
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Crash on Linux

Post by wombats »

Code that works fine on macOS and Windows crashes on Linux without even showing a PB debugger error. I used GDB to try and debug it and it gives me this error:
Thread 1 "Main" received signal SIGSEGV, Segmentation fault.
0x00007ffff5a75048 in __vfprintf_internal (s=s@entry=0x7fffff7ff270, format=format@entry=0x2473600 "%d:%lld:%lld", ap=ap@entry=0x7fffff7ff3f0, mode_flags=mode_flags@entry=0) at ./stdio-common/vfprintf-internal.c:1180
1180 ./stdio-common/vfprintf-internal.c: No such file or directory.
I'm using Qt. Is this something I can fix myself? I can't seem to recreate it in a small example. I googled vfprintf-internal.c and it came up with glibc, so I installed that, but it made no difference. I ran all of the commands in PureBasic's INSTALL file to make sure I hadn't missed anything, but everything's installed as far as I can see.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Crash on Linux

Post by infratec »

Does ldd, against your executable, show a missing library?
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Re: Crash on Linux

Post by wombats »

infratec wrote: Sun Dec 24, 2023 6:10 pm Does ldd, against your executable, show a missing library?
Thanks for replying. No, it's not showing any as not found.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Crash on Linux

Post by infratec »

Segmentation faults happens only if you are working with pointers or using / not using Free..().

Unfortunately without something to reproduice the fault is very difficult to find something.

Have you tried to run it in the ide with Purifier ON and

Code: Select all

PurifierGranularity(1, 1, 1, 1)
:?:

This should show you the point of failure.
wombats
Enthusiast
Enthusiast
Posts: 716
Joined: Thu Dec 29, 2011 5:03 pm

Re: Crash on Linux

Post by wombats »

Unfortunately, the Purifier didn't catch it, but I did figure it out. I had, for some reason, been updating scrollbars in a procedure that draws on a canvas. It seems Qt doesn't like that. Thanks for your suggestions. :)
hamtronix
New User
New User
Posts: 5
Joined: Wed Jan 31, 2024 4:08 pm

Re: Crash on Linux

Post by hamtronix »

I have same issue in Ubuntu Linux 22.04. Anything I try to compile under Linux ends with

Code: Select all

Segmentation fault (core dumped)
Even simple basic hello-world example ends with that. I don't get the point what is broken.
I am using older version 5.31 on my workstation with Ubuntu Linux 22.04 LTS. No idea why it's happening.
LDD and other stuff, useable by other programming languages, doesn't help.

Code: Select all

PureBasic 5.31 (Linux - x64) - (c) 2014 Fantaisie Software
A filename must be specified.
pbcompiler -h for help.
In addition this linker error is absolutelly not understandable for me.

Code: Select all

******************************************
PureBasic 5.31 (Linux - x64)
******************************************

Loading external modules...
Starting compilation...
Starting compilation...
7 lines processed.
Creating the executable.
Error: Linker
/usr/bin/ld: purebasic.o: warning: relocation in read-only section `.text'
/usr/bin/ld: purebasic.o: relocation R_X86_64_PC32 against symbol `exit@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
To avoid this linker error, I found that following code will mitigate it, but it makes no sense to me. Code will be compiled, but result will stay the same.
( I mean "Segmentation fault (core dumped)" )

Code: Select all

Import "-no-pie"
EndImport 
Any advice will help. I like PureBasic, but this is strange.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Crash on Linux

Post by Fred »

Please use the lastest version to see if it still happens
hamtronix
New User
New User
Posts: 5
Joined: Wed Jan 31, 2024 4:08 pm

Re: Crash on Linux

Post by hamtronix »

With PureBasic v.6.04 it's all running smoothly. However, reason for v.5.31 is that I need to compile source file written in v.5.31 which is giving many errors by trying to compile it with v.6.04 compiler.

I got idea to try it inside virtualized environment with older Ubuntu Linux release corresponding the time when v.5.31 was released, maybe that will help.

Or some another idea ?
User avatar
mk-soft
Always Here
Always Here
Posts: 6204
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Crash on Linux

Post by mk-soft »

Which errors the. Perhaps there are not so many
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
hamtronix
New User
New User
Posts: 5
Joined: Wed Jan 31, 2024 4:08 pm

Re: Crash on Linux

Post by hamtronix »

I need to fix:
1, fix the old version of SHA1Fingerprint - this is done
2, remove the ascii requirement on compile and fix the unicode string
3, compile as true linux console application without the debugger
4, fix code bellow which causes problem with "InternetOpen_() is not a function, array, list, map or macro"

Code: Select all

 
 If proxy = "" : access_type =  #INTERNET_OPEN_TYPE_DIRECT : Else : access_type = #INTERNET_OPEN_TYPE_PROXY : EndIf
 If user_agent = "" : user_agent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" : EndIf
   open_handle = InternetOpen_(user_agent, access_type, "", "", 0)

   InternetSetOption_(open_handle, 2, timeout, 4)

I am doing everything in shell command line, I don't have graphical user interface, just text shell console.
So I am compiling everything via pbcompiler command with input parameters like

Code: Select all

pbcompiler -e hello-world hello-world.pb
To solve point 1 was easy. Point 2 and 3 are unknown how to achieve it in Linux in command line just using pbcompiler and his command line parameters. I think I need to add/remove something inside that old source code from v.5.31 to achieve true Linux console application and no ascii requirement. Point 4 is releated to find replacement for Windows function and implement same functionality under Linux.

I will really appreciate advice from more experienced users.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Crash on Linux

Post by Fred »

You can't use old PB version on new linux distro because the binaries are not built for it.
hamtronix
New User
New User
Posts: 5
Joined: Wed Jan 31, 2024 4:08 pm

Re: Crash on Linux

Post by hamtronix »

Yes I agree, I have to run it on Linux from the time when it was released.
Thanks God we have virtualization.

I will try it on older Linux, but the point 4 is still questionable, how to get the same functionality.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Crash on Linux

Post by infratec »

Simply use the PB inbuild functions instead of this API stuff.

HTTPRequest ...
Post Reply