LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 09-14-2010, 10:23 PM   #1
915086731
Member
 
Registered: Apr 2010
Posts: 121
Blog Entries: 5

Rep: Reputation: 2
Smile Why can't me execute a symbolic link : "No such file or directory"


Assume the directory I locate is /mypath/bin/ , there exists a file named "ccache"
Then I execute ccache:
Code:
[saturn@21004872 bin]$ ./ccache
ccache, a compiler cache. Version 2.4
Copyright Andrew Tridgell, 2002

Usage:
	ccache [options]
	ccache compiler [compile options]
	compiler [compile options]    (via symbolic link)

Options:
-s                      show statistics summary
-z                      zero statistics
-c                      run a cache cleanup
-C                      clear the cache completely
-F <maxfiles>           set maximum files in cache
-M <maxsize>            set maximum size of cache (use G, M or K)
-h                      this help page
-V                      print version number
Then I execute :
Code:
[saturn@21004872 bin]$ ln -s ccache  mycc
[saturn@21004872 bin]$ ls -l ccache mycc
-rwxrwxrwx. 1 root root 31876  9月 13 22:31 ccache
lrwxrwxrwx. 1 root root    20  9月 15 18:20 mycc -> ccache
After I execute ./mycc, error comes !!
Code:
[saturn@21004872 bin]$ ./mycc
mycc: No such file or directory
Why does me get the error, it seems I can't execute the symbolic link! Help!
Thanks for everyone.
 
Old 09-14-2010, 10:36 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
ccache tries to guess what to execute as by looking at the command line invocation. You're running it as 'mycc' but that compiler (presumably) doesn't exist on your system. You can set CCACHE_CC to some valid compiler and then invoke it as './mycc'.
 
Old 09-14-2010, 10:53 PM   #3
915086731
Member
 
Registered: Apr 2010
Posts: 121
Blog Entries: 5

Original Poster
Rep: Reputation: 2
Sorry, I don't know what you mean, since mycc links to ccache, then I think ./mycc equals to ./ccache.
And I don't what can I set to CCACHE_CC .
The command " export CCACHE_CC=gcc " doesn't solve problem.
 
Old 09-14-2010, 10:59 PM   #4
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
That's odd. I get:
Code:
:ls -l mycc
lrwxrwxrwx 1 j users 6 2010-09-14 22:33 mycc -> ccache

:./mycc
mycc: No such file or directory

:export CCACHE_CC=gcc

:./mycc
gcc: no input files
 
Old 09-14-2010, 11:18 PM   #5
915086731
Member
 
Registered: Apr 2010
Posts: 121
Blog Entries: 5

Original Poster
Rep: Reputation: 2
Unhappy

But I got :

Code:
[saturn@21004872 bin]$ ls -l mycc
lrwxrwxrwx. 1 root root 20  9月 15 19:14 mycc -> ccache

[saturn@21004872 bin]$ export CCACHE_CC=gcc

[saturn@21004872 bin]$ ./mycc
gcc: No such file or directory
Not solved...
 
Old 09-15-2010, 02:02 AM   #6
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Well, the only thing I can think of is that gcc isn't installed. If not that, sorry, and hopefully someone else can help.
 
Old 09-16-2010, 04:09 AM   #7
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,049

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Quote:
Originally Posted by slakmagik View Post
Well, the only thing I can think of is that gcc isn't installed. If not that, sorry, and hopefully someone else can help.
I don't know if it's the issue at hand, but some binaries and scripts will behave differently depending no the name you use to call them, a typical example is busybox. A simple example so you get what I mean.

Code:
$ which busybox
/bin/busybox
$ busybox
BusyBox v1.17.1 (2010-08-17 09:57:50 CEST) multi-call binary.
Copyright (C) 1998-2009 Erik Andersen, Rob Landley, Denys Vlasenko
and others. Licensed under GPLv2.
See source distribution for full notice.

Usage: busybox [function] [arguments]...
   or: function [arguments]...

        BusyBox is a multi-call binary that combines many common Unix
        utilities into a single executable.  Most people will create a
        link to busybox for each function they wish to use and BusyBox
        will act like whatever it was invoked as.

Currently defined functions:
        [, [[, acpid, addgroup, adduser, adjtimex, ar, arp, arping, ash, awk, basename, bb, bbconfig, bbsh, beep, blkid, bootchartd, brctl, bunzip2, bzcat, bzip2, cal, cat, catv, chat, chattr, chgrp, chmod, chown,
        chpasswd, chpst, chroot, chrt, chvt, cksum, clear, cmp, comm, conspy, cp, cpio, crond, cryptpw, cttyhack, cut, date, dd, deallocvt, delgroup, deluser, depmod, devmem, df, dhcprelay, diff, dirname, dmesg,
        dnsdomainname, dos2unix, dpkg-deb, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env, envdir, envuidgid, ether-wake, expand, expr, false, fbset, fdflush, fdformat, fdisk, fgconsole, fgrep, find, findfs,
        flash_eraseall, flash_lock, flash_unlock, flashcp, flock, free, freeramdisk, fsck, fsck.minix, fsync, ftpd, fuser, getopt, getty, grep, gunzip, gzip, halt, hd, hdparm, head, hexdump, hostname, httpd, hwclock, id,
        ifconfig, ifdown, ifenslave, ifplugd, ifup, init, insmod, install, ionice, ip, ipaddr, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill, killall, killall5, klogd, last, length, less, linux32,
        linux64, linuxrc, ln, loadfont, loadkmap, logger, login, logread, losetup, lpq, lpr, ls, lsattr, lsmod, lspci, lsusb, lzcat, lzma, lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg, microcom, mkdir,
        mkdosfs, mke2fs, mkfifo, mkfs.ext2, mkfs.minix, mkfs.reiser, mkfs.vfat, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe, more, mount, mountpoint, mt, mv, nameif, nc, netstat, nice, nmeter, nohup, nslookup,
        ntpd, openvt, passwd, patch, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, popmaildir, poweroff, printenv, printf, ps, pscan, pwd, raidautorun, rdate, rdev, readahead, readlink, readprofile,
        realpath, reboot, reformime, renice, reset, resize, rev, rm, rmdir, rmmod, route, rtcwake, run-parts, runlevel, runsv, runsvdir, rx, script, scriptreplay, sed, sendmail, seq, setarch, setconsole, setfont,
        setkeycodes, setlogcons, setsid, setuidgid, sh, sha1sum, sha256sum, sha512sum, showkey, sleep, smemcap, softlimit, sort, split, start-stop-daemon, stat, strings, stty, su, sum, sv, svlogd, swapoff, swapon,
        switch_root, sync, sysctl, syslogd, tac, tail, tar, tee, telnet, telnetd, test, tftp, tftpd, time, timeout, top, touch, tr, traceroute, traceroute6, true, tty, ttysize, tunctl, tune2fs, ubiattach, ubidetach,
        udhcpc, udhcpd, umount, uname, uncompress, unexpand, uniq, unix2dos, unlzma, unlzop, unxz, unzip, uptime, usleep, vconfig, vi, vlock, volname, wall, watch, watchdog, wc, wget, which, who, whoami, xargs, xz,
        xzcat, yes, zcat, zcip

$ ln -s /bin/busybox ls
$ ls -l ls
lrwxrwxrwx 1 i92guboj i92guboj 12 sep 16 10:07 ls -> /bin/busybox
$ ./ls
COPYING       README        ccache.1      ccache.h      cleanup.c     configure     execute.c     install-sh    mdfour.c      packaging     stats.c       unify.c       web
Makefile.in   args.c        ccache.c      ccache.yo     config.h.in   configure.in  hash.c        ls            mdfour.h      snprintf.c    test.sh       util.c
$
In shell scripts this can be done by checking for the value of $0, or usually $(basename $0), which will hold the name of the command you used to invoke the script. The script can check for that value and act differently depending on such value.

Last edited by i92guboj; 09-16-2010 at 04:10 AM.
 
1 members found this post helpful.
Old 09-16-2010, 02:04 PM   #8
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Quote:
Originally Posted by i92guboj View Post
I don't know if it's the issue at hand, but some binaries and scripts will behave differently depending no the name you use to call them, a typical example is busybox.
That was the point of my first reply.

Quote:
Originally Posted by slakmagik View Post
ccache tries to guess what to execute as by looking at the command line invocation.
 
1 members found this post helpful.
Old 09-21-2010, 12:44 AM   #9
915086731
Member
 
Registered: Apr 2010
Posts: 121
Blog Entries: 5

Original Poster
Rep: Reputation: 2
Thanks for everyone!!!
 
  


Reply

Tags
directory, execute, file, link, symbolic


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"creating symbolic link" "operation not permitted" wheni Linux - Newbie 3 05-08-2011 02:36 AM
"bad interpreter : no such file or directory" when configure "flex" acer_peri Linux - Software 10 11-10-2010 02:19 AM
Failed to execute child process "realplay" (No such file or directory) bobevt Linux - Newbie 3 09-16-2009 05:57 PM
Creating a link from "." to other directory on SCP bujecas Linux - Security 4 02-01-2007 11:54 AM
"Cannot execute KDE: No such file or directory" abboq Linux - Software 1 09-27-2003 09:08 PM


All times are GMT -5. The time now is 08:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration