Author Topic: Bug: Advanced compiler options resets certain values after quitting  (Read 4813 times)

Offline Mad David

  • Single posting newcomer
  • *
  • Posts: 3
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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Bug: Advanced compiler options resets certain values after quitting
« Reply #1 on: June 07, 2018, 01:04:39 am »
Code::Blocks version?
OS Name and Version?
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7576
    • My Best Post
Re: Bug: Advanced compiler options resets certain values after quitting
« Reply #2 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.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Bug: Advanced compiler options resets certain values after quitting
« Reply #3 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?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Bug: Advanced compiler options resets certain values after quitting
« Reply #4 on: June 07, 2018, 11:39:33 am »
Have you tried to hit the "save all" button? Settings saving in codeblocks is strange...

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1549
Re: Bug: Advanced compiler options resets certain values after quitting
« Reply #5 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)


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Bug: Advanced compiler options resets certain values after quitting
« Reply #6 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Mad David

  • Single posting newcomer
  • *
  • Posts: 3
Re: Bug: Advanced compiler options resets certain values after quitting
« Reply #7 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Bug: Advanced compiler options resets certain values after quitting
« Reply #8 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]