Could you change the code in your version of sdl.pas to look like this.

[pascal]{$IFDEF GP2X}
result := libc.getenv(name);
{$ELSE}
result := fpcgetenv(name);
{$ENDIF}[/pascal]

You may have to change the uses clause at the top to include libc for GP2X.