Mac OS X 10.6 下安装 GnuTLS
2016 年 6 月 2 日
<
div id=”content” contentScore=”749″>
安装环境:
- Mac OS X: 10.6.6
- Xcode: 3.2.5
- GnuTLS: 2.10.4
- Libgcrypt: 1.4.6
- Libgpg-error: 1.10
要成功编译GnuTLS必须先安装Libgcrypt,而要成功编译Libgcrypt又必须依赖Libgpg-error。所以必须按照Libgpg-error->Libgcrypt->GnuTLS的顺序进行安装。具体安装方法见各程序的INSTALL文档,以下是在安装过程中出现的问题以及解决方法。
对Libgcrypt进行make时会出现以下错误:
mpih-add1-asm.S:47:suffix or operands invalid for `push'
mpih-add1-asm.S:48:suffix or operands invalid for `push'
mpih-add1-asm.S:78:suffix or operands invalid for `jmp'
mpih-add1-asm.S:113:suffix or operands invalid for `pop'
mpih-add1-asm.S:114:suffix or operands invalid for `pop'
这个错误可通过在configure时增加可选项disable-asm来避免。
./configure --disable-asm
对GnuTLS进行make时会出现以下错误:
serv.c:515:41: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c: In function 'peer_print_info':
serv.c:515: error: '__darwin_obsz' undeclared (first use in this function)
serv.c:515: error: (Each undeclared identifier is reported only once
serv.c:515: error: for each function it appears in.)
serv.c:515: error: expected expression before ')' token
serv.c:515: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:517:37: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:517: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:518:31: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:518: error: expected expression before ')' token
serv.c:518: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:521:71: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:519: error: expected expression before ')' token
serv.c:519: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:533:51: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:533: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:545:49: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:544: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:553:49: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:552: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:562:43: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:560: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:570:43: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:568: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:581:8: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:579: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:590:78: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:590: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:596:70: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:596: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:601:68: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:601: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:606:63: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:606: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:611:60: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:611: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:619:8: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:618: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:623:54: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:623: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
serv.c:627:84: error: macro "__darwin_obsz" passed 2 arguments, but takes just 1
serv.c:627: warning: passing argument 3 of '__builtin___snprintf_chk' makes integer from pointer without a cast
这个错误是由于宏snprintf在Mac OS X 10.6下的不兼容造成的。解决方法是修改serv.c中的代码,将宏tmp2拆成两个宏。具体修改如下:
1. 先将tmp2的定义拆分为tmp2b和tmp2l。
-#define tmp2 &http_buffer[strlen(http_buffer)], len-strlen(http_buffer)
+#define tmp2b &http_buffer[strlen(http_buffer)]
+#define tmp2l len-strlen(http_buffer)
2. 接着将所有调用tmp2的地方替换为tmp2b, tmp2l。
参考文章:GnuTLS does not build on OS X 10.6 due to incompatibility with snprintf macro
以下是原文中关于错误及解决方法的描述:
Code built with gcc on Mac OS X 10.6 uses the object size checking feature of gcc by default. This involves redefining
several functions as macros; one of these functions is snprintf:
#define snprintf(str, len, ...) \
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
The usage of snprintf in src/serv.c in gnutls-2.10.4 is not compatible with that macro. serv.c attempts to
use a macro (tmp2) that expands into two different arguments:
#define tmp2 &http_buffer[strlen(http_buffer)], len-strlen(http_buffer)
snprintf (tmp2, "%.2X", sesid[i]);
Due to how nested macro evaluation works, the snprintf macro sees tmp2 as a single argument, and copies it
into __darwin_obsz(); then, when tmp2 is expanded, __darwin_obsz has two arguments, but it is only
defined for one, and the result is a compilation error.
One way to work around this issue might be to define _FORTIFY_SOURCE=0 so that the snprintf macro is not
defined, or simply doing an #undef snprintf for that file, but it seems safer and more portable to split
tmp2 into two macros. I append a patch that does so.
GnuTLS 的详细介绍:<a title=”GnuTLS” href=”../../Linux/2
15 Comments
Zithromax Safe For Children [url=http://drugsed.com][/url] Phizer Viagra For Sale Cialis Kamagra Bestellen
Keflex Seismic Loop Worked For Me Propecia Finasteride Hq Canadiand Meds [url=http://orderviapills.com]viagra[/url] Propecia Pelo
Generic Amoxil Effet Cialis Amoxicillin Need Perscription [url=http://nefoc.com]propecia tinnitus hair loss[/url] Viagra Advertised On The Radio Propecia Sale Online Uk Propecia Current Dosage
Cialis In Der Apotheke [url=http://buycheapcial.com]buy generic cialis online[/url] Cialis Lontano Dai Pasti Propecia Nioxin Scalp Therapy Buy Zithromax For Cats
Generic Viagra Vega Sildenafil Citrate Achat Cialis Generic Levitra Bayer Generico [url=http://propecorder.com]propecia 1mg[/url] Cialis Soft Prezzo
Propecia Embarazo Efectos Secundarios Price Of Viagra In Mexico [url=http://buycialcheap.com]cialis 20mg for sale[/url] Canadia Pharmacy Cialis
Cephalexin Open Capsule Sprinkle Nebenwirkungen Viagra Ohne Rezept [url=http://cialviag.com]cialis 20mg for sale[/url] Buy Alli Orlistat Online Us Pharmacy buy generic accutane online
Can I Purchase Pyridium No Physician Approval On Line [url=http://yafoc.com]propecia tasacion[/url] Kamagra Similar
Propecia Dha Clomid Association Generique Viagra Soft [url=http://gemeds.com]kamagra alcorcon[/url] Cialis Lilly Rezeptfrei Children Urine Tract Infection Amoxicillin Cialis Generic On Line
Ios Amoxicillin Available In A Patch Viagra Al Supermercato [url=http://howtogetvia.com]buy viagra online[/url] Acheter Acyclovir 800 Mg Levitra Preis 10 Mg Cialis Unam
Methylprednisolone Urinary Infection No Prescription Needed Cealis Cialis Was Beachten [url=http://genericcial.com]buy cialis online[/url] Viagra 50 Ou 100 Mg
Viagra Generika Information isotretinoin discount fedex shipping Glasgow Acheter Du Cialis Sur Internet [url=http://ciali20mg.com]cheapest cialis 20mg[/url] Indocin Priligy Generique Bentyl Website Without Perscription
Proviron Amoxicillin In Dogs Viagra Superactive Plus [url=http://drugsir.com]cheapest cialis[/url] Keflex Effects Urination Online Propecia Male Pattern Hair Loss Levlen Tri Regol
247 Drugs Shop Reviews [url=http://aaost.com]generic cialis overnight delivery[/url] Cialis Generico PreР С–Р’В§o Propecia Funcion Online Pharmacies Without Prescription
Acquista Viagra On Line Achat Lioresal En Canada El Viagra Cubano [url=http://cdeine.com]viagra[/url] Buy Viagra Dapoxetine Online Plavix Levitra Kamagra Billig Online Bestellen