X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:content-type:content-transfer-encoding :mime-version:from:to:subject:date:message-id; q=dns; s=default; b= anh2LtK8IoPXDa6k8PqvnpBoiaErWflejKWFB4jyjktY0ggEXytEWGq5K20N8/S4 nCC3oaVdl4eTXNognPWjENesgm603kahsbb8ISdeHgz579TkkBbTmSApJhg49wKO qWq9FN9OPwGtgcMZf5Oy3NpbkyD/W9f1bTEGvCPbD1Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:content-type:content-transfer-encoding :mime-version:from:to:subject:date:message-id; s=default; bh=lN+ ueSKoKnTMkA9rVvr0Q4VP5vg=; b=hpq++9JTabUl6zD4PkplWf2jVaTB4bWAbNt LygTIBpm9cEIdPR8tRhoc/d3pOKFvs1S6bdNb/X7kak1bI6Vp5oS84i/w3bZkJcm V/Qp99pqi9cKFLAu1dO+QLLCeAfUrteRv/PwNP75gAWinDAxCNm9z2iU7WBAyEbi i9DEht6E= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.1 required=5.0 tests=BAYES_50,FREEMAIL_FROM,LIKELY_SPAM_SUBJECT,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS,UNPARSEABLE_RELAY autolearn=no version=3.3.2 spammy=stared, 684, Edition, edition X-HELO: aibo.runbox.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline MIME-Version: 1.0 From: To: "cygwin" Subject: [bug] mingw64-*-w64-win-iconv: Cannot open handle; convert to UTF-8 Date: Sat, 12 Mar 2016 20:14:30 +0100 (CET) Message-Id: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u2CJErac025453 Hello, I'm writing because I'm encountering a strange bug in cygwin's distributed x86_64-w64-mingw32 libraries. Specifically a problem with win-iconv. -=System Info=- OS(s): Windows 7 Professional, Windows 10 Professional Edition Package(s): mingw64-{i686,x86_64}-win-iconv version: 0.0.6-2 Cygwin: Cygwin64, Setup 2.873 I first stared experiencing an issue with an SDL2 application I am developing. I've been revamping my build toolkit to take advantage of the better mingw64 support in newer releases of Cygwin. When I finally got my build system work with the host, build, target triplets, I decided to try building some mingw32 binaries of the application. Everything built fine, but for some reason the application always immediately quit upon being ran, with the following error message: "Fatal Error: Out of memory aborting". This happens even on a machine with 16GB of memory, 10GB of it being free. The i686 build as well as the x86_64 build encounters this issue as well. I downloaded the source code for mingw64-SDL2 and compiled it with debuginfo. I narrowed down the issue to some code in in SDL_windows_main.c, which calls SDL_iconv_string. Stepping into that function, the following executes: Breakpoint 2, SDL_iconv_string (tocode=0x4052bc <__dyn_tls_init_callback+684> "UTF-8", fromcode=0x4052ad <__dyn_tls_init_callback+669> "UCS-2-INTERNAL", inbuf=0x2e2dd2 "C", inbytesleft=116) at /usr/src/debug/mingw64-x86_64-SDL2-2.0.1-1/src/stdlib/SDL_iconv.c:863 863 size_t retCode = 0; 865 cd = SDL_iconv_open(tocode, fromcode); 866 if (cd == (SDL_iconv_t) - 1) { 868 if (!tocode || !*tocode) { 871 if (!fromcode || !*fromcode) { 874 cd = SDL_iconv_open(tocode, fromcode); 876 if (cd == (SDL_iconv_t) - 1) { 877 return NULL; WinMain (hInst=0x400000, hPrev=0x0, szCmdLine=0x2e3859 "", sw=10) at /usr/src/debug/mingw64-x86_64-SDL2-2.0.1-1/src/main/windows/SDL_windows_main.c:164 164 if (cmdline == NULL) { (gdb) 165 return OutOfMemory(); At first I thought it could be a bug with SDL, but to make sure, I created a very simple reproduction of the issue using only the iconv libraray, and a simple main() function. This "test" fails on every machine on which I have ran it, in both 32-bit and 64-bit builds. #include #include #include // Check GCC #if __GNUC__ #if __x86_64__ || __ppc64__ #define PTR_T int64_t #else #define PTR_T int32_t #endif #endif int main(int argc, char * args[]) { iconv_t handle = iconv_open("C", "UTF-8"); if ((PTR_T) handle == -1) { printf("Could not open handle to iconv"); } return 0; } I've uploaded a small repository with a Makefile that will conveniently set your $PATH correctly and launch the .exe when you run build the target 'run'. For your convenience in recreating the issue, I have uploaded the repository on github, at the following URL. git clone git://github.com/bittwiddler1/mingw64-iconv-test I've never really submitted a bug report via mailing list, but please let me know if you need any other information and I will try my best to help out any way I can! I'll try and get some debug information out of the iconv.dll library, but no promises. I don't know much about text encoding, let alone unicode pages and whatnot. :) - Saul Beniquez -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple