Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:06
    straight-shoota review_requested #11475
  • 15:04
    straight-shoota synchronize #11475
  • 15:03
    straight-shoota synchronize #11475
  • 14:01
    straight-shoota closed #11523
  • 13:35
    straight-shoota demilestoned #11515
  • 13:24
    beta-ziliani unlabeled #11529
  • 13:21
    beta-ziliani demilestoned #11454
  • 13:21
    beta-ziliani demilestoned #11513
  • 13:02
    straight-shoota labeled #11431
  • 13:02
    straight-shoota labeled #11431
  • 13:02
    straight-shoota labeled #11431
  • 13:00
    straight-shoota labeled #11349
  • 13:00
    straight-shoota labeled #11349
  • 12:59
    straight-shoota labeled #11321
  • 12:59
    straight-shoota labeled #11321
  • 12:14
    straight-shoota labeled #11548
  • 12:14
    straight-shoota opened #11548
  • 12:14
    straight-shoota labeled #11548
  • 11:16
    straight-shoota closed #11536
  • 09:44
    BlobCodes synchronize #11094
didactic-drunk
@didactic-drunk
Downloading on windows? How to handle multiple platforms in shard.yaml - postinstall?
Kaia Leahy
@tenebrousedge
sup y'all
oprypin
@oprypin:matrix.org
[m]

It currently builds on Linux with just a shards build because I set the rpath in the link flags in the backends library :p

ow.. that's what i said shouldn't be done. it's really hostile.

anyway.. I'll get around to this tomorrow. today i kinda disappeared
Matthew Berry
@mattrberry
What makes that really hostile? Isn't that just adding an extra path for it to check at link time? If it doesn't find it in that path, then you can always just pass the link flags directly to shards build still, right?
Maybe I'm missing something, but I don't see a harm in setting it?
Unrelated: Am I missing something silly here? This isn't matching my expectation https://play.crystal-lang.org/#/r/bbpq
I would have expected the self.new in SDLOpenGLImGuiFrontend to be called
I can totally just do it a different way, I just expected different behavior
Matthew Berry
@mattrberry
Ah I'm guessing that's because the self.new and self.initialize have the same args
Kaia Leahy
@tenebrousedge
the second one overwrites the first
Matthew Berry
@mattrberry
Yeah that makes sense, that was my suspicion. I don't know how I'd actually expect it to work if not like this tbh haha
oprypin
@oprypin:matrix.org
[m]

What makes that really hostile? Isn't that just adding an extra path for it to check at link time? If it doesn't find it in that path, then you can always just pass the link flags directly to shards build still, right?

Matthew Berry how can you say that that flag is supposed to check something at link time, if exactly that is already the job of the -L flag?
writing -rpath . has a very simple effect: append the value . to the "rpath" field of the final ELF executable (empty by default). so you're saying: "if you use my library, you must accept a custom and rare value of rpath for your executable." then, what is done at run time with that field is to check those paths for libraries that were linked against and use them. I'd (strongly) say that it should be up to the developer of the executable to decide that allowing overrides of any referenced lib from current directory is ok. it works only for particular models of deployment and is a question of security as well.

Oleh Prypin
@oprypin
agh tagging you didn't work properly. trying again. @mattrberry
oprypin
@oprypin:matrix.org
[m]
if you still want to hardcode this addition in source code, that's ok, but it should be done in the main executable's source code. can be done as such, I'm pretty sure:
@[Link(ldflags: "-Wl,-rpath .")]
lib DoesntMatterWhatNameIsHere
end
and that can't be applied on Windows, of course
oprypin
@oprypin:matrix.org
[m]
@didactic-drunk: well, building a whole C library in your postinstall is the problem
i don't know really... I don't have a verdict on what's "wrong" to do in postinstall, but indeed a cross-platform postinstall is near-impossible to achieve at the moment
Matthew Berry
@mattrberry
@oprypin Maybe I’m just being naive? I figure since they’re already building my code, they’re trusting that the code I’ve written isn’t malicious. What makes me setting the rpath any more dangerous since they’re already building my code anyway?
oprypin
@oprypin:matrix.org
[m]
@mattrberry: that wasn't really my point. let's say i want to use your "crystal-imgui-backends". i don't want my executable to have a tweaked rpath. i have no options to solve that.
Matthew Berry
@mattrberry
What’s the harm in the tweaked rpath though? And couldn’t they set it in their own application as well to override, in theory if they really wanted to? I’m not trying to argue btw, maybe I’m just missing something?
oprypin
@oprypin:matrix.org
[m]
@mattrberry: awh the external libs are too numerous, i couldn't handle it :( i think i'm giving up on the Windows stuff
ultimately the problem here is that for my Windows usages I did not rely on Makefile at all, but here it would be way too much work to rework it to a separate script
compared to https://github.com/oprypin/crystal-imgui-sfml/blob/master/make.cmd
Matthew Berry
@mattrberry
@oprypin Ahh no worries, well thank you tons for starting on it at least!!
oprypin
@oprypin:matrix.org
[m]
@mattrberry: yes i think it will not be possible to use the makefile on windows. look, it's building some weird lib file https://github.com/oprypin/crab/runs/2814402132?check_suite_focus=true#step:9:56
other than that, this is very close to working
Matthew Berry
@mattrberry
Hmm I’m on mobile, but maybe that’s because I’m linking it back here? https://github.com/mattrberry/crystal-imgui-backends/blob/16a576200f366c0c6aec1fc5033108ae1a975f5e/Makefile#L40
oprypin
@oprypin:matrix.org
[m]
the file is "weird" because g++ is used unconditionally for that build, whereas everything else is managed by MSVC
well i deleted that part anyway, so that literally can't be it
the main remaining thing, as I said, is to find an alternative to all these $(CXX) lines and use cl.exe instead of g++. https://github.com/mattrberry/crystal-imgui-backends/blob/16a576200f366c0c6aec1fc5033108ae1a975f5e/Makefile#L45
i have no idea if that's viable within the Makefile. i opted to go for a separate build script on Windows. https://github.com/oprypin/crystal-imgui-sfml/blob/master/make.cmd
Matthew Berry
@mattrb:matrix.org
[m]
Hmm I don’t know Makefile super well, but that’s supposed to be defined as the c++ compiler for that system, right? For much of the makefile, I borrowed it straight from the imgui example here https://github.com/ocornut/imgui/blob/master/examples/example_sdl_opengl3/Makefile
oprypin
@oprypin:matrix.org
[m]
yeah you end up using the C++ compiler for that MinGW (or whatever) environment
that Makefile ends up referring to POSIX tool clones
and it's moot anyway because even if CXX=cl.exe , it cannot accept GCC-like flags
oprypin
@oprypin:matrix.org
[m]
Matthew Berry: that makefile contains support for MinGW-GCC
Crystal works only with cl.exe, doesnt work with MinGW-GCC
but they do also have support for cl.exe
Matthew Berry
@mattrb:matrix.org
[m]
Ah now we’re getting even further into the realm that I know absolutely nothing about :/ Are those just two different c++ compilers for windows? I’ll be able to grab my laptop in a couple hours to look a little deeper too, although I don’t have windows there either :/
oprypin
@oprypin:matrix.org
[m]
Matthew Berry: yeah they are. cl.exe is by Microsoft, where as MinGW is a collection of ports of POSIX tools to Windows; they end up being partly in an emulated environment or something weird
so yeah this is quite ugly and way harder than i made it seem
Matthew Berry
@mattrb:matrix.org
[m]
Ah, well again thank you tons for taking a look!! Maybe someday it’ll be easier to port :) Appreciate you trying :)
didactic-drunk
@didactic-drunk
@oprypin:matrix.org Attempting to improve UX (developer experience DX, is that thing?). There are 3 unix use cases. 1) Building a rpm/deb package (or personal executable) that relies on the distribution packaged libraries. 2) Building a run on any distro binary that can't rely on a system installed libsodium. 3) Same as 1 but the system libsodium is ancient and can't be used (This is very common). The build scripts check the system version (but allow overrides) and them by default if new enough otherwise download and build the version tested with sodium.cr. None of this is a concern for windows which never has a packaged libsodium
@oprypin:matrix.org shards install takes care of everything unless you want to override a value provides the best DX even if the build script is more complex. I doubt I'd have half as many users if it required: manually check your distro version. If it's >= x install else download and build it yourself.
oprypin
@oprypin:matrix.org
[m]
i see. well, maybe my main dissatisfaction comes from how rigid postinstall is. any tiniest problem and everything just bails out