[Cs-dev] Cross-Compile Windows 64-bit - Update
Date | 2013-11-19 18:35 |
From | Steven Yi |
Subject | [Cs-dev] Cross-Compile Windows 64-bit - Update |
Hi All, I did some work on cross-compiling Windows 64-bit from Linux (Debian). I've pushed a commit of a mingw64-linux folder. In it is a README.md that should explain the steps I took (can view it here http://sourceforge.net/p/csound/csound6-git/ci/develop/tree/mingw64-linux/). To note, I've re-purposing the dependency scripts I wrote to auto download and build dependencies for win64. I made it through pthreads, portaudio, ogg, vorbis, flac, and sndfile. I figured that was enough to get to building Csound. The build.sh script then configures and builds Csound. As it is, the build currently errors in server.c. I think it's a legitimate error: [ 1%] Building C object CMakeFiles/csound64.dir/Top/server.c.obj /home/steven/csound/csound6/Top/server.c: In function ‘UDPServerClose’: /home/steven/csound/csound6/Top/server.c:112:5: error: incompatible type for argument 1 of ‘pthread_join’ /home/steven/mingw64/usr/local/include/pthread.h:952:31: note: expected ‘pthread_t’ but argument is of type ‘void *’ make[2]: *** [CMakeFiles/csound64.dir/Top/server.c.obj] Error 1 make[1]: *** [CMakeFiles/csound64.dir/all] Error 2 make: *** [all] Error 2 I have not looked at this yet, but if it is a legitimate error, then I think we can consider this research a success in terms of helping us to build Csound for Windows and catch Windows related bugs more easily. If you're on Debian and give this a try, please let me know any feedback. I will continue to spend a little time each day on this to get further with dependencies and building out more of Csound. It also looks like NSIS installer can be run on Linux (from the NSIS Page): Portable Compiler The NSIS compiler can be compiled for POSIX platforms like Linux and *BSD. Generated installer will still run on Windows only, but this way they can be generated without Windows or WINE. Maybe we can all just move to Linux and have a sane development environment. :) Thanks! steven ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-11-19 18:44 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
BTW: the server.c issue was a simple bug. I swapped in csoundJoinThread instead of pthread_join as the original thread was created with csoundThreadCreate. On Tue, Nov 19, 2013 at 1:35 PM, Steven Yi |
Date | 2013-11-19 18:57 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Attachments | None None |
Windows pthread_t changed not too long ago. It used to be: /* * Generic handle type - intended to extend uniqueness beyond * that available with a simple pointer. It should scale for either * IA-32 or IA-64. */ typedef struct { void * p; /* Pointer to actual object */ unsigned int x; /* Extra information - reuse count etc */ } ptw32_handle_t; typedef ptw32_handle_t pthread_t; ...two elements in a struct. Now, for mingw-builds 32 bits posix threads dwarf2 exception handling version 4.8.1 used to build the Windows installers, it is (note, an earlier declaration commented out):
/* struct _pthread_v;
typedef struct pthread_t { struct _pthread_v *p; int x; } pthread_t; */ typedef uintptr_t pthread_t; NOTA BENE: Declarations and types of pthread_t will differ with versions of gcc, architecture of gcc, etc. Your cross compiler will have a pthread.h, look at it to see what is really happening. Additional #ifdefs for building in Csound sources may be required, or maybe you need to get the right version of your cross compiler.
Hope this helps, Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Tue, Nov 19, 2013 at 1:35 PM, Steven Yi <stevenyi@gmail.com> wrote: Hi All, |
Date | 2013-11-19 19:03 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Hi Michael, No worries, the csoundJoinThread fixed that. I am running into a new issue though and it's worrying. It has to do with AlwaysOn opcode: /home/steven/csound/csound6/Opcodes/signalflowgraph.cpp:1028:46: error: type/value mismatch at argument 1 in template parameter list for ‘template |
Date | 2013-11-19 19:10 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Attachments | None None |
Couldn't we just enclose the code in a namespace? Best, On Nov 19, 2013 2:04 PM, "Steven Yi" <stevenyi@gmail.com> wrote:
Hi Michael, |
Date | 2013-11-19 19:15 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Attachments | None None |
That should work. I'll try it shortly when I get to a coffee shop. On Nov 19, 2013 2:11 PM, "Michael Gogins" <michael.gogins@gmail.com> wrote:
|
Date | 2013-11-19 19:25 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
That seems to have worked (I enclosed it in namespace csound). Thanks, now off to figure out some linking issues for other things. :) On Tue, Nov 19, 2013 at 2:15 PM, Steven Yi |
Date | 2013-11-19 19:33 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
This looks like an excellent idea. I hope it works. We’ll still have to get someone to test it on Windows ;). On 19 Nov 2013, at 18:35, Steven Yi |
Date | 2013-11-19 19:40 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
I'm not sure what kind of jiggery-pokery at your at Steven but it sounds great. Building Windows software on Linux, I had no idea that this was possible. Pardon my ignorance, but do you have to build all the dependencies too? On 19 November 2013 20:33, Victor Lazzarini |
Date | 2013-11-19 20:14 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
yes, he did. Victor On 19 Nov 2013, at 19:40, Rory Walsh |
Date | 2013-11-19 20:34 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Cool. I look forward to seeing how it works out. On 19 November 2013 21:14, Victor Lazzarini |
Date | 2013-11-19 21:11 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
;) I just got through an issue with CppSound.cpp. This code: long CppSound::getThis() { return (long) this; } was giving: cd /home/steven/csound/csound6/mingw64-linux/csound-mingw64/interfaces && /usr/bin/x86_64-w64-mingw32-g++ -Dlibcsnd6_EXPORTS -DUSE_DOUBLE -D_CSOUND_RELEASE_ -DWIN32 -ffast-math -mfpmath=sse -msse2 -fomit-frame-pointer @CMakeFiles/libcsnd6.dir/includes_CXX.rsp -Wno-format -o CMakeFiles/libcsnd6.dir/CppSound.cpp.obj -c /home/steven/csound/csound6/interfaces/CppSound.cpp /home/steven/csound/csound6/interfaces/CppSound.cpp: In member function ‘virtual long int CppSound::getThis()’: /home/steven/csound/csound6/interfaces/CppSound.cpp:185:17: error: cast from ‘CppSound*’ to ‘long int’ loses precision [-fpermissive] make[2]: *** [interfaces/CMakeFiles/libcsnd6.dir/CppSound.cpp.obj] Error 1 make[2]: Leaving directory `/home/steven/csound/csound6/mingw64-linux/csound-mingw64' make[1]: *** [interfaces/CMakeFiles/libcsnd6.dir/all] Error 2 make[1]: Leaving directory `/home/steven/csound/csound6/mingw64-linux/csound-mingw64' make: *** [all] Error 2 I've added -fpermissive as was mentioned in the error and that got through it, but I'm wondering if that code shouldn't be changed. For now though... I've gotten through a compile! Could someone with Windows 64-bit try this build: https://www.dropbox.com/s/jty3i0c8sbhikdu/csound-6.0.0-win32.zip Also to note, I'm planning on making an update of where the built dependencies go into a folder that is within the csound6/mingw64-linux folder. That should make the system self-contained and remove the manual config editing that's currently there for /home/steven/mingw64. Thanks! steven On Tue, Nov 19, 2013 at 2:33 PM, Victor Lazzarini |
Date | 2013-11-19 21:12 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Yes, you'll need to build dependencies. I'm setting things up to automate everything though. The end goal is a completely automated and reproducible build that anyone can do using just a few scripts. On Tue, Nov 19, 2013 at 2:40 PM, Rory Walsh |
Date | 2013-11-19 21:14 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Oh, I just realized I did not zip up the dependent libraries. I will have to try that later (the wifi at this cafe is pretty slow and it took some 20 minutes just to get those 3 megs uploaded. :P ) On Tue, Nov 19, 2013 at 4:11 PM, Steven Yi |
Date | 2013-11-19 21:15 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Attachments | None None |
Is this only possible for 64bit arch? sent from a mobile device... On 19 Nov 2013 21:13, "Steven Yi" <stevenyi@gmail.com> wrote:
Yes, you'll need to build dependencies. I'm setting things up to |
Date | 2013-11-19 21:29 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Cross-compiling? No, you can build to i686 too for win32 builds. I'm just focusing on the one for now. After a setup is done, the scripts can be copied and setup for win32. I think you also need to install a separate set of mingw packages from apt too. On Tue, Nov 19, 2013 at 4:15 PM, Rory Walsh |
Date | 2013-11-19 21:38 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Attachments | None None |
You can tell if we need to change this code by writing a test program that prints sizeof(this) and sizeof(long) and if long won't hold this, then it has to be changed. Best,
Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Tue, Nov 19, 2013 at 4:11 PM, Steven Yi <stevenyi@gmail.com> wrote: ;) |
Date | 2013-11-19 23:22 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Well the error reports that the sizes don't match. The code in question though, I have no idea who is using it and for what. I assume you would know as it's in CsoundAC, and that you would know if it is safe to change to a different size. Since I don't know if you're using it or how, I'm not going to touch that code as I don't want to break anything you may be using it for. On Tue, Nov 19, 2013 at 4:38 PM, Michael Gogins |
Date | 2013-11-19 23:31 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Attachments | None None |
It is safe if sizeof(long) >= sizeof(this). What are the sizes? Yes, this code is used in various places in CsoundAC and its wrappers. There would be a way to typecast it using a union
union caster_t { } Best, Mike -----------------------------------------------------
Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Tue, Nov 19, 2013 at 6:22 PM, Steven Yi <stevenyi@gmail.com> wrote: Well the error reports that the sizes don't match. The code in |
Date | 2013-11-19 23:37 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Attachments | None None |
It is safe if sizeof(long) >= sizeof(this). What are the sizes?
Yes, this code is used in various places in CsoundAC and its wrappers. There would be a way to typecast it using a union
union caster_t { void * pointer;
double biggie; } Best,
Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Tue, Nov 19, 2013 at 6:31 PM, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2013-11-20 00:44 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
I'm not sure of the sizes, but the message says: /home/steven/csound/csound6/interfaces/CppSound.cpp:185:17: error: cast from ‘CppSound*’ to ‘long int’ loses precision which I assume to mean that long int is < sizeof(this). This link: http://technet.microsoft.com/en-us/library/bb496995.aspx mentions: "In Win64, the size of the pointers is 64 bits; and in Win32, it is 32 bits. A new set of data types is also defined in Win64 to write cleaner code. In the Win32 API, data types long and pointers were of the same size, so data types such as DWORD and pointers could be used interchangeably and could also be used to typecast from one to another. The same code in Win64 would lead to errors because in the Win64 API, long is 32 bits while pointer is 64 bits." So that'd explain it. If changing to int64 or something like that works for you, then I imagine that'd work here. ==== In other news, I have modified the scripts to all build dependencies into csound6/mingw64-linux/mingw64. This means no hand editing required now for any of the scripts, so you should be able to run it out of the box and produce the same build I've got here. One thing I'm seeing is that the "make install" of the build-deps.sh installed the .dll.a but not the .dll into the mingw64/usr/local/lib folder. Linking goes fine, but the installer might be a bit of a pain to figure out. I'm hoping I just missed something simple in terms of passing something to configure for each of those projects. On Tue, Nov 19, 2013 at 6:37 PM, Michael Gogins |
Date | 2013-11-20 02:29 |
From | Michael Gogins |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Attachments | None None |
It purely and literally depends on there size of int64. If it is equal to or greater than the size of void * then it is fine. If not, we need to do something else. I believe that in64 would work, but intptr_t should probably be used. The following link is Microsoft's instructions for such casts. These should be adaptable to MinGW's intptr_t. ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Tue, Nov 19, 2013 at 7:44 PM, Steven Yi <stevenyi@gmail.com> wrote:
|
Date | 2013-11-20 12:07 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Let me know when the zip is good to try out. I've just done a fresh install of windows so it should provide a good test case. On 20 November 2013 02:29, Michael Gogins |
Date | 2013-11-20 13:56 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Hi Rory, Could you try this one: http://www.kunstmusik.com/csound-w64.zip You'll have to set OPCODE6DIR64 to point to the lib/csound/plugins64-6.0 folder. Thanks! steven On Wed, Nov 20, 2013 at 7:07 AM, Rory Walsh |
Date | 2013-11-20 14:31 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Well I'll be! Seems to work fine Steven, and only 6Mbs. It would be nice to offer this as a minimal/portable Csound for windows. On 20 November 2013 13:56, Steven Yi |
Date | 2013-11-20 15:03 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Nice! Thanks for testing that! I'll continue to add more to the build. Eventually I'd like to be able to build everything Michael has been building, including installer. I'll have to see about downloading windows version of python and java for building the interfaces. For the interim, I need to either rebuild my VM with more hard drive space or grow the VM hd size (last time i tried that it wasn't pretty :P ). BTW: Sort of wacky, I'm on OSX, running Debian in a VM, and cross-compiling for Windows. I'm in the Matrix! ;) On Wed, Nov 20, 2013 at 9:31 AM, Rory Walsh |
Date | 2013-11-20 15:14 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
Don't follow the white rabbit! We've lost too many good men that way! Are you planning to add this to the cmake config so that users on Linux can create minimal builds for Windows? I'd find this very useful. I'm just about to see if I can create a host app using mingw that links to your libraries. Fingers crossed. On 20 November 2013 15:03, Steven Yi |
Date | 2013-11-20 15:24 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
My optimism was short lived. I get a load of undefined reference errors. It's as if the library is invisible. On 20 November 2013 15:14, Rory Walsh |
Date | 2013-11-20 15:27 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
All you need to do is go into the mingw64-linux folder and read the README.md. :) It tells you the steps to do your own build. Just a few scripts to run and you should be done. On Wed, Nov 20, 2013 at 10:14 AM, Rory Walsh |
Date | 2013-11-20 15:28 |
From | Steven Yi |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
What are the errors? Are you compiling for x86_64? (w64, or 64-bit windows) On Wed, Nov 20, 2013 at 10:24 AM, Rory Walsh |
Date | 2013-11-20 15:36 |
From | Rory Walsh |
Subject | Re: [Cs-dev] Cross-Compile Windows 64-bit - Update |
I'm on win64 but I'm most likely building for win32. Let me know when you get around to a win32 build! On 20 November 2013 15:28, Steven Yi |