Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Mad David on June 06, 2018, 08:57:03 pm

Title: Bug: Advanced compiler options resets certain values after quitting
Post by: Mad David on June 06, 2018, 08:57:03 pm
I'm trying to get LLVM to work on code blocks.  LLVM uses a link.exe-compatible linker, lld-link.exe.
These linkers do not use a prefix to specify that a file is a library.  As far as I can tell, you open a library file by providing its name and the linker takes it upon itself to identify it as such.
This means I have to clear the entry for "Link library:" under "Advanced compiler options->other."

This works for a single run time, but when I close Code::Blocks and reopen it, it restores the "-l" value for that compiler, and I have to go back into Advanced compiler options and clear the entry again.
Title: Re: Bug: Advanced compiler options resets certain values after quitting
Post by: stahta01 on June 07, 2018, 01:04:39 am
Code::Blocks version?
OS Name and Version?
Title: Re: Bug: Advanced compiler options resets certain values after quitting
Post by: stahta01 on June 07, 2018, 08:04:04 am
On Windows 7 using CB 17.12 was able to duplicate problem.

Possible work around enter single space instead of "-l".\; it saves the single space.

Tim S.

Title: Re: Bug: Advanced compiler options resets certain values after quitting
Post by: oBFusCATed on June 07, 2018, 09:34:01 am
I think these settings are defined in xml files.
Have you tried to edit them?
Search for llvm or clang in the codeblocks' install folder.
What version of llvm are you testing?
Title: Re: Bug: Advanced compiler options resets certain values after quitting
Post by: BlueHazzard on June 07, 2018, 11:39:33 am
Have you tried to hit the "save all" button? Settings saving in codeblocks is strange...
Title: Re: Bug: Advanced compiler options resets certain values after quitting
Post by: Miguel Gimenez on June 07, 2018, 05:44:22 pm
If CB is installed under Program Files in Windows (the default location) then the OS blocks any modification of files in CB's folder or below.

You can try running CB as an administrator, change the setting and rerun as normal user, or follow Obfuscated's advice about editing the file options_clang.xml (also as an administrator)

Title: Re: Bug: Advanced compiler options resets certain values after quitting
Post by: oBFusCATed on June 07, 2018, 08:00:40 pm
@Miguels: If cb fails because it cannot override files in program files then this is a bug. The changes to the compiler settings are either saved in the config file or in the share folder in the config folder. But I think that running as administrator won't help much.
Title: Re: Bug: Advanced compiler options resets certain values after quitting
Post by: Mad David on June 16, 2018, 03:59:21 am
Sorry for the late response.
I am using Code::Blocks 17.12, LLVM 6.0.0-Win64.
Both are installed into sub-folders of E:\Compilers, because I hate installing things to my C-drive and avoid it when possible.
BlueHazzard:  I was not aware that "Save Everything" was necessary to save global compiler settings, but it doesn't help anyway.
stahta01:  Putting " " in the Link Library slot causes it to put quotes around the full file name and search for " kernel32.lib", etc., which it can't find.

Following oBFusCATed's suggestion, I tracked down "default.conf" in "\AppData\Roaming\CodeBlocks".
When the Link Library: value is set to -something, there's a few lines in the compiler's <switches> set:
               <LINK>
                  <str>
                     <![CDATA[-something]]>
                  </str>
               </LINK>
When the Link Library: value is absent, the <LINK>...</LINK> lines do not exist.

If I paste in
               <LINK>
                  <str>
                     <![CDATA[]]>
                  </str>
               </LINK>
The linking "works" (Inasmuch as I'm still working out how to get CLang/LLVM to compile and link, but that's not a Code::Blocks problem.)
When I quit, however, it rewrites the default.conf file to remove the <LINK>...</LINK> lines and I get the error on the next run.

So:
A resolution for this bug would be fore Code::Blocks to include the empty switches in the default.conf as above.
Title: Re: Bug: Advanced compiler options resets certain values after quitting
Post by: oBFusCATed on June 16, 2018, 06:12:44 pm
What are you toolchain settings? Can you post a screen shot?
At least on linux clang++ or clang is used for linking.
Using the linker directly is possible but it is harder and requires knowledge about the flags.