Showing posts with label cygwin. Show all posts
Showing posts with label cygwin. Show all posts

Thursday, May 28, 2009

Installing MySQL 5.4.0 on Cygwin

First of all, it was an installation from source.

./configure
make
make install

The commands above didn't work.

A try:
./configure
make
......
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -O3 -MT readline.o -MD -MP -MF .deps/readline.Tpo -c -o readline.o readline.c
In file included from readline.c:54:
readline/readline.h:70:29: sys/ttydefaults.h: No such file or directory

Cygwin provides no file named `sys/ttydefaults.h'. Someone said a copy from a *nix distribution would help.
I didn't try it 'cause MySQL provides an option to skip the bundled readline kindly.

Another try:
./configure --without-readline
make
......
g++ -DUNDEF_THREADS_HACK -DDEFAULT_MYSQL_HOME="\"/usr/local\"" -DDATADIR="\"/usr/local/var\"" -I. -I../include -I../include -I../include -I../regex -O3 -fno-implicit-templates -fno-exceptions -fno-rtti -MT mysql.o -MD -MP -MF .deps/mysql.Tpo -c -o mysql.o mysql.cc
mysql.cc:1030: error: redefinition of `struct _hist_entry'
../include/readline/readline.h:46: error: previous definition of `struct _hist_entry'
mysql.cc:1033: error: ISO C++ forbids declaration of `HIST_ENTRY' with no type
mysql.cc:1033: error: conflicting declaration 'typedef int HIST_ENTRY'

I have little knowledge about compiling, so what I can do is only to guess, change options and have another try.
However, I'm lucky! I found the problem is caused by the option `-O3', well, actually is the inner `-frename-registers'. To set CFLAGS=-O2 or CFLAGS=-fno-rename-registers can help. Also, gcc-4 seems ok. Maybe gcc-3 is the bad, I don't know.

My compiler, which is the latest default compiler on Cygwin.
$ gcc -V
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Yet another try:
./configure --without-readline CFLAGS=-O2
make
make install

Done.

P.S.1. The configure option `--with-plugin-partition' doesn't work. The MySQL guy said the issue is not repeatable with current development sources. So, just using `--with-plugins=partition' instead.

P.S.2. Cygwin is not supported for MySQL.(I didn't know that.)

Monday, November 19, 2007

Cygwin 环境下安装 Gtk2

这里的 Gtk2 是指 Perl 的 Gtk2 模块,Cygwin 环境下通过 CPAN 是无法直接安装的,需要修改了 Makefile.PL 之后手动安装。
--- Makefile.PL 2006/11/06 00:35:44 1.1
+++ Makefile.PL 2006/11/06 10:24:38
@@ -331,10 +331,6 @@

# this probably needs to go into ExtUtils::Depends.
sub find_extra_libs {
- # right now we need this terrible hack only for windows.
- # unfortunately, this code doesn't work on cygwin. :-/
- return "" unless $^O eq "MSWin32";
-
# win32 does not allow unresolved symbols in libraries, but
# Gtk2 uses on symbols in the dll created for Glib.
# so, we have to break all this nice abstraction and encapsulation
@@ -346,10 +342,19 @@
my $retstring = "";

use File::Find;
- find (sub {
- $retstring .= " ".$File::Find::name
- if /Glib.lib/i;
- }, @INC);
+
+ if ($^O eq "MSWin32") {
+ find (sub {
+ $retstring .= " ".$File::Find::name
+ if /Glib\.lib/i;
+ }, @INC);
+ } elsif ($^O eq "cygwin") {
+ find (sub {
+ $retstring .= " -L".$File::Find::dir
+ if /libGlib\.dll\.a/i;
+ }, @INC);
+ $retstring .= " -lGlib.dll" if ($retstring ne "");
+ }

return $retstring;
}

这是 Dirk Froemberg 向 Torsten Schoenfeld 提交的 patch,到现在为止还没有被合并进 source。

参考链接:
http://bugzilla.gnome.org

Tuesday, August 28, 2007

不好用的 Cygwin 的 vi

一直以为 Cygwin 的 vi 特别不好用,特别是在输入模式(i)下,小键盘的表现很奇怪。
其实,是自己太菜了,在主目录下建一个 vi 的配置文件就万事OK了。
islue@localhost ~
$ locate vimrc
/usr/share/vim/vim71/vimrc_example.vim

islue@localhost ~
$ cp /usr/share/vim/vim71/vimrc_example.vim .vimrc

Sunday, March 25, 2007

PuTTYcyg

PuTTYcgy,一个 PuTTY 的改版,可使用 PuTTY 作为本地 Cygwin 终端。

在这之前,我有两个选择。
Cygwin 的自带终端。缺点,主要是复制粘贴不方便,要同时用到鼠标和键盘。
Cygwin 的 X Term。缺点,本地要起 X Server,开销比较大。

说明一下 putty 的快捷方式的创建方法。

首先,打开 putty,修改好各项设置后保存,假设 Session 名为 cygwin。
然后,再创建一个 putty 的快捷方式,把“目标”设置为
\path\to\putty.exe -load "cygwin"

顺便提一下,hoekey 是个创建键盘快捷方式的好工具。

参考链接:
PuTTY - How can I create a Windows shortcut to start a particular saved session directly?

Tuesday, March 06, 2007

Cygwin 环境设置

一、使用和当前 Windows 登录用户不同的用户名

打开 /etc/passwd,找到标示当前 Windows 登录用户,即“自己”,的那行,修改用户名,即第一项。

二、自定义 HOME 环境

打开 /etc/passwd,找到标示“自己”的那行,修改 HOME 目录。
也可以通过设置名为 HOME 的 Windows 环境变量来实现,此设定优先级更高。但主要缺点是 ssh 命令只认 /etc/passwd,经常使用 ssh 的话还是得绕回来修改 /etc/passwd。

三、自定义 HOME 文件夹

1. 使用 ln 命令创建软链接
2. 使用 mount 命令或者直接修改注册表,举个例子
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/home]
"flags"=dword:0000000a
"native"="D:\\home"

参考链接:
Cygwin FAQ No.13 My Windows logon name has a space in it, will this cause problems?
Cygwin FAQ No.14 My HOME environment variable is not what I want.
Cygwin User's Guide - The Cygwin Mount Table