Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hxcpp, ssl and Mbedtl #777

Open
ianharrigan opened this issue Apr 2, 2019 · 7 comments
Open

hxcpp, ssl and Mbedtl #777

ianharrigan opened this issue Apr 2, 2019 · 7 comments

Comments

@ianharrigan
Copy link

ianharrigan commented Apr 2, 2019

I stumbled upon a Mbedtl dependency in hxcpp with regard to SSL inside hxcpp.

A little background: I know a friend who is trying to use haxeui as a static .lib via hxcpp, all works for the most part except there are references to ssl which dont play nice. Thanks to @Gama11 i could drill down and find out its based on sockets / http (which haxeui's ImageLoader uses). All fine.

My question is would it be advantageous to be able to #if ssl out of the picture (opt in to remove) if you didnt want to hit this dependency. Another option, ofc, would be to make Mbedtl work correctly statically, but it seems that an ability to "opt out" of any third party libs seems advantageous here (and in general).

Wondering what the thoughts are on this?

Cheers,
Ian

@ianharrigan
Copy link
Author

ianharrigan commented Apr 2, 2019

(addendum: i could #if out all of the remote image loading, but it seems drastic, http is fine, https is the issue wrt to the dependency)

@hughsando
Copy link
Member

What are the issues?
Both solutions (fix linking, avoid linking) are possible - eg, we have HXCPP_LINK_NO_ZLIB, but here we would be expecting an external implementation of zlib.

@intoxopox
Copy link

Howdy. I'm the friend @ianharrigan mentioned. I ended up band-aiding things for now on my end by modifying hxcpp\4,0,8\src\hx\libs\ssl\Build.xml so that the appropriate libs would be linked when building static. Is it possible the current way you guys have it is in error in using unless="static_link" for those libs? Here's my change for reference, just modifying the lib tags:
`

<!--lib name="advapi32.lib" if="windows" unless="static_link" />
<lib name="crypt32.lib" if="windows" unless="static_link" />
<lib name="ws2_32.lib" if="windows" unless="static_link" /-->
<lib name="advapi32.lib" if="windows" />
<lib name="crypt32.lib" if="windows" />
<lib name="ws2_32.lib" if="windows" unless="static_link" />

<flag value="-framework" if="macos"/>
<flag value="Security" if="macos"/>

`

@posxposy
Copy link
Contributor

posxposy commented Apr 8, 2019

Another option, ofc, would be to make Mbedtl work correctly statically

I'm currently using haxe->hxcpp->static_lib for an iOS project. And that lib is actively using HTTPS and it works fine.
So, probably it is a platform specific issue?

@ianharrigan
Copy link
Author

Correct me if im wrong, but are "fix linking" and "avoid linking" mutually exclusive? Shouldnt any 3rd party lib be optional?

@hughsando
Copy link
Member

Are you building the hxcpp-gen code into a library (rather than exe/dll)? If this is the case, the windows libraries (ws2_32.lib etc) do not (can not) go in the lib, they must be added to the linking of the final exe, presumably by whatever system uses the hxcpp-gen library.

@intoxopox
Copy link

intoxopox commented Dec 28, 2020

For what it's worth, only the crypt32.lib tag needs unless="static_link" removed in my workaround now, apparently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants