August 2011 Archives

libtool的一个问题

    libtools生成so的时候,发现在rhel5.3和fedora15下,结果竟然不一样,Makefile.am这样写道:
dydir    = $(bindir)/pwd
dy_PROGRAMS    = libdy.so
libdy_so_SOURCES = dy.cpp dy.h
libdy_so_CXXFLAGS = -fPIC
libdy_so_LDFLAGS = -shared -fpic

在fedora15下,这里面dy.cpp里面必须包括main函数,否则编译不过,而rhel5.3则没有这个问题,查了过程发现fedora15和rhel5.3的编译过程分别如下所示:
fedora15:
/bin/sh ../../../libtool --tag=CXX   --mode=link g++ -fPIC -g -O2 -shared -fpic  -o libdy.so libdy_so-dy.o 
libtool: link: g++ -fPIC -g -O2 -fpic -o libdy.so libdy_so-dy.o
/usr/lib/gcc/i686-redhat-linux/4.6.0/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status

rhel5.3
/bin/sh ../../../libtool --tag=CXX --mode=link g++  -g -O2   -o libdy.so -shared -fpic libdy_so-dy.o 

g++ -g -O2 -o libdy.so -shared -fpic libdy_so-dy.o
应该是libtool在fedora15上丢失了-shared参数所致,fedora15的libtool版本为2.4,而rhel5.3的libtool版本为1.5.22。

郁闷的SSH

    一般使用ssh -X连接到服务器,启动xclock,发现并没有窗口弹出,并提示错误信息:
Error: Can't open display:
    以为是Xserver的问题,比较环境变量DISPLAY以及Xorg的一些配置,也没有找到原因。
    后来想到以前俺博客当中应该有相关的资料,但忽略了ssh的服务器配置,其实解决的问题很简单,当想通过XServer显示服务器上的UI程序时,需要在ssh的时候加上-X参数外,还需要服务器的sshd支持远程的XServer,其/etc/ssh/ssh_config配置如下:
#    $OpenBSD: ssh_config,v 1.23 2007/06/08 04:40:40 pvalchev Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
#   ForwardAgent no
ForwardX11 yes
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
LogLevel error

Monthly Archives

Pages

Powered by Movable Type 7.7.2

About this Archive

This page is an archive of entries from August 2011 listed from newest to oldest.

July 2011 is the previous archive.

September 2011 is the next archive.

Find recent content on the main index or look in the archives to find all content.