Author Topic: Problem with installation  (Read 49836 times)

Offline aravinthan6206

  • Single posting newcomer
  • *
  • Posts: 3
Problem with installation
« on: December 10, 2012, 06:48:01 am »
hi... I recently downloaded the codeblocks-12.11mingw-setup for windows 7.  When i try to install, i get a message "Cannot create target folder. Installation cannot continue. (Probably missing access rights?)."  I have administrative privileges and there are no other users in my laptop.  Need solution...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem with installation
« Reply #1 on: December 10, 2012, 08:51:12 am »
I have administrative privileges and there are no other users in my laptop.  Need solution...
Being admin on a Win7 computer doesn't mean applications nor installers have admin rights, too. Please right-click on the installer and select "Run as administrator". Alternatively install in a folder where you have write access right.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline aravinthan6206

  • Single posting newcomer
  • *
  • Posts: 3
Re: Problem with installation
« Reply #2 on: December 10, 2012, 01:38:11 pm »
thank you... it worked.. i have installed tons of software jst by double clicking.. this was the first time i encountered such problem..

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem with installation
« Reply #3 on: December 10, 2012, 02:32:25 pm »
thank you... it worked.. i have installed tons of software jst by double clicking.. this was the first time i encountered such problem..
This is Win7 magic: It uses a certain pattern to detect, whether its a setup you are running or an app. If the pattern matches, you are automatically asked for permission (UAC), otherwise you have to take care yourself. Note that if this pattern matches, it also requests UAC, even if the setup would actually not require admin rights... its just a pattern, not working reliable. That's why it may work or not - just as you experienced.

Complains to Microsoft, please.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline asaharia

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problem with installation
« Reply #4 on: December 14, 2012, 03:39:34 pm »
Morten, I disagree with your "Windows 7 Magic" comment... Don't dismiss this issue yet ! There's no magic here - the behaviour is highly deterministic and reliable. Aravinthan is right about having installed numerous software packages without having to run their setups as Administrator. I have the exact same problem on my Windows 7 64-Bit box. To put things in perspective, your own setup for Code::Blocks 10.05 does not have this problem - it installs correctly even without running it as Administrator. You can try it out yourself, on any Windows 7 64-Bit machine. Obviously, something has changed / broken in the new installer (v12.11, MinGW Bundle) ! And it doesn't end there. Even after running the new setup "as Administrator", Code::Blocks cannot be uninstalled from "Programs and Features" in the control panel. I suspect "uninst.exe" in the installation directory would also need to be run "as Administrator" for a successful uninstall, but I haven't tried that myself. Uninstalling it from "Programs and Features" in the control panel doesn't display any errors, but it leaves all the files and shortcuts behind; I had to delete the files from my installation folder (C:\Program Files (x86)\CodeBlocks) manually after attempting to uninstall it from the control panel. A broken installer / uninstaller is a serious problem. I request you to look into the matter, and release an updated setup for Windows, if possible. Please note that I have experienced the exact same behaviour on 2 different machines running Windows 7 64-Bit, so reproducing it should easy. Let me know if you need any further information about my experience with this issue. Thanks, and keep up the good work !

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Problem with installation
« Reply #5 on: December 14, 2012, 04:16:34 pm »
thank you... it worked.. i have installed tons of software jst by double clicking.. this was the first time i encountered such problem..
This is Win7 magic: It uses a certain pattern to detect, whether its a setup you are running or an app. If the pattern matches, you are automatically asked for permission (UAC), otherwise you have to take care yourself. Note that if this pattern matches, it also requests UAC, even if the setup would actually not require admin rights... its just a pattern, not working reliable. That's why it may work or not - just as you experienced.

Complains to Microsoft, please.
In setup.nsi the RequestExecutionLevel should either be none (default) or admin (probably highest will do also), otherwise the setup is run as user, what will not work in almost all cases.
See here:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.8.1.32

It has changed in r8122 to user.

I have no nsis to test.
« Last Edit: December 14, 2012, 04:21:19 pm by jens »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem with installation
« Reply #6 on: December 14, 2012, 04:30:07 pm »
There's no magic here
Well there is the magic I described... but it maybe another story.

Please note that I have experienced the exact same behaviour on 2 different machines running Windows 7 64-Bit, so reproducing it should easy.
Well its not. I tired (even in advance) on my Win7/64 bit machine, too. I don't see this issue. Neither if I install in program files nor in another (accessible) folder. I am a standard user on my machine (not even admin or power user), so what am I missing?

Let me know if you need any further information about my experience with this issue.
Yes, exact steps to reproduce please.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem with installation
« Reply #7 on: December 14, 2012, 04:33:43 pm »
It has changed in r8122 to user.
Well the idea here was not to UAC prompt all the time, even if you install it into an accessible (i.e. portable) folder.
We can change that but this means it will always UAC prompt, even if you install it on a USB drive.

If thats more useful, I am happy to assist.

Edit: Maybe to clarify a bit more: For me, its always suspicious if installer request UAC at first place. Usually it should do that on runtime, if needed (which is not implemented). But I might be alone.
« Last Edit: December 14, 2012, 04:36:06 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Problem with installation
« Reply #8 on: December 14, 2012, 05:08:05 pm »
It should work according to the nsis-docs:
Quote from: http://nsis.sourceforge.net/Docs/Chapter4.html#4.8.1.32
Installers that need not install anything into system folders or write to the local machine registry (HKLM) should specify user execution level.

But I have the same issue on win7 64 bit if I remember correctly. Not sure about win7 32-bit at the moment.

It might be an issue with installing into "Program Files(X86)" (or how it is called) instead of "Program Files".
Just a wild guess.

Offline asaharia

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problem with installation
« Reply #9 on: December 14, 2012, 06:08:27 pm »
Morten, thanks for the quick reply. Here's what I think you can do to reproduce the issue.

1. On a Windows 7 64-Bit box, login from an account that has administrative privileges - not a "Standard User", not the user "Administrator" either.
2. Run the MingGW-bundle setup of Code::Blocks 12.11 by double-clicking on the exe - don't run as administrator yet.
3. Specify "C:\Program Files (x86)\CodeBlocks" as the installation directory.

Going through the installation wizard will throw a "cannot create folder" kind of an error. I'm sorry, I do not remember the exact error message.

Now try the same thing again, but this time, right-click on the setup and run it "as Administrator". Specify "C:\Program Files (x86)\CodeBlocks" as the installation directory again. This time, you will be able to complete the setup successfully. But...

Go to "Programs and Features" in the control panel, and uninstall Code::Blocks from there. The progress bar moves ahead, but nothing is actually deleted from disk. I think I saw an error message again at the end of the "uninstall" process, but I can't be sure of that right now. Simply navigate to "C:\Program Files (x86)", and you'll see that the "CodeBlocks" directory, with all its files and sub-directories, is still there ! The start menu shortcuts are not deleted either.

This should reproduce the exact issue we're facing.


It has changed in r8122 to user.
Well the idea here was not to UAC prompt all the time, even if you install it into an accessible (i.e. portable) folder.
We can change that but this means it will always UAC prompt, even if you install it on a USB drive.

If thats more useful, I am happy to assist.

Edit: Maybe to clarify a bit more: For me, its always suspicious if installer request UAC at first place. Usually it should do that on runtime, if needed (which is not implemented). But I might be alone.

I hear you, but the vast majority of users will install Code::Blocks to a local hard drive, most probably to the "Program Files (x86)" directory. A UAC request is perfectly normal - and expected - for all setups, unless the setup is built to install a program for the current standard user only. Honestly, I get suspicious when I need to explicitly run an installer "as Administrator", even though I have administrative privileges on my account. I'd request you to fix this behaviour and release a new setup for all of us. Many thanks, in advance.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem with installation
« Reply #10 on: December 14, 2012, 06:41:36 pm »
Morten, thanks for the quick reply. Here's what I think you can do to reproduce the issue. [...]
OK, with that information I am able to reproduce but as there are no files deleted, you have to (as you said already) run the uninstaller as admin, too. So this was actually my intended behaviour: To install to a write protected folder which requires UAC run both as admin: install and uninstall. If you choose a portable folder (which many of us do these days and therefore being able to do a silent install, too btw.) you don't need these steps. So, its not an error, just a question of what is the best default behaviour.

I think the one an only correct solution would be not to ask for UAC as long as you have write access rights to the target folder. If the user select a folder w/o write access you should prompt for UAC... ad only then. This is what most modern installers do, too btw..

I'll see if there is a way to do this with NSIS (meaning UAC on demand). If somebody knows already - step forward.
« Last Edit: December 14, 2012, 06:43:38 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline asaharia

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problem with installation
« Reply #11 on: December 14, 2012, 11:44:01 pm »
Morten, it's good to know that you were able to reproduce the issue... I'm sure you guys will come up with an apt solution soon. :) In my honest opinion, the best way to provide a portable installation, is to simply offer a separate zip / self-extracting archive for download ! Simple, yet superbly effective for portable "installations". An installer that makes entries to the Start Menu and "Programs and Features', should ideally behave like a traditional installer, and users should never be required to run the installer / uninstaller as Administrator. Uninstalling the software from the Control Panel should just work... Everything should just work. Do think about it. Users love working with stuff that "just works". And UAC prompts are routine on Windows 7, really. Running a setup and clicking "Yes' on the UAC prompt is normal, perhaps even expected these days. I vote for a separate traditional installer with a UAC prompt, and a completely hassle-free install / uninstall process (even from the control panel; something that doesn't need to be run explicitly "as Administrator", as long as the current user has administrative privileges), and a separate "portable" installer for users who'd like to carry Code::Blocks with them on a pen drive ! Also keep in mind that many of us might want to install Code::Blocks from an administrative account, for all local users. Please don't worry too much about the UAC prompt - it's not that bad, and is actually the norm when it comes to installers running on Windows 7. :) I, for one, actually prefer such traditional setups to portable ones. Your thoughts ? Jens, any suggestions ? Thanks again !

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem with installation
« Reply #12 on: December 15, 2012, 10:10:39 am »
Morten, it's good to know that you were able to reproduce the issue... I'm sure you guys will come up with an apt solution soon. :)
Its not really that simple. We have the requirement to allow a silent installation for admins across a network. With UAC this is broken. I searched the NSIS forum for a solution but it seems nobody really cares about such. I found related questions but w/o an answer and one "hack" which is that ugly that I don't want to use it, actually.
Maybe we should offer two installers: One with UAC (the default) and one with user-mode, as it is now with a clear description that this won't work for folders where you have no access to unless you run it as admin (like for a remote install that is the case).

Any thoughts?

For all: To summarise: When installing/uninstalling C::B to Program files, run both (the installer and un-installer) as admin for now.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline asaharia

  • Single posting newcomer
  • *
  • Posts: 5
Re: Problem with installation
« Reply #13 on: December 16, 2012, 03:47:09 pm »
"2 separate installers" sounds good to me. :)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem with installation
« Reply #14 on: December 20, 2012, 09:22:59 am »
"2 separate installers" sounds good to me. :)
Done. I've also uploaded all d/l sites and the description on our download page. Let me know if that works for you.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ