Old 03-24-2007, 02:18 PM   #1
Junior Member
 
Join Date: Mar 2007
Posts: 3
someone1 is on a distinguished road
Default how to install jscompact

Hey, i´ve searched and searched, but I can´t seem to find any tutorial on how to install jscompact!

I am running Ubunut 6.10, i used synaptic to install the libmozjsOd library (the spidermonkey libarary) but I don´t know where it installs to, and i can´t edit the make file for jscompact accordingly.

If any guidance as to how to build the spidermonkey libaray myself and setup jscompact to use it can be given, i´d REALLY apprecaite it, i´m currently trying to compress my own JS files
someone1 is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 03-31-2007, 01:30 AM   #2
Junior Member
 
Join Date: Mar 2007
Posts: 2
sukibabee is on a distinguished road
Default Re: how to install jscompact

I have the same problem - Ubuntu 6.10. I used Synaptic to install libmozjs-dev. You can use synaptic to show you the list of installed files, by simply right-click "Properties" -> "Installed Files" tab. You'll see the include files installed in /usr/include/mozjs and the library is /usr/lib/libmozjs.so.

so the make shell script for jscompact should read :

gcc -I/usr/include/mozjs/ -g -DXP_UNIX -L/usr/lib/ -lmozjs -Wall -ojscompact jscompact.c

but I get two build errors :

/tmp/js/jscompact-1.1.1/jscompact.c:190: undefined reference to `js_GetLocalVariable'
/tmp/js/jscompact-1.1.1/jscompact.c:190: undefined reference to `js_GetArgument'

looks like these are function references (function pointers). I separately downloaded the source code for libjs, and I see them referenced in the code. Perhaps Ubuntu's package is a variant? In any case, I can't seem to get libjs to compile either ... which is something the author of this site says was a challenge.

A tutorial is too hard. How about a compiled jscompact for i386? That'd make me happy.
sukibabee is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 03-31-2007, 02:13 AM   #3
Junior Member
 
Join Date: Mar 2007
Posts: 2
sukibabee is on a distinguished road
Default Re: how to install jscompact

I speak too soon... so I tried again to compile libjs, and succeeded.
This may not be that accurate .. but here goes (from memory) :

So you have downloaded jscompact01.1.1.tar.gz, and js-1.60.tar.gz, and unpacked them somewhere...

- first step is to compile js. You go to the ./js/src and try "make -f Makefile.ref"

- the first js compile issue I saw was a missing file. I created a ../../dist directory. But now I think this was just a warning. I don't think it helped.

- the second problem I encountered was actually a gcc internal error. The error I saw was this :

jscpucfg.c:374: internal compiler error: in dwarf2out_finish, at dwarf2out.c:14129
Please submit a full bug report,
with preprocessed source if appropriate.
...

I have Ubuntu 6.10 with all updates applied as of today, and it appears that gcc 4.1 itself choked. I went to Synaptic and installed the previous version, gcc 4.0 (and also had to manually change the /usr/bin/gcc symbolic link to /usr/bin/gcc-4.0 (just "cd /usr/bin" and "rm gcc", then "ln -s gcc-4.0 gcc") . After that, I tried to build js, and it worked.

- I had to modify the jscompact makefile to look like this ...

gcc -I/tmp/js/js/src/Linux_All_DBG.OBJ -I/tmp/js/js/src -g -DXP_UNIX -L/tmp/js/js/src/Linux_All_DBG.OBJ -ljs -Wall -ojsco
mpact jscompact.c

note that I compiled libjs in /tmp/js/js, so adjust as necessary. You need to reference include files in the src and src/Linux_All_DBG.OBJ, so I added another -I parameter. Also, I am now referencing libjs, so the -l (that's an l as in little) goes back to -ljs and the Linux_All_DBG.OBJ dir.

- I compiled jscompact, and it worked..

- in order to run jscompact, the libjs.so file (found in Linux_All_DBG.OBJ subdir) should be copied to /usr/lib

not exactly straight forward.... Any problems, post a comment - I will check it later. I will be happy to email the two files to you (jscompact and libjs.so).

here it is working ... ( I used stdin to test):

root@ubuntu:/tmp/js/jscompact-1.1.1# ./jscompact
function yo_yo(socks)
{
var hey_there = 1;
return "hey" + hey_there;
}

.. and it's output :

function yo_yo(b) {var a = 1;return "hey" + a;}


Cool!

Last edited by sukibabee : 03-31-2007 at 02:25 AM.
sukibabee is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 04-03-2007, 05:34 PM   #4
Junior Member
 
Join Date: Mar 2007
Posts: 3
someone1 is on a distinguished road
Default Re: how to install jscompact

Hey, thanks for the tut, i'll try it when i get a chance.

You seem very advanced, maybe your good enough to make all of that a one step process (make a deb package if you know how?)

If not, i totally understand, i'll post later with my attempts!
someone1 is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 04-04-2007, 10:39 AM   #5
Junior Member
 
Join Date: Mar 2007
Posts: 3
someone1 is on a distinguished road
Default Re: how to install jscompact

After attempting to compile spidermonkey, I noticed the gcc bug was not fixed by just downgrading gcc. To fix it, you have to edit the config.mk file, a tutorial on how to install spidermonkey on Ubuntu Edgy can be found here:
Compiling Spidermonkey under Ubuntu Edgy « thinksquared

After following sukibabee's tutorial (thankyou!) I managed to install jscompact with no more issues. Just to make it so jscompact can be run from the command line anywhere you want, after compling jscompact you will notice no error messages or any messages for that matter, just a file in that directory called jscompact, run the following to execute from anywhere:

sudo cp jscompact /bin/

worked like a charm for me!

Thanks again!
someone1 is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 10-18-2007, 07:31 AM   #6
Junior Member
 
Join Date: Oct 2007
Posts: 1
brin is on a distinguished road
Default Re: how to install jscompact

Hi, just thought I'd add that I've created a jscompact deb package which can be downloaded at deb package for jscompact
brin is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Old 10-18-2007, 10:34 AM   #7
Runs This Show
 
Steve's Avatar
 
Join Date: Dec 2006
Recent Blog: Where to Go From Here
Posts: 183
Steve has disabled reputation
Default Re: how to install jscompact

excellent! I know I don't want to go through that painful install again
Steve is offline  
Add Post to del.icio.usFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
If i want to install Movable type do i need Host... Soheil ® Webmaster 0 02-15-2007 05:20 AM


All times are GMT -7. The time now is 02:00 PM.