How to build OpenSSL for WP8? - windows-phone-8

How to build OpenSSL for WP8?
AFAIK, we must replace winsock.h by winsock2.h because WP8 only supports winsock2.h. And maybe we must replaces code to target WinRT architecture on WP8 (ThreadPool, ...)
The caveat is that we must build OpenSSL as WP8 static library, so that the output lib can be wrapped by WP8 runtime component, right ?

You can use the Microsoft openssl fork on github with support for windows phone 8.1/8.0 and Windows Store 8.1, that address the entropy on each platform using windows random generators, instructions are located at INSTALL.WINAPP, there is a script located at
ms\do_vsprojects.bat
you should be able to just execute that script withing the root location and open vsout\openssl.sln to build the openssl libraries for different windows platforms.
The fork is located at
https://github.com/microsoft/openssl
At this momment these changes are being in process to be integrated with the main OpenSSL source code base.

here is what you have to do, go to this link and download the VSbuild, now put that into the source files downloaded from the OpenSSL website, the folder structure should look like this:
apps
bugs
certs
.....
vsbuild
once that is done, open the solution, it should upgrade it to VS12, change the settings to a Windows Phone RT build, to generate DLL's there is no need to build *_lib*, so change the other projects, most changes you need to do are to libeay32, do not compile openssl project, just ignore that, start by building libeay32, and start making changes to the code, as there are some functions we don't have in WinRT, you can either #ifdef them out, or create your own functions,
NOTE for rand_win.c change the functions to use rand_s and #ifdef most of the code there is, this might muck up the security, you will have to test it out yourself
Good Luck !

This is so that if anyone wants to build the new version of OpenSSL "1.0.1g" that fixes the Heartbleed problem you can follow the previous steps whit the following changes:
I renamed the folder include to --include and create a new folder named include, the VS project will take care of copying the information, --include if you like you can remove this, when i build the project without this change there where compilation issues.
Note: the include folder that i changed is the one found in the root not the one found under VSbuild
Enjoy

Here is a download of pre-compiled OpenSSL libraries for Windows Phone 8.1 among other platforms:
https://www.teskalabs.com/blog/openssl-binary-distribution-for-developers-static-library
Disclaimer: I run that site.

Related

How can i solve this Erorr Could not open SSL LIbray

Hey i am getting this error if i start my program. I am using Lazarus as plattform.
I am trying to get the source code of the site with following code:
uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
fphttpclient,openssl,fpopenssl,Buttons;
s := TFPCustomHTTPClient.SimpleGet('https://freepascal.org');
In the end my programm should show me the source code in the programm.
Thanks for your help:)
Download OpenSSL binaries and copy the DLLs in your executable folder or somewhere on the path. Pay attention that there are a lot of OpenSSL versions and they are not always interchangeables! Be sure to download the correct one.
If you have already the OpenSSL installed, then use a tool like ProcessMonitor to spy on your own application to find out which DLL it tries to open and where it expect the DLL to be.

Converting .Xcodeproj file to .Apf file

I am developing a game in xcode using cocos2d-x i want to convert the .xcodeproj file to .apk file for that i use the Stella SDK. after download the package I try to configure it. But i am getting the following error, I typed in terminal.Please help me.
mac-man:~ srikanthreddy$ cd / opt
mac-man:/ srikanthreddy$ git clone https://github.com/morningtec/StellaSDK.git
fatal: could not create work tree dir 'StellaSDK'.: Permission denied
You are trying to clone the git project into /opt which is a directory that you may not have write permission for.
Usually you'd create such projects in your home directory, so try this instead:
mkdir ~/StellaSDK
cd ~/StellaSDK
git clone https://github.com/morningtec/StellaSDK.git
Note that this step is only cloning the StellaSDK project, it has nothing to do with the task you described (creating an .apk file). From that I take it you haven't fully understood that StellaSDK is a game engine / framework just like cocos2d-x, so you can't use that to create an .apk file unless you start a new project. In particular you can't just convert a .xcodeproj to work with Stella SDK, there is no automatism like that.
While at the same time cocos2d-x is a cross-platform engine capable of creating Android .apk apps. The reason why you're trying to use Stella for (or in place of?) an already existing cocos2d-x project is a bit of a mystery to me.

Compiling sqlite-winrt for using SQL in WinRT/WP app with SQLite

I'm trying to use the sqlite-winrt library at https://sqlwinrt.codeplex.com (cf. http://blogs.windows.com/windows_phone/b/wpdev/archive/2013/05/30/sqlite-winrt-wrapper-for-windows-phone.aspx) because I need to access an SQLite database via SQL commands in a WinRT 8.1 and a WP8 app and this library seems the only available option.
Anyway, there is no binary release and if I try compiling the source I get several link errors for unresolved externals against the SQLite DLL. I posted an issue at codeplex but got no reply yet, so I was wondering if anyone had already managed to successfully compile this lib and how (or if you know of any viable alternative for RT8.1 and WP8). Here is what I did:
downloaded the latest source from the site.
downloaded and installed 2 VSIX from http://www.sqlite.org/download.html: sqlite-winrt81-3080002.vsix for RT 8.1 and sqlite-wp80-winrt-3080100.vsix for WP.
executed the powershell scripts in each subfolder of the source code solution, which are required to update the projects with newer releases of the SQLite for WinRT extension. The current versions of the scripts refer to SQLite for WinRT 8.1 (prerelease) which is the same I downloaded above.
opened the VS2013 solution and removed the RT project (I just need RT8.1 and WP, this was for WinRT 8.0).
5) built the solution, which failed with link errors.
If I see the RT8.1 project properties, I can confirm the reference to SQLite is under C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\SQLite.WinRT81\3.8.0.2.
Did anyone manage to use this lib? Thanks!
I also once had that problem. I fix it by editing the project file manually. At that time, the powershell script updating the wrong path. That's why I always failed when compiling my project. After I edit the project file using external text editor (I use sublime text), the projects are linked correctly.
You can try DatabasesCx. It is another SQLite Wrapper using Windows Runtime Component technology. It is freeware distributed as precompiled binary. You can find the details at http://www.almanacsoft.com/databasescx

How to properly update Monogame with a Github PR

Heey,
I got a little problem. The current Monogame 3.2 build available hasn't got a working template for Windows Phone 8. This will result into a black screen and a non working app. So I went onto their git hub and found the issue https://github.com/mono/MonoGame/pull/2089 and someone who fixed it and posted a Pull request.
The problem now is I have close to zero experience with building my own version or editing project template files. I got some common knowledge and started to delve into this all and already tried copying the template files to my visual studio files and building projects and throwing around the new .DLL but it all doesn't want to work properly. I started to work with the older template but I need the new version due to proper support for landscape in windows phone 8 that we need to utilize for our game.
Now is my question if someone knows the right/proper way to do this. A short summing up from what to copy where will do.
Thanks in advance.
Okay it took me some time but I figured out what to copy,build,set and run.
You download the .Zip or make a pull with your Github into an empty folder and when finished extract it.
In the map open the MonoGame.Framework or MonoGame.Framework.”your
target platform” which will startup visual studio.
Build the solution/project (don’t forget to build in ARM, x86 and
x64 if enabled and needed) and navigate to “Extracted
folder”/MonoGame.Framework/bin/”your targeted platform” at the same
time open a new explorer and navigate to your MonoGame installation
by default C:\Program Files (x86)\MonoGame\v3.0
Navigate in your extracted folder to your targeted platform and
build and copy the MonoGame.Framework.dll to the opposing C:\Program
Files (x86)\MonoGame\v3.0\Assemblies\”targeted platform”\”build”
Rebuild your Project/Solution
Gratz you now updated your MonoGame :)
This could fix your problem but it’s possible that you still get an error when initializing your app on your phone or emulator DXGI related.
If this occurs then follow these steps. The problem lies probably by your SharpDX.WP8.dll how to fix this? In my case download and install the newest SharpDX http://sharpdx.org/download/ you could also look further how to only download the SharpDX.WP8.dll & .winmd!
Navigate to your SharpDX install (by default C:\Program Files
(x86)\SharpDX) navigate further to
Bin\DirectX11_1-“platform”-“build”\ and copy the SharpDX.WP8.dll and
.winmd to C:\Program Files
(x86)\MonoGame\v3.0\Assemblies\WindowsPhone\”build”
Rebuild your Project/Solution (if this still doesn't work you may
need to manually add the references again to SharpDX.WP8.winmd for
both builds)
So if it’s alright this should fix most issues but there is one left. Between MonoGame 3.0.x and 3.2 the project template of a windows phone game has changed but this didn't went well in the code. So we’re now going to update the project template of our Visual Studio.
Go back to your extracted Monogame map and head into the folder
“ProjectTemplates”\”your visual studio version”\WindowsPhone
Select all files and create a .Zip (could be done by the integrated
windows option “Send To”) make sure when you open the .Zip you will
immediately see all the files and they aren't nested into a folder
inside the .Zip
Navigate to C:\Users\”your PC name”\Documents\Visual Studio
201X\Templates\ProjectTemplates\Visual C#\MonoGame and copy your
just created .Zip and overwrite the existing file.
You may have to follow these steps if you use different version of Visual Studio because of the lack of support for XNA inside VS2013.
Now you should've fixed any possible problem. If your project still gives errors try to recreate a new one (this would now use the new updated template you just copy pasted and would work) If this still doesn't work than please post what goes wrong but this all should do! These instructions should also work for all other platforms (at least which you could build of course)
Pretty easy to do pull it in to your own version.
Follow these steps:
Fork the Monogame repository
Clone your version to your local machine
Find the repository of the fixed code.
In a command prompt, move to your MonoGame folder, and pull the changes in using this line on your machine. (the branch is most likely master)
git pull http://github.com/other/repo branch_name
Once you have the pull request pulled into your local branch, just build it using Visual Studio.
You can also follow these steps if you think you'll be doing this often.
https://help.github.com/articles/syncing-a-fork
For some reason MrME, I couldn't get your solution to work because of some missing SharpDX reference which REFUSED to be added manually. While your solution may be valid I would like to present an alternative if you have the patience to transfer the code to a Monogame 3.2 project and are still getting the black screen:
Set the DrawingSurface to a DrawingSurfaceBackgroundGrid in the GamePage.xaml. Full details are found in the commented explanation at the bottom of the GamePage.xaml file.
Source: https://github.com/mono/MonoGame/issues/2081

MySQL C API libraries for iPhone

Does anybody know where to get a MySQL libraries compiled for the arm iPhone architecture?
Or how to cross-compile MySQL for arm?
Thanx
Here's how I did it:
1) Download the source code version of Connector/C from MySQL
2) Download cmake (if you have macports installed, type "sudo port install cmake")
3) Get toolchain files from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
4) In the toolchain file for the simulator, remove one architecture from the line containing CMAKE_OSX_ARCHITECTURES
5) If you want to build for the simulator, copy the missing headers in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/netinet/ (ip.h and in_system.h) from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk/usr/include/netinet
6) Create a directory called "compiled_library" somewhere, eg on your Desktop
7) Call cmake like this:
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/iphone-toolchain-file -DCMAKE_INSTALL_PREFIX=/path/to/compiled_library -DHAVE_FDATASYNC:INTERNAL=0
8) Note that if you want to run cmake a 2nd time, you might have to delete the cache file first
9) type make install
10) Now you have the compiled library in /path/to/compiled_library. Copy the header file directory and libmysql.a to your xcode project via "Add existing files...". The library should be automtically added to the linker stage.
11) WOOHOO. Use the mysql C API.
12) If this is too much work, I'm currently writing a MySQL wrapper framework for the iPhone. I will publish it sometime in the next ten years and put a link here.
EDIT:
Someone else created an Objective C Wrapper for the MySQL client library: http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/
do you need client or server libraries? Anyway, since OS X supports unix scripts you should at least try build using "regular Unix" approach:
client:
http://dev.mysql.com/doc/refman/5.1/en/connector-c-building.html
server:
http://dev.mysql.com/doc/refman/5.1/en/installing-source.html
You can use Kumulos 'Hookup' http://www.kumulos.com/2011/07/06/introducing-hookup/ feature to build a suite of web services for your MySQL database.
Basically you define your different web services in the online control panel, then it builds all the Objective-C code and server side code.
I believe this is the easiest way to achieve your goals, and probably a lot better than using a direct Objective-C MySQL library.
This worked for me:
https://github.com/thrivesmart/just-mysql-example-mac-app-objective-c-xcode/issues/1
No compilation needed
Just use that LIB and replace the lib with the other repo!
I don't believe you can run MySQL on the iPhone. As Ben pointed out SQLite is built into the iPhone and you can use Core Data to manage structured data.