Issues with creating a symbolic link (coding Arduino in C) - cygwin

I am trying to programme an arduino microcontroller board using C, and I have downloaded the relevant software onto my laptop. When I use cygwin on my windows laptop and try to create a symbolic link using the command: ln -s /cygdrive/c/Program\ Files\ \(x86\)/Arduino/hardware/tools/avr/bin/avr-gcc.exe it gives me this when I press enter: ln: failed to create symbolic link './avr-gcc.exe': File exists eventhough I have the avr-gcc.exe saved into cygwin itself.

ln -s takes two arguments, the destination of the symlink and the source.
You only give one argument.

Related

Symbolic links Cygwin vs. Msys2 vs. Win 10 (mklink)

I mean to create symbolic links in Msys2 from PortableApps, under Win 10
(I need portable applications to be able to carry the apps directory across systems), as I do in Linux.
For comparison, I will quote what I see with: 1) Msys2; and also other two options: 2) portable MobaXTerm (which is Cygwin based), 3) a (DOS) command prompt.
Msys2:
I get the error ln: failed to create symbolic link 'myfile': Operation not permitted
EDIT (I am not sure if there was any update in-between): now in Msys2 ln -s myfile does not report an error, but it copies the TARGET instead of creating a symbolic link. I do not know why the change in behavior, but this is also useless to me.
MobaXTerm:
I can do ln -s myfile with no problem.
But it is not a suitable workaround.
Command prompt:
mklink creates a symbolic link.
This might be a workaround, if I could launch it from msys2.
But it requires admin rights, or at least Developer mode, and I would need something without this requirement.
(I wonder what is MobaXTerm doing to overcome this requirement).
See this
(TBC: Windows explorer: did not test it).
Why the difference?
Is there a way to create symlinks in Msys2 (with no admin)? Perhaps by launching from msys2 a Cygwin process, which would of course require having some Cygwin application in the system (could the Cygwin dll alone be enouhg?)
Related:
https://github.com/msys2/MSYS2-packages/issues/249
https://sourceforge.net/p/msys2/tickets/41/
http://mingw.5.n7.nabble.com/symbolic-links-ln-s-command-td7159.html
https://www.joshkel.com/2018/01/18/symlinks-in-windows/

Google Drive folder with Bash Windows

I have installed WSL (Windows Subsystem for Linux) and it works perfectly. I like opening bash with CMD or PowerShell typing "bash" because it keeps the same folder.
For example:
PS C:\Users> bash
root#X /mnt/c/Users #
I also use Google Drive (backup and sync).
The folder is in C:/Users/X/Google Drive.
The problem is that when I use "my trick" in that folder it doesn't work. It leads me to bash ~ instead of the real location.
Firstly I thought that It was caused by the spaces from "Google \Drive" but no. All folder work fine (even with spaces)
To sum up, I can't start in that folder or under it. However I can cd there, but you know... not convenient.
Sorry my english in advance, and thank you for your answers :)
I'm a little confused about your question but will do my best to be helpful. It seems that you are attempting to run bash in a Windows environment? I know little of Windows, but work and play in Unix daily.
Once you're using your terminal like a unix terminal, Bash WILL struggle with Google Drive. I use GD as well, and the whitespace is the bane of my existance. However, for simple command-line navigation, something like "cd ~/Google\ Drive" will change your directory to the GD dir. This can be applied to other scenarios as well.. variably.
If you are trying to go to the location in the code you posted, in bash, this would be the appropriate syntax:
cd /mnt/c/Users
This may not apply to Windows, but on a Unix machine, you can get to your personal user directory in appbreviated fashion using "~":
cd ~/
Hope this helps.
work-around: https://github.com/Microsoft/WSL/issues/2999#issuecomment-455835951
Here is a way to mount GFS in WSL based on https://superuser.com/questions/1353169/getting-sshfs-working-on-wsl-or-finding-an-alternative The trick is to use https://www.nsoftware.com/sftp/netdrive/ to ssh to GFS from Windows and relay it as a filesystem that can be mounted under WSL.
Install OpenSSH Server under Win10
Win10 Settings -> Apps -> Manage optional features -> Add feature -> OpenSSH Server
restart if necessary
open Services -> OpenSSH -> Properties -> Startup Type -> Automatic (delayed)
Install and run SFTPNetDrive, right click on icon in hidden icons -> Main window (or maybe already open) -> Profile -> new profile ( server: localhost, user: * pwd:* Drive Letter: F (or another) Advanced -> ( Protocol -> uncheck compression; Specified folder: G:\ ) )
in Bash (wsl): sudo mkdir /mnt/f; sudo mount -t drvfs F: /mnt/f
I'm not sure how stable it is, but I was able to open files in WSL.

Installing digilent adept 2 in linux can't run djtgcfg

I recently installed digilent adept 2 on linux mint 17.3. when I try to execute djtgcfg or djtgcfg enum I receive the error
djtgcfg: error while loading shared libraries: libdabs.so.2: cannot open shared object file: No such file or directory
libdabs.so exists in the following locations on my machine
/usr/lib/digilent/adept/libdabs.so.2
/usr/local/lib64/digilent/adept/libdabs.so.2
/home/han_solo/Xilinx/14.7/ISE_DS/common/bin/lin64/digilent
/digilent.adept.runtime_2.13.1-x86_64/lib64/libdabs.so.2.11.1
/home/han_solo/Xilinx/14.7/ISE_DS/common/bin/lin/digilent
/digilent.adept.runtime_2.13.1-i686/lib/libdabs.so.2.11.1
/home/han_solo/Xilinx/14.7/ISE_DS/ISE/bin/lin64/digilent
/digilent.adept.runtime_2.13.1-x86_64/lib64/libdabs.so.2.11.1
/home/han_solo/Xilinx/14.7/ISE_DS/ISE/bin/lin/digilent
/digilent.adept.runtime_2.13.1-i686/lib/libdabs.so.2.11.1
/usr/local/lib64/digilent/adept/libdabs.so.2.11.1
/usr/lib/digilent/adept/libdabs.so.2.16.5
Each instance has read access. I also made sure that there was a copy in /etc/ld.so.conf.d and ran
$ sudo ldconfig
Go to /usr/local and search for libdabs.so.2 in /usr/local/lib or /usr/local/lib64, depending on where you installed it. Be sure to also check /usr/local/lib/digilent/adept and /usr/local/lib64/digilent/adept
If you don't find the file, you can try going to /usr/Xilinx/14.4/ISE_DS/common/bin/lin64/digilent or /usr/Xilinx/14.4/ISE_DS/common/bin/lin/digilent (32-bit or 64-bit drivers path) and running ./install_digilent.sh. After running it, try to find libdabs.so.2 again.
If you find libdabs.so.2, copy its path and then look for the file /etc/ld.so.conf. Edit this file. Paste the path you copied before in the last line of this file and save it (you can run sudo nano /etc/ld.so.conf to edit it, for example). Then, run sudo ldconfig in the terminal to update the cache. Afterwards, close your terminal and re openit. try to run djtgcfg again. It should work.
Obs.: When adding the path to ld.so.conf, you must put the whole path, without the file name. For example, if the file path is
/usr/local/lib64/digilent/adept/libdabs.so.2
then you should put /usr/local/lib64/digilent/adept/ in the last line of your /etc/ld.so.conf

How to create files and folder in Atom using the command line?

I was watching a speedy workflow tutorial about Atom text editor, and saw how the guy uses Linu commands like ls (to check the files in the directory), touch (to create files eg. style.css) and mkdir (to create folders). Now in my Atom editor I am able to open the command line using the following command.
CTRL + SHIFT + T
Now in my command line the default windows command line opens up, I am able to create folder using mkdir, but the commands touch and ls don't work, which makes me wonder weather Atom has its own command line?
See the SCREENSHOT to see how this guy is creating folders, files and using the ls command.
So my question is, how do I create files in Atom? How do I get the touch command to work?
It looks like the tutorial is using the Term2 package for opening a shell within the editor (http://code.tutsplus.com/courses/speedy-workflows-with-atom/lessons/term2). Since you seem to be able to open a terminal using the described screenshot, you seem to have the Term2 package installed - so far so good.
This package opens a standard command window within the editor. The tutorial seems to be using Linux or Mac OS X as the operating system. If you're running Windows, you will only have the Windows CMD interpreter available.
Windows does not natively support the touch command (but it has a mkdir command). There is a unxtools project that provides some of the common Gnu tools. If you install that, you should be able to run touch from the Windows command shell as well. More details can be found here.

Accidentally deleted symlink libc.so.6 in CentOS 6.4. How to get sudo privilege to re-create it?

I accidentally deleted the symbol link /lib64/libc.so.6 -> /lib64/libc-2.12.so with
$ sudo rm libc.so.6
Then I can not use anything including ls command. The error appears for any command I type
ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
I've tried
$ export LD_PRELOAD=/lib64/libc-2.12.so
After this I can use ls and ln ..., but still can not use sudo ln ... or sudo -E ln .... I always get this err
sudo: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
It's a remote server so I can not use a live CD. I now have a ssh bash session alive but can not establish new ones. I have sudo privilege, but don't have root password.
So currently my problem is I need to run sudo sln -s libc-2.12.so libc.so.6 to re-create the symlink libc.so.6, but I can not run sudo without libc.so.6.
How can I fix it? Thanks~
I resolved the issue by using a statically linked version of "ln" that was already in the server's /sbin.
E.g., this restored it for my configuration:
/sbin/sln /lib64/libc-2.5.so /lib64/libc.so.6
A bit embarrassing :) but it happened to me as well on Ubuntu 12.04.3 (which is not CentOS 6.4 but I thought this could still help maybe).
Because my Ubuntu wouldn't start I used a liveUSB to boot up and then mounted my hard drive and created the symlink (I did have the file itself libc-2.15.so) and that did it.
Just a few specific details:
I asked a good friend to use his computer for half an hour
I Downloaded my exact Ubuntu iso (12.04.3, if you're on;y missing the symlink, it could be any version so much that it can mount drives) from here: link
I made sure his Ubuntu has usb-creator-gtk ($ sudo apt-get install usb-gtk-creator, I'm sure Windows has an equivalent usb boot creator)
Created the liveUSB using usb-creator-gtk
Booted my computer with it (you'll probably need to change your BIOS settings to allow external USB to be booted first)
Once I booted from the live USB I figured where my hard drive partition by running the Ubuntu partition tool (the live USB has one) - mine was of type ext4 and in /dev/sdb1
I mounted it by doing $ mkdir /home/ubuntu/mnt and then $ sudo mount-t ext4 /dev/sdb1 /home/ubuntu/mnt
I then proceeded to that folder $ cd /home/ubuntu/mnt
From that location I then created the symlink by $ sudo ln -s lib/x86_64-linux-gnu/libc-2.15.so lib/x86_64-linux-gnu/libc.so.6
After a reboot I was good.
Hope it helps you (or someone..)
I would add some thing more to #wilfo answer as same also happened with me [accidentally deleting lib.so.6 and was getting /sbin/init missing libc.so.6 on boot up] .
After creating liveUSB in windows (using UNetbootin etc [http://unetbootin.sourceforge.net/]) or in ubuntu as #wilfo suggested.
Booting from liveUSB, I selected "experience ubuntu without installing it" and was happy applying wilfo's method until step 6 and then i couldn't find my hard drive partition of type ext3/4. All were nftf/fat/extended stuff.
So i recovered previous ubuntu (the one with missing libc.so...) by following this link
https://help.ubuntu.com/community/Boot-Repair
make sure to follow all necessary steps and take a backup of your ubuntu partition.
you can see your previous ubuntu files inside /mnt/boot-sav/wubi1/home
take a backup from here to your windows partations /mnt/boot-sav/sda...
and follow remaining procedure here https://help.ubuntu.com/community/Boot-Repair

Resources