HP Forums
[WP34S] Problem Running wp34s_lib.pl in Mac OS X - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: [WP34S] Problem Running wp34s_lib.pl in Mac OS X (/thread-215047.html)



[WP34S] Problem Running wp34s_lib.pl in Mac OS X - Les Wright - 03-21-2012

I am having problems getting wp34s_lib.pl to work in Terminal under OS X. Here is the error that gets thrown when I try to create a library file from a simple text listing:

Leslie-Wrights-Improved-iMac:tools lesliewright$ ./wp34s_lib.pl lib1.txt -olib wp34s-lib.dat
Creating olib 'wp34s-lib.dat' from scratch.
Can't exec "wp34s_asm.pl": No such file or directory at ./wp34s_lib.pl line 819.
Can't exec "wp34s_asm.pl": No such file or directory at ./wp34s_lib.pl line 819.
ERROR: wp34s_lib.pl::split_END: Likely the assembler run failed. Halting wp34s_lib.pl.

The analogous command at the Windows XP command line using the EXE equivalent produces the correct output.

The "bug" seems to be that the script calls wp34s_asm.pl but can't find it, even though it lives in the same directory. However, when I call the assembler script directly using ./wp34s_asm.pl, files get assembled and disassembled just fine.

I am pretty much a novice when it comes to running Perl scripts in a Linux/Unix type of environment, so if I can get some guidance from anyone who knows how to correctly run this command, I would be grateful. I am sure that Linux users run it fine as is, so it is something I am doing in the Mac environment, not the script itself.

Les


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Marcus von Cube, Germany - 03-21-2012

Try to set the $PATH variable to the directory the perl scripts exist. To be precise, add the directory to the PATH.


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Les Wright - 03-21-2012

Marcus, I am such a noob I have to confess I have no idea how to do that.

I am googling, but so far not fruitful...




Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Les Wright - 03-21-2012

Marcus, there seems to be some vagueness on how to add to $PATH in OS X Lion. Instead, used echo $PATH to see what folders are there and used a favourite utility called EasyFind to locate /usr/bin and drop the three perl scripts into that folder along with wp34s.op.

I know this is probably NOT ideal, but I did get it to work.

If any OS X Lion users out there have figured out how to change or extend the $PATH variable, I'd be much obliged.

Les


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Neil Hamilton (Ottawa) - 03-21-2012

Les,

I answered this a few hours ago but it seems to have gone into the moderated-ether... maybe it will return someday. (Apparently you do not allow anyone to send you back-channel mail either.)

The problem is that you need to have your current directory in your path. Unlike DOS/Windows, Unix-style shells (bash, csh, tcsh, sh, etc.) do not look in the current directory but solely access these through the path. DOS/Windows first starts in your current directory and then tries the path if it wasn't found.

This is the reason you had to type the "./" in front of the command in your example of running the ASM by itself.

Depending on your shell, add the following:

(bash type shells)
$ export PATH=./:${PATH}

(csh type shells)
% setenv PATH "./:${PATH}"

Let me know if that works. Ideally, you should have this set in your login script.


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Egan Ford - 03-21-2012

Are you running from the shell (Terminal)? If so type:

export PATH=$PATH:/path/to/wpstuff
If you want that to stick then put that command in your .bash_common.

Type:

open /Applications/TextEdit.app .bash_common
Then make sure you exit Terminal and relaunch. To test type:
echo $PATH

Edited: 21 Mar 2012, 6:11 p.m.


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Les Wright - 03-21-2012

Thanks for your help, Egan (as well as Neil below).

Unfortunately, I don't have a .bash_common file. I've looked!

The use of the "export" command here does what it should.

So far, I am not having any issue with storing those four small files in /usr/bin until I can figure out how, in my setup, I permanently extend $PATH.

Les


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Egan Ford - 03-21-2012

Can you run this command for me from Terminal:

ls -la $HOME/.bash*
If you have a .bashrc, then use that.


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Les Wright - 03-21-2012

Only file found with that is .bash_history.

Weird.

Edited: 22 Mar 2012, 12:02 a.m.


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Les Wright - 03-22-2012

Egan, I solved the problem by simply creating .bash_profile in my home directory de novo. It has the single line in it:

export PATH = $PATH:$HOME/wp34s

Close shell and Terminal, then restart Terminal, type echo $PATH, and my wp34s directory is there. I will put the perl scripts, my text listings and library files, and various emulator state and flash files (wp34s.dat, wp34s-backup.dat, and wp34s-lib.dat) and work entirely within that directory.

Thanks for the direction. Now, except for the flashing, I can do all of my wp34s work directly in the Mac environment.

Les

Edited: 22 Mar 2012, 12:38 p.m. after one or more responses were posted


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Egan Ford - 03-22-2012

That was going to be my next suggestion, i.e. create .bashrc or .bash_profile or .profile.

I posted here in the past how to flash from OS/X using wine. The trouble is that you have to install wine. If you have Xcode installed, then you can install Macports and after that you can type "sudo port install wine".

Now that you have Xcode installed you can starting porting WP34S to the iPhone. :-)


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - pascal_meheut - 03-22-2012

Quote:
Now that you have Xcode installed you can starting porting WP34S to the iPhone. :-)

There is a plan for that too. Porting to Android would be easier though.


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - John Abbott (S. Africa) - 03-22-2012

Yes please!! That would be great.


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - pascal_meheut - 03-22-2012

Quote:
Yes please!! That would be great.

Well, the multi-platform flashing tool is working and should soon be over. Then comes a debugger and a few other improvements to the emulator.

And then I hope to have time to work on an iPhone/iPad version.


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Paul Dale - 03-22-2012

No chance, we'll be on to the 43S by then :-)


- Pauli


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - pascal_meheut - 03-22-2012

Quote:
No chance, we'll be on to the 43S by then :-)

- Pauli


Waiting for it.


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Les Wright - 03-22-2012

Quote:
Are you running from the shell (Terminal)? If so type:

Type:

open /Applications/TextEdit.app .bash_common


Hey, Egan, I am no Unix/Linux guru, but I am proud to share that I found an error in this. The command should be

open -a /Applications/TextEdit.app .bash_common

or, even more simply,

open -e .bash_common

In the Mac OS X implementation, the -e switch is simply a shortcut for "-a /Applications/TextEdit.app".

For noobs like me who are curious, I created my single line .bash_profile file from the command line with


echo "export PATH=$PATH:$HOME/wp34s" >> .bash_profile

then had to run


chmod 777 .bash_profile

to ensure the script was executed when a fresh Terminal window started up in the bash shell.

(Of course, other users may elect to keep the wp34s perl scripts elsewhere--I just happen to choose /Users/[myusername]/wp34s.)

Since, I have been very happily assembling and disassembling wp34s library files without having to leave the OS X environment.

Unfortunately, I cannot get the new Mac flashing tool to work, even though I prep the calc exactly as I do with MySamba. I know that my Mac detects my FTDI converter just fine since I have successfully moved material back and forth between the calc and Mac emulator over my USB-serial connection. Will seek out Pascal's direction. Fortunately, MySamba on Win XP in Fusion still works like a charm.

Les


Re: [WP34S] Problem Running wp34s_lib.pl in Mac OS X - Egan Ford - 03-23-2012

I didn't know about -e, I actually use vi, but I didn't want to have to explain how to use a terminal-based editor.

You should not need to chmod 777 .bash_profile. It is not executed when /bin/bash starts on login. It's read after bash starts and interrupted. So chmod 777 is not needed. The expected settings are 644. Hopefully Lion did not change that.

As for the "echo", in time you'll want your .bash_profile a bit more organized, I find it best to edit it.