fu7mu4’s diary

はてなダイアリーから移転しました。

port日記: gdb-7.5 へアップグレードに失敗したのでなんとかした

sudo port upgrade gdb

こんなこと言われちゃったんですけど...

Portfile changed since last build; discarding previous state.
---> Computing dependencies for gdb
---> Fetching archive for gdb
---> Attempting to fetch gdb-7.5_0.darwin_11.x86_64.tbz2 from http://packages.macports.org/gdb
---> Attempting to fetch gdb-7.5_0.darwin_11.x86_64.tbz2 from http://lil.fr.packages.macports.org/gdb
---> Attempting to fetch gdb-7.5_0.darwin_11.x86_64.tbz2 from http://mse.uk.packages.macports.org/sites/packages.macports.org/gdb
---> Fetching distfiles for gdb
---> Verifying checksum(s) for gdb
---> Extracting gdb
---> Configuring gdb
Error: gdb cannot be built while cctools-headers is active.
Error: Please deactivate cctools-headers and try again.
Error: You can reactivate cctools-headers again later.
Error: org.macports.configure for port gdb returned: cctools-headers is active
Please see the log file for port gdb for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_gdb/gdb/main.log
Error: Unable to upgrade port: 1
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets

これをなんとかしてアップグレードした方法のメモ。

とりあえず、無効化/アンインストール

sudo port deactivate cctools-headers

やってみたら、こうなる。

---> Deactivating cctools-headers @829_0
---> Unable to deactivate cctools-headers @829_0, the following ports depend on it:
---> cctools @829_1+llvm30
Error: org.macports.deactivate for port cctools-headers returned: Please uninstall the ports that depend on cctools-headers first.
Please see the log file for port cctools-headers for details:
/opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_cctools-headers_829_0/cctools-headers/main.log
Warning: Failed to execute portfile from registry for cctools-headers @829_0
---> Deactivating cctools-headers @829_0
---> Unable to deactivate cctools-headers @829_0, the following ports depend on it:
---> cctools @829_1+llvm30
Error: port deactivate failed: Please uninstall the ports that depend on cctools-headers first.

これの依存関係で cctoolsも外せとのこと。やってみた。

sudo port deactivate cctools

---> Deactivating cctools @829_1+llvm30
---> Unable to deactivate cctools @829_1+llvm30, the following ports depend on it:
---> apple-gcc42 @5666.3_9
Error: org.macports.deactivate for port cctools returned: Please uninstall the ports that depend on cctools first.
Please see the log file for port cctools for details:
/opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_cctools_829_1+llvm30/cctools/main.log
Warning: Failed to execute portfile from registry for cctools @829_1+llvm30
---> Deactivating cctools @829_1+llvm30
---> Unable to deactivate cctools @829_1+llvm30, the following ports depend on it:
---> apple-gcc42 @5666.3_9
Error: port deactivate failed: Please uninstall the ports that depend on cctools first.

ということなので、apple-gcc42と、cctoolsとcctools-headersをアンインストールしてみた。

sudo port uninstall apple-gcc42 @t666.3_9

とかを繰り返した。
それからもう一回、

sudo port upgrade gdb

してみたら、死んだ。

--> Computing dependencies for gdb
---> Configuring gdb
---> Building gdb
Error: org.macports.build for port gdb returned: command execution failed
Please see the log file for port gdb for details:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_gdb/gdb/main.log
Error: Unable to upgrade port: 1
To report a bug, follow the instructions in the guide:
http://guide.macports.org/#project.tickets

よくわからないんだけど死んだ。
どうしよう?

ログを見ると、ENUM_BITFIELDで引っかかってるみたいです。

info
build /usr/bin/clang -c -DHAVE_CONFIG_H -I. -I. -DRL_LIBRARY_VERSION='"6.2"' -pipe -O2 -I/opt/local/include -Wno-unused-value -arch x86_64 input.c
info
build input.c:424:13: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
info
build if (c = _rl_next_macro_key ())
info
build ~~^~~~~~~~~~~~~~~~~~~~~~~
info
build input.c:424:13: note: place parentheses around the assignment to silence this warning
info
build if (c = _rl_next_macro_key ())
info
build ^
info
build ( )Just a moment...
info
build ./symtab.h:596:31: error: expected ';' at end of declaration list
info
build ENUM_BITFIELD(address_class) aclass : 6;
info
build ^
info
build ;
info
build In file included from i386-tdep.c:30:
info
build In file included from ./inferior.h:37:
info
build In file included from ./breakpoint.h:23:
info
build In file included from ./value.h:488:
info
build ./gdbtypes.h:402:3: error: type name requires a specifier or qualifier
info
build ENUM_BITFIELD(type_code) code : 8;
info
build ^
info
build ./gdbtypes.h:402:3: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
info
build ENUM_BITFIELD(type_code) code : 8;
info
build ^~~~~~~~~~~~~
info
build ./gdbtypes.h:402:17: error: a parameter list without types is only allowed in a function definition
info
build ENUM_BITFIELD(type_code) code : 8;
info
build ^
info
build ./gdbtypes.h:402:27: error: expected ';' at end of declaration list
info
build ENUM_BITFIELD(type_code) code : 8;
info
build ^
info
build ; Wait a minute...
info
build ./symtab.h:341:37: error: expected ';' at end of declaration list
info
build ENUM_BITFIELD(minimal_symbol_type) type : 8;
info
build ^
info
build ;

「んー。なんだろう、ENUM_BITFIELDって? by clang」ということでしょうか??

公式のトラックに答がのってた。

公式のトラックにこういうのが載っていた。

Replying to mk@…: I suspect that the problem is that /opt/.../include is being included before ../include which is most likely using the (old) ansidecl.h from /opt/.../include which does not have the ENUM_BITFIELD macro which symtab.h is relying on. If this is what is causing the problem, you should be able to install after deactivating the offending package (sudo port deactivate gdb && sudo port install gdb).

どうやら古いバージョンのgdbのヘッダが、新しいバージョンのビルドを邪魔しているらしいので、(sudo port deactivate gdb && sudo port install gdb)すればいいらしい。

やってみた。

sudo port deactivate gdb
sudo port install gdb

やってみたらできた。