Troubles with wkhtmltopdf - ruby-on-rails

Good day!, I hope someone has the answer to this question. I'm having troubles when trying to "convert" an html to pdf from a rails application, I've followed these steps: http://www.snikt.net/blog/2012/04/26/wicked-pdf/ with no luck, when I click the link it only changes the url from "http://localhost:3000/users/3" to "http://localhost:3000/users.3" with a blank page.
Then I read that you must configure a few things first, so I follow these steps: http://code.google.com/p/wkhtmltopdf/wiki/compilation, everything looks good until I reach the part with the "make && make install", here are the results:
cd src/lib/ && make -f Makefile
make[1]: Entering directory /home/username/wkhtmltopdf/src/lib'
make[1]: Nothing to be done forfirst'.
make[1]: Leaving directory /home/username/wkhtmltopdf/src/lib'
cd src/pdf/ && make -f Makefile
make[1]: Entering directory/home/username/wkhtmltopdf/src/pdf'
make[1]: Nothing to be done for first'.
make[1]: Leaving directory/home/username/wkhtmltopdf/src/pdf'
cd src/image/ && make -f Makefile
make[1]: Entering directory /home/username/wkhtmltopdf/src/image'
make[1]: Nothing to be done forfirst'.
make[1]: Leaving directory /home/username/wkhtmltopdf/src/image'
cd src/lib/ && make -f Makefile install
make[1]: Entering directory/home/username/wkhtmltopdf/src/lib'
mkdir: cannot create directory /include': Permission denied
make[1]: *** [install_headers] Error 1
make[1]: Leaving directory/home/username/wkhtmltopdf/src/lib'
make: * [sub-src-lib-install_subtargets-ordered] Error 2
As a note the command "wkhtmltopdf some_url my_pdf.pdf" does work, the issue is when trying to "convert" an html, from a rails application, to pdf.
I appreciate every single tip you can give because I'm trully lost. I'm sorry if it's a dumb question and for all the troubles, and thank you for your time.

Ok, just go through all of that, following this tutorial: http://blog.tcs.de/install-wkhtmltopdf-on-ubuntu-server/
Thank you guys for your time.

Related

Can't activate Lua-support in freeswitch

If activating Lua-Support in modules.conf, ./configure, make , install yields the following error:
*
making install mod_lua
make[4]: Entering directory '/home/jklou/jkl/fs/freeswitch-1.8.2/src/mod/languages/mod_lua'
CXX mod_lua_la-mod_lua.lo
mod_lua.cpp:37:17: fatal error: lua.h: 没有那个文件或目录
compilation terminated.
Makefile:687: recipe for target 'mod_lua_la-mod_lua.lo' failed
make[4]: *** [mod_lua_la-mod_lua.lo] Error 1
make[4]: Leaving directory '/home/jklou/jkl/fs/freeswitch-1.8.2/src/mod/languages/mod_lua'
Makefile:679: recipe for target 'mod_lua-install' failed
make[3]: *** [mod_lua-install] Error 1
make[3]: Leaving directory '/home/jklou/jkl/fs/freeswitch-1.8.2/src/mod'
Makefile:587: recipe for target 'install-recursive' failed
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory '/home/jklou/jkl/fs/freeswitch-1.8.2/src'
Makefile:3257: recipe for target 'install-recursive' failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory '/home/jklou/jkl/fs/freeswitch-1.8.2'
Makefile:3729: recipe for target 'install' failed
make: *** [install] Error 2
*
so Lua cannot be used.
Google: Several Forums advise to refresh the GIT-repository, but this cannot be used because I need an older Version of freeswitch
I've found a solution:
apt-get install libreadline-dev apt-get install lua5.2 lua5.2-doc liblua5.2-dev
then copy LUA-sh-files to LUA-mod-directory of Freeswitch:
cp /usr/include/lua5.2/*.h [Installationsverzeichnis Freeswitch]]/src/mod/languages/mod_lua/
then link it:
sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.2.so /usr/lib/x86_64-linux-gnu/liblua.so
then repeat make install (don't repeat ./configure and make)
sudo make install
this worked perfectly for me (Freeswitch 1.8.2. and Ubuntu 18.04 LTS running in Virtual Box)

compile libffi on openwrt fatal error: sys/xattr.h: No such file or directory

when i build libffi on a SDK forwarded by linkit smart 7688,the error comes out,and i couldnt find any help by search.
libattr/attr_copy_fd.c:25:24: fatal error: sys/xattr.h: No such file or directory
Config-build.in:12603:warning: defaults for choice values not supported
Config-build.in:12619:warning: defaults for choice values not supported
Config-build.in:14019:warning: defaults for choice values not supported
Config-build.in:14499:warning: defaults for choice values not supported
warning: (boost-libs-all) selects boost-coroutine2 which has unmet direct dependencies (PACKAGE_boost && !GCC_VERSION_4_8)
warning: (boost-libs-all) selects boost-coroutine2 which has unmet direct dependencies (PACKAGE_boost && !GCC_VERSION_4_8)
\#
\# configuration written to .config
\#
make[1]: Entering directory '/home/color/mt7688'
make[2]: Entering directory '/home/color/mt7688/feeds/packages/libs/glib2'
make[2]: Leaving directory '/home/color/mt7688/feeds/packages/libs/glib2'
make[1]: Leaving directory '/home/color/mt7688'
Config-build.in:12603:warning: defaults for choice values not supported
Config-build.in:12619:warning: defaults for choice values not supported
Config-build.in:14019:warning: defaults for choice values not supported
Config-build.in:14499:warning: defaults for choice values not supported
warning: (boost-libs-all) selects boost-coroutine2 which has unmet direct dependencies (PACKAGE_boost && !GCC_VERSION_4_8)
warning: (boost-libs-all) selects boost-coroutine2 which has unmet direct dependencies (PACKAGE_boost && !GCC_VERSION_4_8)
\#
\# configuration written to .config
\#
make[1]: Entering directory '/home/color/mt7688'
make[2]: Entering directory '/home/color/mt7688/feeds/packages/utils/attr'
CFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -I/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include -I/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/include -I/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include -I/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include " CXXFLAGS="-Os -pipe -mno-branch-likely -mips32r2 -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -I/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include -I/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/include -I/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include -I/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include " LDFLAGS="-L/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib -L/home/color/mt7688/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/lib -L/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/lib -L/home/color/mt7688/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib " make -j1 -C /home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915/. AR="mipsel-openwrt-linux-uclibc-gcc-ar" AS="ccache_cc -c -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kec -mdsp -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float" LD=mipsel-openwrt-linux-uclibc-ld NM="mipsel-openwrt-linux-uclibc-gcc-nm" CC="ccache_cc" GCC="ccache_cc" CXX="ccache_cxx" RANLIB="mipsel-openwrt-linux-uclibc-gcc-ranlib" STRIP=mipsel-openwrt-linux-uclibc-strip OBJCOPY=mipsel-openwrt-linux-uclibc-objcopy OBJDUMP=mipsel-openwrt-linux-uclibc-objdump SIZE=mipsel-openwrt-linux-uclibc-size CROSS="mipsel-openwrt-linux-uclibc-" ARCH="mipsel" ;
make[3]: Entering directory '/home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915'
CC libattr/libattr_la-attr_copy_fd.lo
****libattr/attr_copy_fd.c:25:24: fatal error: sys/xattr.h: No such file or directory
\# include <sys/xattr.h>
\^****
compilation terminated.
Makefile:929: recipe for target 'libattr/libattr_la-attr_copy_fd.lo' failed
make[3]: * [libattr/libattr_la-attr_copy_fd.lo] Error 1
make[3]: Leaving directory '/home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915'
Makefile:93: recipe for target '/home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915/.built' failed
make[2]: * [/home/color/mt7688/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/attr-20170915/.built] Error 2
make[2]: Leaving directory '/home/color/mt7688/feeds/packages/utils/attr'
package/Makefile:191: recipe for target 'package/feeds/packages/attr/compile' failed
make[1]: * [package/feeds/packages/attr/compile] Error 2
make[1]: Leaving directory '/home/color/mt7688'
/home/color/mt7688/include/toplevel.mk:174: recipe for target 'package/feeds/packages/glib2/compile' failed
make: * [package/feeds/packages/glib2/compile] Error 2
It seems the library you are looking for is not included in OpenWrt SDK by default.
Being this way you should look for it and add it manually. In my case I have the libraries inside the folder $ROOT_DIR/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include, so you should find and add mannualy xattr.h and move it to $ROOT_DIR/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/include/sys.

foreach & silencer in a makefile target

I am using a foreach in a makefile for a particular target.
my_Target:
$(foreach x,$(MY_TARGET_DIRS), #echo " BUILD $(x)";$(Q)$(MAKE) --directory=$(x) LIB_DIR=$(MY_LIB_DIR) $(MY_TARGET_RULES); )
This is intended call the makefiles contained every specified directory of MY_TARGET_DIRS, after a string has been printed to tell which build is ongoing.
The Q variable is defined as follows:
# Silent per default, 'make V=1' shows all compiler calls.
ifneq ($(V),1)
Q := #
endif
So that the make command is verbose if V=1 is defined.
For V=1 the output log is:
make my_Target V=1
BUILD /dir1
make[1]: Entering directory `/dir1'
make[1]: Nothing to be done for `elf'.
make[1]: Nothing to be done for `bin'.
make[1]: Leaving directory `/dir1'
/bin/sh: #echo: command not found
make[1]: Entering directory `/dir2'
make[1]: Nothing to be done for `elf'.
make[1]: Nothing to be done for `bin'.
make[1]: Leaving directory `/dir2'
While if I do not define V=1, the output log is:
make my_Target
BUILD /dir1
/bin/sh: #make: command not found
/bin/sh: #echo: command not found
/bin/sh: #make: command not found
make: *** [my_Target] Error 127
How can I get the behavior I desire correctly?
Bye!
Put the # ($(Q)) at the beginning of the recipe:
my_Target:
$(Q)$(foreach x,$(MY_TARGET_DIRS), echo " BUILD $(x)";$(MAKE) --directory=$(x) LIB_DIR=$(MY_LIB_DIR) $(MY_TARGET_RULES); )
Notice that the foreach will ouptut a single recipe line, and the # will apply to all of it. An alternative, if you want to get more fancy is to create a rule for each of the target dirs:
MY_TARGET_DIRS_TARGS=$(MY_TARGET_DIRS:%=%/.phony)
my_Target: $(MY_TARGET_DIRS_TARG)
$(MY_TARGET_DIRS_TARGS):
#echo " BUILD $(x)"
$(Q)(MAKE) --directory=$(x) LIB_DIR=$(MY_LIB_DIR) $(MY_TARGET_RULES);
.PHONY: $(MY_TARGET_DIRS_TARGS)

My package in OpenWRT does not compile

I have downloaded OpenWRT source from git and build it. I created a simple helloworld package with the required Makefile in package/helloworld directory and build it. But it does not seem to be doing anything. Following is the log:
sonal#sonal-ThinkPad:~/openwrt$ make V=99 package/helloworld/compile
WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!
make[1]: Entering directory '/home/sonal/openwrt'
make[2]: Entering directory '/home/sonal/openwrt/package/libs/toolchain'
if [ -f /home/sonal/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean ]; then rm -f /home/sonal/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install /home/sonal/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean; fi; echo "libc" >> /home/sonal/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install
if [ -f /home/sonal/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean ]; then rm -f /home/sonal/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install /home/sonal/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean; fi; echo "libgcc" >> /home/sonal/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install
make[2]: Leaving directory '/home/sonal/openwrt/package/libs/toolchain'
make[2]: Entering directory '/home/sonal/openwrt/package/helloworld'
make[2]: Leaving directory '/home/sonal/openwrt/package/helloworld'
make[1]: Leaving directory '/home/sonal/openwrt'`enter code here`
Thanks
Sonal
http://wiki.prplfoundation.org/wiki/Creating_an_OpenWrt_package_for_a_web_page
This above link will guide you how to build own package. I had also made own luci pages with above link. It will guide you from scratch.
If you want to create only hello world page then no need to create package, you just make new directory name as files in '/home/sonal/openwrt/'
and then go to files directory and make new directory as www in '/home/sonal/openwrt/files/'. No custom packages requires for it.

Failing to run hello-world example on sky tmote

I'm trying to run the hello-world example in contiki on a sky tmote. I'm using ubuntu and followed this tutorial: http://www.contiki-os.org/start.html#hardware
The first time I executed:
make TARGET=sky hello-world.upload
it worked fine but I got an error when executing:
make TARGET=sky login
../../tools/sky/serialdump-linux -b115200
make: execvp: ../../tools/sky/serialdump-linux: Permission denied
make: *** [login] Error 127
And now from now on every time I execute
make TARGET=sky hello-world.upload
I get the output from the tutorial (the note)
make z1-reset z1-upload
make[1]: Entering directory `/home/user/contiki/examples/hello-world'
make -k -j 20 z1-reset-sequence
make[2]: Entering directory `/home/user/contiki/examples/hello-world'
Done
make[2]: Leaving directory `/home/user/contiki/examples/hello-world'
make -j 20 z1-upload-sequence
make[2]: Entering directory `/home/user/contiki/examples/hello-world'
Done
make[2]: Leaving directory `/home/user/contiki/examples/hello-world'
make[1]: Leaving directory `/home/user/contiki/examples/hello-world'
rm hello-world.ihex
Before I once tried the instantcontiki with the VMPlayer and when this occured I just had to reconnect the sky mote again via a button in the VMPlayer, but since I'm not using it anymore I don't know what to do.
Also I couldn't figure out how to solve the Error 127 from above.
Greetings,
Jan
PS: I'm new to linux
Here is a solution which worked at me:
Find out at which USB is your tmote connected, e.g. USB0 and than just run:
sudo chmod 666 /dev/ttyUSB0
this phrase permission denied indicates that you are not the owner, ie. you are not the root
use sudo su,
give your password for the root
and repeat the code.
you will not find the error

Resources