Projects fail to start in iOS when adding XSuperObject


I’ve already reported this directly to the X-SuperObject project, but I thought I may get more quality help on Stack Overflow.

Using Delphi XE8, I have issues using XSuperObject on iOS Simulator (7.1, 8.1, 8.2 and 8.3). So I started an empty Firemonkey app, started adding some things which were in my prior project (at this point I didn’t know what the issue was). All worked fine up until I added the latest XSuperObject and XSuperJSON units to my app.

XSuperObject, XSuperJSON;

Upon running in the iOS simulator, I get an exception:

Project dyld_sim raised exception class EOSError with message ‘System Error. Code: 2. No such file or directory.

I have no code, and have made no changes other than adding units (XSuperObject, XSuperJSON) and a few basic controls (Panel, Button, and Combo Box).

When I break, it takes me to:

System.SysUtils.RaiseLastOSError – last line raise Error;

…which is just the spot where the actual exception itself was raised, nothing of relevance.

So I opened the main project file and put a break point right on the first line Application.Initialize; but that break point is never reached. I also put breakpoints in the “initialization” of both XSuperObject and XSuperJSON and neither of them stop either.

Once I removed both units, everything worked again.

What’s going wrong here and how do I fix it?

X-SuperObject Version: Pulled update from here just prior to reporting
Delphi XE8 Version 22.0.19027.8951 (No Updates)
IDE OS: Windows 7 SP1 (Version 6.1, Build 7601, 64bit)
Mac OS: OS-X 10.10.3
Target OS: iOS Simulator – iPad Air / iOS 8.2 (12D508)

NOTE: Above version details are just one specific example, but I cannot get it to work on any iOS device/version.

UPDATE: After debugging the system (the 115th unit initialization), I came to learn the point where the exception is raised. In System.RegularExpressionsCoreon line 680…

class constructor TPerlRegEx.Create;
if not LoadPCRELib then
RaiseLastOSError; //<– Exception raised here

And inside of LoadPCRELib…

function LoadPCRELib: Boolean;

function GetProcAddr(const ProcName: MarshaledAString): Pointer;
Result := dlsym(_PCRELib, ProcName);

procedure SetCallback(const cbName: MarshaledAString; ProcPointer: Pointer);
Pointer(GetProcAddr(cbName)^) := ProcPointer;

Result := True;
if _PCRELib = 0 then
Result := False;
_PCRELib := HMODULE(dlopen(PCRELib, RTLD_LAZY)); //<– Returns 0 (no handle)
if _PCRELib <> 0 then
// Setup the function pointers

Result := True;

While running a project using only this unit, it runs just fine though.

So it seems to be unable to find /usr/lib/libpcre.dylib, but only if I’m using X-SuperObject.

I’ve updated all of my environment, including OS-X, XCode, iOS Simulator, and SDK links in Delphi IDE (Deleted all and recreated them). I’ve verified the SDK and iOS versions all match perfectly. But the problem still persists.

Comments are closed.