Different compilers

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
chi
Addict
Addict
Posts: 1034
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Different compilers

Post by chi »

Poll: What other compilers would you like to be able to use with PB, besides the usual ones like MSVC and Clang?

I've been playing around with different compilers since Alpha1 and am now able to compile my PB sources with GCC, MSVC, Clang and a little bit TCC. Everything runs fine, but it's still in the state where I have to use scroll-lock, num-lock, shift-lock, ... to tell PB what to do. Not really a problem for me, but definitely not ready for release. So now I'm considering writing a program that combines all these compilers into a single UI, but that's a pretty big task (imagine all available compiler flags, LTCG etc.) and if nobody is interested in such a program, I'd rather spend my time on something else. I also want to make it clear right from the start that it won't be free (depending on features and time spent).
Anyway, would you be interested in such a 'ToolChainSwitcher'? Which compilers should be supported?
Et cetera is my worst enemy
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Different compilers

Post by idle »

What was wrong with my approach where you just write compiler flags in c comments, you could just as easily tell it which compiler to use that way as well.
User avatar
chi
Addict
Addict
Posts: 1034
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Different compilers

Post by chi »

Nothing was wrong :), just a different approach. Mine would be more UI driven and switching from GCC to MSVC to Clang or whatever is just a matter of pushing a button and selecting a (customizable) preset.

MSVC also needs some special handling of the C source before compiling and it's done all automatically, or you can tell my program to generate a solution file for Visual Studio and continue to code/run/debug/build in the VS Editor. It is easy to use and works out of the box for beginners, not much knowledge required. But you can also tweak like a pro ^^.

As a bonus for the PB IDE, you'll get a more detailed error log:

Image

But based on the feedback on PBCex so far, it seems only a few people here are really interested in this topic. Guess I'll have to wait and see ;)
Et cetera is my worst enemy
User avatar
idle
Always Here
Always Here
Posts: 5097
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Different compilers

Post by idle »

I wasn't meaning to sound critical. I think it would be very useful for sure and I agree if you do it as a compiler tool in the ide it does make it easier. It sounds good and you've got it linking with link.exe as well so now you can benefit from Link time optimizations as well. That might be interesting if you're working with c libs.
User avatar
chi
Addict
Addict
Posts: 1034
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Different compilers

Post by chi »

Don't worry, that was a valid question. I think both programs could complement each other well. However, I haven't done any testing in this regard yet. The ability to include C headers in PB is not on my agenda at the moment.

The screenshot is fairly old, it predates the C backend ;). Back then, Link time optimization was not possible with the ASM backend, because /LTCG only works if you compile the .obj and link it with a single call to cl.exe and not if you call the linker separately. But that is taken care of now...
Et cetera is my worst enemy
User avatar
blueb
Addict
Addict
Posts: 1044
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: Different compilers

Post by blueb »

Didn't Fred advocate Pelles C at one time? http://www.smorgasbordet.com/pellesc/
- It was too lonely at the top.

System : PB 6.10 LTS (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
jack
Addict
Addict
Posts: 1337
Joined: Fri Apr 25, 2003 11:10 pm

Re: Different compilers

Post by jack »

perhaps, but PellesC is Windows only
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: Different compilers

Post by Olli »

A small question between parenthesis : is C backend available on demo version ?

If no, why not ? I am late to buy a licence, but I am not without searching the compiling mistakes.
User avatar
chi
Addict
Addict
Posts: 1034
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Different compilers

Post by chi »

blueb wrote: Thu Jul 28, 2022 12:13 pm Didn't Fred advocate Pelles C at one time? http://www.smorgasbordet.com/pellesc/
Thx for the Pelles C suggestion! I remember trying some things with Pelles 8 when it came out, but I wasn't very happy with the optimization results compared to other compilers. Maybe it's time to revisit and check out Pelles 11.
jack wrote: Thu Jul 28, 2022 12:25 pm perhaps, but PellesC is Windows only
Yeah, I should have mentioned that I only work with Windows (hence MSVC).
Olli wrote: Thu Jul 28, 2022 2:31 pm A small question between parenthesis : is C backend available on demo version ?

If no, why not ? I am late to buy a licence, but I am not without searching the compiling mistakes.
The C backend is available in the demo version but you can't create a DLL and the source is limited to ~800 lines of code.
Et cetera is my worst enemy
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: Different compilers

Post by Olli »

chi wrote:The C backend is available in the demo version
:shock: I did not care about this... I will test this !
User avatar
chi
Addict
Addict
Posts: 1034
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Different compilers

Post by chi »

blueb wrote: Thu Jul 28, 2022 12:13 pm Didn't Fred advocate Pelles C at one time? http://www.smorgasbordet.com/pellesc/
I did some tests with Pelles 10 (was already installed on my drive), but encountered some problems with strict type checking. So there is no easy way to simply convert PB to Pelles C without first running a linter (static analyzer) that could detect and fix these problems. I use clang-tidy and cppcheck with VS, so maybe there is a chance with these tools?! Guess I'm down another rabbit hole, cya :)
Et cetera is my worst enemy
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: Different compilers

Post by Olli »

I thank you for this info : now I have donwloaded PB6 Demo.

I can see two compilers pb now in the last and same directory :

Code: Select all

pbcompiler.exe
pbcompilerc.exe
Also in the IDE, I don't reach the pbcompilerc in the compiler options.
There is a combobox named "use compiler :" but there is only one choice, and nothing to be able to add the c compiler. Any hint ?
User avatar
mk-soft
Always Here
Always Here
Posts: 5409
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Different compilers

Post by mk-soft »

Menu -> Preferences -> Compiler -> Additional Compilers
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: Different compilers

Post by Olli »

Ok ! I had to tell you I just found it. Thank you mk-soft.
User avatar
Janni
Enthusiast
Enthusiast
Posts: 127
Joined: Mon Feb 21, 2022 5:58 pm
Location: Norway

Re: Different compilers

Post by Janni »

Rookie question here. Why was the C backend compiler added. Does it have any advantages over the default compiler ?
Spec: Linux Mint 20.3 Cinnamon, i7-3770K, 16GB RAM, RTX 2070 Super
Post Reply