安装 GOCR 时出错

安装 GOCR 时出错

当我尝试在 Ubuntu Linux 11.10 上安装 GOCR 时,我在终端中得到了以下读数

??????????:~$ cd gocr-0.48; make install
./configure
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether make sets $(MAKE)... yes
checking for library containing pnm_readpnminit... no
 * * * try option --with-netpbm=PATH
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for unistd.h... (cached) yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking for an ANSI C-conforming const... yes
checking for function prototypes... yes
checking whether setvbuf arguments are reversed... no
checking for wcschr... yes
checking for wcsdup... yes
checking for gettimeofday... yes
checking for popen... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating man/Makefile
config.status: creating include/config.h
make -C src install
make[1]: Entering directory `/home/drew/gocr-0.48/src'
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o pgm2asc.o pgm2asc.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o box.o box.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o database.o database.c
database.c: In function ‘ocr_db’:
database.c:411:10: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o detect.o detect.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o barcode.o barcode.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o lines.o lines.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o list.o list.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o ocr0.o ocr0.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o ocr0n.o ocr0n.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o ocr1.o ocr1.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o otsu.o otsu.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o output.o output.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o pixel.o pixel.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o unicode.o unicode.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o remove.o remove.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o pnm.o pnm.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o pcx.o pcx.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o progress.o progress.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o job.o job.c
gcc -g -O2  -I../include -DHAVE_CONFIG_H -c -o gocr.o gocr.c
# make it conform to ld --as-needed
#gcc -o gocr -lm  gocr.o ./libPgm2asc.a 
gcc -o gocr -lm  gocr.o pgm2asc.o box.o database.o detect.o barcode.o lines.o list.o ocr0.o ocr0n.o ocr1.o otsu.o output.o pixel.o unicode.o remove.o pnm.o pcx.o progress.o job.o 
if test -r gocr; then cp gocr ../bin; fi
#/usr/bin/install -c -d /usr/local/bin /usr/local /usr/local
/usr/bin/install -c -d /usr/local/bin
/usr/bin/install -c ../bin/gocr /usr/local/bin
/usr/bin/install: cannot create regular file `/usr/local/bin/gocr': Permission denied
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/drew/gocr-0.48/src'
make: *** [install] Error 2

有人能帮我解决这个问题吗?我在 10.04 中可以正常工作,谢谢 Drew

答案1

在 12.04 中,你可以从软件包(sudo apt-get install gocr或从软件中心)安装 GOCR。准备好的源也可以使用:

apt-get source gocr
cd gocr-0.49
dpkg-buildpackage -rfakeroot
cd ..
sudo dpkg -i gocr_0.49-1_*.deb

(如果您没有,dpkg-buildpackage您可以安装它sudo apt-get install build-essential:)

如果您需要从非 Ubuntu 源进行构建,通常在主目录中安装软件并正确设置路径会更容易、更安全,例如:

cd gocr-0.49
./configure --prefix=${HOME}
make all install
export PATH=${PATH}:${HOME}/bin
gocr

其他软件可能需要设置LD_LIBRARY_PATHPYTHONPATH等等。

答案2

cannot create regular file `/usr/local/bin/gocr': Permission denied

意味着它没有创建(或写入)文件的权限。 /usr/local/bin/由 root 所有,任何没有权限的标准用户(或桌面用户)都无法在那里创建文件。

尝试一下sudo

./configure然后先跑sudo make install

相关内容