zorael / kameloso

IRC bot with Twitch support
Boost Software License 1.0
8 stars 3 forks source link

Can't build with LDC2 #113

Closed RUSShyTwo closed 2 years ago

RUSShyTwo commented 2 years ago

Hey,

I saw your post on the D forum

I gave it a try and noticed that if build without the version "Colours", then it compile fine

So a problem with this struct: https://github.com/zorael/kameloso/blob/9ccff29ead6ca2e80e2db0f06085c751326ed578/source/kameloso/constants.d#L320

My message on the D forum can't be sent without moderator approval

They don't like when i call them out on their bullshit, they want to make D a Java++, but who am i to complain? right, they know better with the GC ;)

zorael commented 2 years ago

Hello!

Yes, though version(Colours) is used in many places in the code, not only in constants.d. Without it, no code that outputs colours to the terminal gets compiled.

https://github.com/zorael/kameloso/blob/9c80b2c26f9a8cb63538b88c490e3b0927fe35ff/source/kameloso/plugins/printer/formatting.d#L542 https://github.com/zorael/kameloso/blob/9c80b2c26f9a8cb63538b88c490e3b0927fe35ff/source/kameloso/plugins/printer/formatting.d#L1128 https://github.com/zorael/kameloso/blob/9c80b2c26f9a8cb63538b88c490e3b0927fe35ff/source/kameloso/plugins/printer/formatting.d#L1207 https://github.com/zorael/kameloso/blob/9c80b2c26f9a8cb63538b88c490e3b0927fe35ff/source/kameloso/terminal.d#L255 https://github.com/zorael/kameloso/blob/9c80b2c26f9a8cb63538b88c490e3b0927fe35ff/source/kameloso/logger.d#L77 https://github.com/zorael/kameloso/blob/9c80b2c26f9a8cb63538b88c490e3b0927fe35ff/source/kameloso/irccolours.d#L443

...and so forth.

I'll definitely take a look at the line and struct you linked to, perhaps it can be rewritten or refactored into something that ldc can compile. But it is also used in many other places that are not as easily reworked.

I'll try reducing it with Dustmite sometime in the next few days, then we'll know for sure. I'm not used to Windows however so it's tricky.

zorael commented 2 years ago

Apparently this is caused by ldc hitting a stack overflow during compilation. I reported it to the ldc people and they were familiar with the problem.

They said they've had to modify the compiler and increase the stack size for some project of Symmetry Investment's, and that they'll upstream the fixes now that they know more people are affected.

The workaround is to download said modified compiler from here. If you have problems linking you'll have to modify ldc.conf and undo the changes listed in the release description. Not ideal, but at least it works for now.

Incidentally this happens on Linux too, but there you just have to manually increase the stack size with ulimit -s and retry compilation.

$ ulimit -s 16384
$ dub build --compiler=ldc2

I'm currently working on v3.0.0 betas and I'll upload compiled binaries as I go. That way only I have to go through the trouble.