Windows build crashes on Mac (help!)

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
Steve Denney
Posts: 101
Joined: Wed Dec 22, 2010 8:17 pm

Windows build crashes on Mac (help!)

Post by Steve Denney » Wed Aug 29, 2018 6:26 am

I’ve written a programme for a uni Aboriginal language course. Unfortunately, it crashes on macs (quits unexpectedly on start-up). I have to get this to work ☹
Any help much appreciated
Steve

Details:

It was written on windows and works on that platform. Once upon a time I would’ve had Livecode installed on a mac too and would build the Mac standalone there. Now, what with licence requirements and all I’m trying to do the build on windows and simply install the finished .app folder for testing.

On the mac I put the built .app folder into the applications folder (where it crashes when clicked).

The app uses a standalone splash-screen, on windows this get put in the program files(x86) folder, on macs it gets put in a folder contents/macOS in the .app folder.

The splash-screen opens a livecode ‘home’ stack where everything else is done.

On windows this livecode home stack gets put in /AppData/Roaming.
On the mac I’ve put it into the .app folder/resources folder.
A preferences text file is created, so users can set their own scaleFactor and font choice. This I try to put in Documents (nothing gets created on the mac, it crashes beforehand).
The file-paths get put into globals (splashscreen, prefsFile, HomeStak) so hopefully it shouldn't matter if they're different.

I have no idea why it’s crashing. I tried putting answer messages in the standalone but they’re not working (presumably the crash happens before then).

I could perhaps install livecode on the mac (switching seats? not sure if I can do this with my employer's indy licence, and I'd rather not unless I have to -- this project is already overdue).

The main stack (in the code below this is 'homeStak') has sound files and is quite large (144mb). It also has thousands of lines of code. I can't see any easy way of providing it. I don’t think it’s getting as far as opening the main stack.

The issue may even be with my standalone build mac settings. (Which I could supply if it'd help).

The splash-screen stack (pre-build) is tiny. Here's the code:

Code: Select all

on preOpenStack
   if the platform is Win32 then 
      put Arial into theFont
   else
      put Helvetica into theFont
   end if
   repeat with i = 1 to the number of flds of this stack
      set the textFont of this stack to theFont
   end repeat
   set the loc of this stack to the screenloc
   set the passkey of this stack to [password goes here]
   set the navigationArrows to false
   set the visible of this stack to true
   set the loc of this stack to the screenLoc -- middle of screen
   show img 1
   set lockcursor to true
end preOpenStack

on openStack
   global splashScreen, homeStak, prefsFile,  fullScn, theScale, openCount  -- all set/initialised here 
   
   put 0 into openCount
   get the long name of this stack --file path on hard drive
   delete the first word of it --stack
   delete the first char of it -- "
   delete the last char of it -- "
   put it into splashScreen -- exe file
   put it into thisStackPath
   set itemDel to "/"
   delete the last item of thisStackPath --the name of the current stack, leaving the file path (separated by commas)
   if the platform is Win32 then 
      set the dontuseqteffects to true
      set the dontuseQT to true
      put specialfolderpath(0x001a) into appData --C:/Users/Steve/AppData/Roaming
      put specialfolderpath(0x0005) into myDocs --C:\Users\Steve\Documents CSIDL_PERSONAL = 0x0005
      put "/Gupapuyngu_" & fld exeVerFld after appData  
   else
      put specialfolderpath(resources) into appData 
      put specialfolderpath(documents) into myDocs --
   end if
   put "/Gupapuyngu_" & fld exeVerFld after myDocs
   if there is not a folder myDocs then
      create folder myDocs
   end if  
   put appData & "/Gup_main.livecode" into homeStak
   put myDocs & "/Gupapuyngu_prefs.txt" into prefsFile -- global set here
   put empty into theScale
   if there is a file prefsFile then
      open file prefsFile for read
      read from file prefsFile until EOF
      put it into fld prefsFld of cd 1 of stack homeStak
   else -- create text file
      put fld prefsDefaultFld of cd 1 of stack homeStak into fld prefsFld of cd 1 of stack homeStak
      open file prefsFile for write
      write fld prefsFld of cd 1 of stack homeStak to file prefsFile
   end if
   close file prefsFile
   if the platform is Win32 then 
      put lineOffset("winfont:", fld prefsFld of cd 1 of stack homeStak) into fontLine
   else
      put lineOffset("macfont:", fld prefsFld of cd 1 of stack homeStak) into fontLine
   end if
   put line fontLine of fld prefsFld of cd 1 of stack homeStak into theFont
   set itemDel to ":"
   put item 2 of theFont into theFont
   repeat with p = 1 to the number of cds of stack homeStak
      repeat with i = 1 to the number of flds of cd p of stack homeStak
         set the textFont of fld i of cd p of stack homeStak to theFont
      end repeat
   end repeat
   put lineOffset("scale:", fld prefsFld of cd 1 of stack homeStak) into viewSetting
   put item 2 of viewSetting into viewSetting
   if viewSetting is "Full" then -- will start in fullscreen mode
      put "true" into fullScn
   end if
   if viewSetting is a number then -- will start at this scale
      put viewSetting into theScale
   end if
   if there is a stack homeStak then
      if fullScn is "true" then
         set the fullscreenmode of stack homeStak to "letterbox"
         set the fullscreen of stack homeStak to true
      else
         set the fullscreen of stack homeStak to false
         if theScale is not empty then -- will be a number from above
            set the scaleFactor of stack homeStak to theScale
         end if
      end if
   end if
   
   set the passkey of stack homeStak to [password goes here]
   set the loc of stack homeStak to the screenLoc
   set the visible of stack splashScreen to false
   set the visible of stack homeStak to true
   set lockMessages to false
   set the loc of stack homeStak to the screenLoc
   go to cd 1 of stack homeStak
   set cursor to arrow
   lock cursor
   unlock screen
end openStack

SparkOut
Posts: 2012
Joined: Sun Sep 23, 2007 4:58 pm

Re: Windows build crashes on Mac (help!)

Post by SparkOut » Wed Aug 29, 2018 8:27 am

I don't know / can't test or provide any real answers, but a couple of things: specialFolderPath parameters should be quoted - specialFolderPath ("documents"). LiveCode generally tries to help and interpret unquoted literals in an appropriate manner, so that's not likely to be the fix here, but especially on mobile it will need to be more specific.
And you are reading the entire prefs file at once, so you can condense all that part into one line:
put url ("file:" & prefsFile) into field "prefsField"

(note field name should be quoted as well, unless prefsField really IS a variable)

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3456
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Windows build crashes on Mac (help!)

Post by richmond62 » Wed Aug 29, 2018 9:28 am

what with licence requirements and all
If you are using a licensed version of LiveCode I believe that licence allows you
to deploy LIveCode on a machine running MacOS as well as a machine running Windows.

Certainly, I am aware that there has been a long-running "thing" about
running MacOS standalone builds built on Windows or Linux . . . but that
may have been ironed out since I last considered that problem.

As LiveCode 8.1.10 will run on Macintosh machines running MacOS all the way back to 10.6 you
do not need the "latest, greatest, vastly expensive thing" to build a Mac standalone.
Last edited by richmond62 on Wed Aug 29, 2018 11:37 am, edited 1 time in total.

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 582
Joined: Fri Feb 06, 2015 4:03 pm

Re: Windows build crashes on Mac (help!)

Post by LiveCode_Panos » Wed Aug 29, 2018 10:51 am

Hello Steve,

Please file a bug report to quality.livecode.com, and make sure you either attach your stack to the report, or send it to panos.merakos@livecode.com if it is confidential.

The LC team will then have a look at your stack and fix the problem.

Kind regards,
Panos
--

Klaus
Posts: 11103
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Windows build crashes on Mac (help!)

Post by Klaus » Wed Aug 29, 2018 11:31 am

Hi Steve,

in your own interest, get used to use QUOTES around strings (names of objects, pathnames etc.)
E.g. this will fail in your standalone:

Code: Select all

...
## put specialfolderpath(resources) into appData 
## put specialfolderpath(documents) into myDocs
...
This will work:

Code: Select all

...
put specialfolderpath("resources") into appData 
put specialfolderpath("documents") into myDocs --
...
Important hint:
Use the "build-in" inheritance, that means if you do not set certain porperties for an object, it will inherit these from the "superior" object:
field -> group (if part of a group) -> card -> stack -> mainstack (if in a substack)

Example:
Create a stack and some fields and or buttons on a card.
Do not set any FONT or whatever for the objects explicitely.
NOW set the textfont for the stack to whatever and all of the objects will "inherit" these property(ies).
Get the picture?

This way you do not need this repeat loop, just set the STACKS textfont and you are done.

Code: Select all

...
repeat with p = 1 to the number of cds of stack homeStak
      repeat with i = 1 to the number of flds of cd p of stack homeStak
         set the textFont of fld i of cd p of stack homeStak to theFont
      end repeat
end repeat
...
Another hint:
This loop will set the textfont of your stack X times, where X is the number of fields on card 1 of that stack,
because field and all object (except GROUPS) are counted relative to the current card and not the stack:

Code: Select all

...
 repeat with i = 1 to the number of flds of this stack
      set the textFont of this stack to theFont
end repeat
...
And much more, but one step after another... :D


Best

Klaus

Steve Denney
Posts: 101
Joined: Wed Dec 22, 2010 8:17 pm

Re: Windows build crashes on Mac (help!)

Post by Steve Denney » Thu Aug 30, 2018 12:01 am

I thought putting quotes around the specialFolderPaths would be the answer, but it still crashes.

So sorry for my terrible mistakes in preOpenStack, as noted, I set the stack’s textFont each time while looping through the number of flds (actually only two fields in that stack, but omg).

That stack (the splash-screen) I could just set the overall stack textFont and should’ve done it that way. The much bigger main stack did have a lot of fields with odd fonts (it’s at least 8 years old, pre-Unicode and fields were pasted from other stacks too). If I looped through every field and set the font to “” (empty), could I then go back to just changing the stack’s textfont? (NB am aware that pasted text overrides field fonts and can fix that).

And good to know I can install livecode on the mac as well. I’ll be doing that for sure.

I really appreciate everyone’s time and effort. Your help is invaluable.

Back to the crashing…

I’ve looked more closely at the apple error data. This appears to be the critical bit:

Dyld Error Message:
Symbol not found: ___sincos_stret
Referenced from: /Applications/Gupapuyngu_3_01.app/Contents/MacOS/Gupapuyngu_3_01
Expected in: /usr/lib/libSystem.B.dylib

I googled the error and it seems to be something lacking prior to OS X 10.9, the mac I have runs 10.8.
Apparently I can upgrade for free so I’ll give that a go.
However, it’d be good if there was a way of removing the issue (something in my stacks) so the app could run on older macs? (I'm assuming the OS upgrade will fix it but it might not).

Steve Denney
Posts: 101
Joined: Wed Dec 22, 2010 8:17 pm

Re: Windows build crashes on Mac (help!)

Post by Steve Denney » Thu Aug 30, 2018 5:46 am

Setting every field's fontText to "" did enable me to use Set the textFont of this stack successfully again. Much more elegant solution, thanks.

Looks like I need to go to an apple shop for my required free OS update. I need an apple id to upgrade the OS and I can only use my apple comp to get an apple id if it has a later OS (this is a new policy changed only recently -- also I have no other apple technology).

So hope to get to that soon. I'm hoping it will fix the crashing.

Post Reply

Return to “Mac OS”