error copying resource file when compiling for Web play

Hi all, I’m a TADS newbie, and I’m trying to compile my game for Web play. Going by the System Manual (tads.org/t3doc/doc/sysman/webui.htm), I’ve made a separate t3m file:

-D TADS_INCLUDE_NET
-D LANGUAGE=en_us
-D MESSAGESTYLE=neu
-Fy obj -Fo obj
-o lookaroundthecorner.t3
-lib system
-lib adv3/adv3web
-lib webui
-source tadsnet
-source shufflecomp
-res GameInfo.txt

When I run t3make -f shufflecomp-web, it stops after this:

	add_resources -> lookaroundthecorner.t3
	+ /usr/local/share/frobtads/tads3/lib/webuires (webuires)
lookaroundthecorner.t3: error copying resource file "/usr/local/share/frobtads/tads3/lib/webuires"

That path is a directory, rather than a plain file; is that what’s causing the problem? Any ideas how to fix this?

I’m using TADS 3.1.3 on OS X.

I can’t see anything wrong with the makefile. What version of OS X are you on?

Can you zip the entire game directory (clean it up from build files first, so that only the sources and makefiles are left) and send it my way?

(I’m the maintainer of FrobTADS; you can run “frob -h” to get my email address; it’s printed at the end of the output.)

I’ve uploaded it to GitHub: github.com/dougo/shufflecomp

Let me know if you still want me to mail you the zip.

I’m on OS X 10.9.2. Here’s the frob version info:

bash-3.2$ frob --version
FrobTADS 1.2.3
TADS 2 virtual machive v2.5.17
TADS 3 virtual machine v3.1.3 (mjr-T3)

Let me know if you need any more info. Thanks!

OK, just tested it in OS X 10.6, 10.7 and 10.8. All work fine. I’ll need to download and install 10.9.

I’ve now set up an OS X 10.9.3 installation. I can’t reproduce the issue. Your game builds correctly, including the web version, and everything is working just fine :-/

Maybe somehow the FrobTADS installation is broken. Try installing again. I assume you’re using the official OS X installer from here:

tads.org/frobtads.htm

I just reinstalled FrobTADS, after removing /usr/local/share/frobtads. Still getting the same “error copying resource file” message. Do you have any theories about what the actual error that it’s running into might be?

Oh, hey! When I run t3make with the -d option, it works! But, now when I run the generated .t3 file with frob, it says “Network error: prohibited network access”. But hm, I did include tadsnet. Any ideas what I should look into next?

It certainly reminds me of this problem I’ve reported in the past, but it should be resolved in your version of FrobTADS: http://bugdb.tads.org/view.php?id=164. Hm, I have no idea. I’ve also tried your game (on linux) and it bulit successfully and run well. Are library files really under /usr/local/share/frobtads/tads3/lib/webuires and do they have correct access rights?

When you build in debug mode (-d switch), then no resources would be included in the binary image file and they will be read directly from the filesystem in the runtime. Maybe it would be interesting run the game in debug and see whatever there are some issues with resource loading at runtime. If you are getting error messages about prohibited network access, you probably didn’t allowed frob to open network communication with -N switch. Try the following and then you should probably fine-tune the access to minimum required (don’t know from my head exactly, but one of those digits controls listening rights and the other outgoing communication).

frob -i plain -p -N 44 lookaroundthecorner-web.t3

Hm, when I run that command it prints out a URL, but when I go to the URL in my browser I just get a blank page.

Here are the contents of the webuires lib directory:

bash-3.2$ ls -l /usr/local/share/frobtads/tads3/lib/webuires
total 976
-rw-r--r--  1 root  wheel     857 May 18  2013 TADS.swf
-rw-r--r--  1 root  wheel     825 May 18  2013 ckbox8pt-off.gif
-rw-r--r--  1 root  wheel     882 May 18  2013 ckbox8pt-on.gif
-rw-r--r--  1 root  wheel    1561 May 18  2013 cmdwin.css
-rw-r--r--  1 root  wheel     970 May 18  2013 cmdwin.htm
-rw-r--r--  1 root  wheel   42535 May 18  2013 cmdwin.js
-rw-r--r--  1 root  wheel     868 May 18  2013 comboarrow.gif
-rw-r--r--  1 root  wheel     166 May 18  2013 debuglog.css
-rw-r--r--  1 root  wheel     458 May 18  2013 debuglog.htm
-rw-r--r--  1 root  wheel     711 May 18  2013 debuglog.js
-rw-r--r--  1 root  wheel    1708 May 18  2013 defaultPrefs.js
-rw-r--r--  1 root  wheel    1035 May 18  2013 dlg-closebox.gif
-rw-r--r--  1 root  wheel    1030 May 18  2013 dlg-closeboxA.gif
-rw-r--r--  1 root  wheel    1028 May 18  2013 dlg-closeboxH.gif
-rw-r--r--  1 root  wheel    1107 May 18  2013 dlg-corners.gif
-rw-r--r--  1 root  wheel    1107 May 18  2013 dlg-title-corners.gif
-rw-r--r--  1 root  wheel    1734 May 18  2013 dlgIconError.gif
-rw-r--r--  1 root  wheel    1527 May 18  2013 dlgIconInfo.gif
-rw-r--r--  1 root  wheel    1648 May 18  2013 dlgIconQuestion.gif
-rw-r--r--  1 root  wheel    1530 May 18  2013 dlgIconWarning.gif
-rw-r--r--  1 root  wheel    1147 May 18  2013 downloadPopupBkg.gif
-rw-r--r--  1 root  wheel    1112 May 18  2013 errorPopupBkg.gif
-rw-r--r--  1 root  wheel     272 May 18  2013 layoutwin.css
-rw-r--r--  1 root  wheel     592 May 18  2013 layoutwin.htm
-rw-r--r--  1 root  wheel   11489 May 18  2013 layoutwin.js
-rw-r--r--  1 root  wheel    9614 May 18  2013 main.css
-rw-r--r--  1 root  wheel    7103 May 18  2013 main.htm
-rw-r--r--  1 root  wheel  117866 May 18  2013 main.js
-rw-r--r--  1 root  wheel     225 May 18  2013 menuarrow.png
-rw-r--r--  1 root  wheel     262 May 18  2013 modal-cover.png
-rw-r--r--  1 root  wheel    3067 May 18  2013 netspinner.gif
-rw-r--r--  1 root  wheel    1995 May 18  2013 statwin.css
-rw-r--r--  1 root  wheel     761 May 18  2013 statwin.htm
-rw-r--r--  1 root  wheel    4192 May 18  2013 statwin.js
-rw-r--r--  1 root  wheel    2663 May 18  2013 tads.css
-rw-r--r--  1 root  wheel  168335 May 18  2013 util.js
-rw-r--r--  1 root  wheel    1092 May 18  2013 warningPopupBkg.gif
bash-3.2$ ls -ld /usr/local/share/frobtads/tads3/lib/webuires
drwxr-xr-x  39 root  wheel  1326 May 18  2013 /usr/local/share/frobtads/tads3/lib/webuires/

Hm, there might be a problem with the frobtads installer and the file permissions. Can you post the output of the following commands:

ls -l /usr
ls -l /usr/local
ls -l /usr/local/bin
ls -l /usr/local/share

Do you have a firewall active? If yes, try disabling it. It might be preventing the connection.

You can find the setting in the “Firewall” tab of the “Security & Privacy” section in the System Preferences.

I think that blank page could be result of not loading and thus not serving resource files such as html layout and client side javascripts. Firebug extension into a firefox browser (or similar extensions for other browsers) can show network tab, where you can see what files are requested from the server and whetever they are served successfully or 404 (or similar) error is returned instead.

If this is the case, it indicates some general problem reading resource files by frobtads - not only by compiler when bundling into resulting binary, but also at runtime.

All the directory permissions look fine to me:

bash-3.2$ ls -ld /usr
drwxr-xr-x@ 13 root  wheel  442 Jan 11 12:42 /usr/
bash-3.2$ ls -ld /usr/local
drwxrwxr-x  19 root  admin  646 May  5 17:53 /usr/local/
bash-3.2$ ls -ld /usr/local/bin
drwxr-xr-x  111 dorleans  admin  3774 Jun  6 22:01 /usr/local/bin/
bash-3.2$ ls -ld /usr/local/share
drwxr-xr-x  13 dorleans  admin  442 Jun  6 22:01 /usr/local/share/
bash-3.2$ ls -ld /usr/local/share/frobtads
drwxr-xr-x  4 root  wheel  136 Jun  6 22:01 /usr/local/share/frobtads/
bash-3.2$ ls -ld /usr/local/share/frobtads/tads3
drwxr-xr-x  6 root  wheel  204 Jun  6 22:01 /usr/local/share/frobtads/tads3/
bash-3.2$ ls -ld /usr/local/share/frobtads/tads3/lib
drwxr-xr-x  18 root  wheel  612 May 18  2013 /usr/local/share/frobtads/tads3/lib/
bash-3.2$ ls -ld /usr/local/share/frobtads/tads3/lib/webuires
drwxr-xr-x  39 root  wheel  1326 May 18  2013 /usr/local/share/frobtads/tads3/lib/webuires/

With the debug build, I get the same behavior whether I have the firewall turned on or off (I don’t think that should affect localhost URLs).

Thanks for the reminder to use the browser debugger: the blank page turns out to be a 404 error.

Looking at the frobtads source code, it sure seems to me like it’s trying to copy a file but it’s being given a directory:
github.com/realnc/frobtads/blob … n.cpp#L382
It seems to be getting the list of resource files from webui.tl:
github.com/realnc/frobtads/blob … b/webui.tl
but that only lists the directory. I don’t see any code that turns that “resource: webuires” line into a list of the files in that directory before it gets to add_resources, but I’m totally new to this code base so I’m sure I’m missing something…

Ah, found it. My guess is something is going wrong on this line when it’s trying to determine if webuires is a directory:
github.com/realnc/frobtads/blob … n.cpp#L486

On a lark, I tried replacing the “resource: webuires” line in webuires.tl with “resource: webuires/main.htm”, and it successfully linked! And I was able to connect to the server and got a non-blank error page (which is to be expected since I didn’t include all the resources).

Update: I’ve now added all the files in webuires as resource declarations, and I’m able to compile and play my game in web mode! This is enough to get me going on updating the game for web play, though I’m still pretty curious about what’s going wrong… Let me know if you need any more information to help diagnose it.

Is it reproducible with any other directory too? For example a directory in your own home directory?

You can test by adding something like the following to your makefile:

-res GameInfo.txt obj

It will try to add all object files from the “obj” directory.

If that actually works, then what about:

-res GameInfo.txt /usr/local/share/frobtads/tads3/lib/webuires

(Just to make sure this isn’t something specific to *.tl file parsing.)

The former works, but the latter doesn’t. So I guess it is something specific to the webuires directory. Very strange…

And if you copy the webuires directory into the game directory?

cp -a /usr/local/share/frobtads/tads3/lib/webuires .

And then include that:

-res webuires

Copying the webuires directory to the current directory works. However, if I chown the directory to root, it stops working, even though the directory is world-readable. This is also true if I chown it to other users, like nobody or mysql. Seems like it only works if the directory is owned by me.