LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   gcc -I option (https://www.linuxquestions.org/questions/programming-9/gcc-i-option-443764/)

vkmgeek 05-11-2006 07:38 AM

gcc -I option
 
Hey,
Its surprising!!

I do
gcc -c -I/home/vkmgeek sample.c .....It works
now if I give soft link of above path instead of actual path....it is not working....why is it so?

that is,
gcc -c -I/home/vkm/myinclude sample.c .........not working

Some GURU ....plz have light on this!!!!

taylor_venable 05-11-2006 10:44 AM

It works for me using gcc 3.4.4 on FreeBSD 6-STABLE. (I believe the recommended method for compiling the Linux kernel relies on symlinked directories.) Could it be a permissions problem?

paulsm4 05-11-2006 12:08 PM

Taylor_venable is absolutely correct: "-I" should work whether it points to a "real directory" or a symbolic link to a real directory.

Of course, the link could be messed up.

Did you try this:
Quote:

ls /home/vkmgeek
ls /home/vkm/myinclude
and verify they both listed the same files?

vkmgeek 05-12-2006 01:55 AM

Quote:

Originally Posted by paulsm4
Of course, the link could be messed up.

No, the link is not messed up. ls for both gives same output.
I also checked permissions of that link...i., ls -l...it has all permissions -lrwxrwxrwx.

But, I have gcc 3.4.3... Could it be a gcc version problem?

nhydra 05-12-2006 02:42 AM

Check the mount path of you filesystem.
I tried to compile some programs on other filesystem and had such problems like you.
The link and real directory have to be in one and same filesystem.
I check your example, it works on my computer with Gentoo.

daihard 05-12-2006 02:49 AM

Quote:

Originally Posted by nhydra
Check the mount path of you filesystem.
I tried to compile some programs on other filesystem and had such problems like you.
The link and real directory have to be in one and same filesystem.
I check your example, it works on my computer with Gentoo.

You mean the symlink and the original path must reside on the same partition? That's new to me. The only UNIX-like system where that may be true, AFAIK, is QNX Neutrino. It certainly should not matter with Linux.

nhydra 05-12-2006 02:56 AM

Quote:

Originally Posted by daihard
You mean the symlink and the original path must reside on the same partition? That's new to me. The only UNIX-like system where that may be true, AFAIK, is QNX Neutrino. It certainly should not matter with Linux.

Let me expain.:)
I have 2 partitions, the first one has FAT filesystem, the second has reiserfs.
I have source files in partition number 1 and want to compile them.
I try compile but nothing then i move the sources in the partition that is mounted as / mountpoint. Aftere that i compile the sources without any problems.
This is on Slackware and Gentoo linux.I had this problems any time when i decide to compile some program on diferent partitions.

Just try.It depends on mount options. When the filesystem is mounted as "default" you could compile any source.

daihard 05-12-2006 03:17 AM

Quote:

Originally Posted by nhydra
Let me expain.:)
I have 2 partitions, the first one has FAT filesystem, the second has reiserfs.
I have source files in partition number 1 and want to compile them.
I try compile but nothing then i move the sources in the partition that is mounted as / mountpoint. Aftere that i compile the sources without any problems.
This is on Slackware and Gentoo linux.I had this problems any time when i decide to compile some program on diferent partitions.

Just try.It depends on mount options. When the filesystem is mounted as "default" you could compile any source.

Ah, okay, so you mean "filesystem" as in FAT, ext3 and what not. I was confused because I was using AIX at work today, where they use the term "filesystem" as synonymous to "partition." :)

I wish I could try it myself, but all my local filesystems are ext3. :(

nhydra 05-12-2006 03:27 AM

Quote:

Originally Posted by daihard
I wish I could try it myself, but all my local filesystems are ext3. :(

The filesystem is realy synonymous of "partition". Because on every partition you have a filesystem.
You can't get 2 filesystems on one partition.:p :)
Try it.
Choose the filesystem that is not mounted as "default".

daihard 05-12-2006 03:41 AM

Quote:

Originally Posted by nhydra
The filesystem is realy synonymous of "partition". Because on every partition you have a filesystem.
You can't get 2 filesystems on one partition.:p :)

I think what it comes down to is the terms "filesystem" and "filesystem format." I usually refer to "filesystem" as synonymous to "filesystem format" (i.e. ext3, FAT, etc). So two different partitions can have one "filesystem." :)

vkmgeek 05-12-2006 07:13 AM

Quote:

filesystem
Here filesystem is same. I have both on same partition that is root partition. I m not doing mount kind of thing even...
After looking at the posts, I rechecked about problem, but its still there....

I m using 2.6 kernel. Though it doesn't matter, for the sake of specifying I m just specifying.

Can anyone with correct reason?

gnashley 05-14-2006 12:54 PM

You can't compile most software on a FAT file system, since all the file attributes are not available.

File system and partition should never be considered to be the same thing. You can have a file sydtem that's not a partition and you can have a partition with no file system on it.

UMSDOS made it possible to have two file system on the same partition.

paulsm4 05-14-2006 04:21 PM

vkmgeek - I thought you were squared away days ago!

And jeez - the amount of nonsense and disinformation in this thread!

Sigh...

KNOWN FACTS:
1. You're having some kind of compile error.
For lack of an exact error message, we can only speculate on what the real error actually is.

2. Yes, in general "-I" works with symbolic links

3. Yes, in general you can compile on a FAT filesystem just as well as any other kind of (read/write) partition (with, of course, certain obvious limitations - including security, file name length, and case sensitivity)

4. No, "hard links" cannot span filesystems (whereas "soft links" most definitely can!)

SUGGESTED GAMEPLAN:
1. Cut and paste your exact compile command, along with the exact error message.

2. Give any other (brief!) information you think is relevant.

3. We'll take it from there and help you resolve this little mystery.

Sound like a plan?

Thanx in advance .. PSM

ioerror 05-14-2006 05:11 PM

Quote:

Originally Posted by paulsm4
And jeez - the amount of nonsense and disinformation in this thread!

Indeed. I don't know whether to laugh or cry.

Quote:

Originally Posted by nhydra
The link and real directory have to be in one and same filesystem.

No, they don't. What are you talking about? The reason it won't work on your FAT filesystem is because FAT doesn't support symlinks.

A symlink can, by definition, point ANYWHERE. The target doesn't even have to exist.

Quote:

Originally Posted by nhydra
The filesystem is realy synonymous of "partition". Because on every partition you have a filesystem.

What? A partition is a division of a disk drive. A filesystem is a way of storing and organising information (files). They are no more synonymous than a bookshelf is synonymous with the books on it. (I.e. not at all, for those of you at the back).

vkmgeek, what exactly are you trying to do? The -l option links against the given library, but /home/vkmgeek is presumably your ~ dir, not the name of a library ? I don't understand your command line(s)? What is /home/vkm/myinclude ?

vkmgeek 05-15-2006 02:17 AM

Quote:

Originally Posted by ioerror
The -l option links against the given library, but /home/vkmgeek is presumably your ~ dir, not the name of a library ? I don't understand your command line(s)? What is /home/vkm/myinclude ?

Well, everything is messed up here. Rather than solving a problem, discussion went on filesystem and partition - nonsense things.

ioerror - :rolleyes: I have used -I option and not -l option. Former one is used to give a dir only. And there, my all header files are staying...


All times are GMT -5. The time now is 09:03 AM.