pawn
pawn copied to clipboard
Segmentation fault when using amx*.so under Ubuntu 16.04 64-bit
Hi
I tried different versions of Pawn under Ubuntu 16.04 64-bit: latest from github, 4.0.57.49 ZIP arvhive. Compile OK with just issuing commands: cmake . && make
When I try simple examples like "Hello World!" - all works fine.
But when I try to add to my Pawn code <args> or <datagram> it falls with segmentation fault and gdb backtrace shows the following:
Program received signal SIGSEGV, Segmentation fault.
0x00000000f75fe004 in ?? ()
(gdb) bt
#0 0x00000000f75fe004 in ?? ()
#1 0x0000000000403933 in amx_Callback ()
#2 0x0000000000407a80 in amx_Exec ()
#3 0x0000000000403280 in main ()
What I'm doing wrong?
Thanks!
Same in Ubuntu 18 LTS
it works in Ubuntu Desktop i386 32bit in VirtualBox VM
but it still doesn't support command line arguments :(
for example: new opt{100} argindex(0, opt); new test = strval(opt); // fails here!
fails with: pawnrun: /home/user/pawn/amx/amxstring.c:600: n_strval: Assertion `offset<(int)sizeof(cell) && offset>=0' failed.
what to do with that error?
We've just hit the same roadblock while trying to embed Pawn into our project and it seems like amx does not fully support 64bit.
The only problem that is, is that the callbacks are not functioning correctly which I assume because of the pointer arithmetics being different than on 32bit.
We've made sure to use the correct preprocessor definitions such as setting the PAWN_CELL_SIZE to 64 along with a couple of other changes but we've still managed to not get it to work correctly and it seems always to crash inside amx_Callback function that is inside amx.c
I solved this recently, but using a slightly hacky route. The following VS linker flags:
/FIXED /DYNAMICBASE:NO /BASE:"0x400000"
Will place the code segment in the first 4gb of memory, such that truncating the callback addresses to 32bit is "safe"(ish).
@Y-Less Incredible, that worked very well! Thanks a lot for the very fast reply, we'd really appreciate your presence in the rage.mp discord if you happen to be interested. Best of regards!
Any updates for this issue? I'm running into it now which spent me a lot of time~ Also, I'm developing under Ubuntu 64bit, thus Y-Less's workaround doesn't apply to me. Anybody knows any workaround for g++ instead of Visual Studio?
I really want a code fix because the Pawn part is the core business of my system.
Multiple 64-bit portability issues in the Pawn AMX finally fixed in commit 37cee7ccb739c1c6472e539bc2c6a444c6c6ce89
Fixed in commit c9dc9da91e4fb89d8e79d73ca098d0b9798102b6.