New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scalac/fsc don't resolve symlinks before looking for standard libs #2092
Comments
Imported From: https://issues.scala-lang.org/browse/SI-2092?orig=1 |
Arya Irani (refried) said: [arya@drfunkenstein ~]$$ `realpath \`which scalac\`` -version
Scala compiler version 2.8.0.r18093-b20090624020115 -- Copyright 2002-2009, LAMP/EPFL
[arya@drfunkenstein ~]$$ `which scalac` -version
ls: cannot access /net/hc295/arya/env/path/lib/*: No such file or directory
Exception in thread "main" java.lang.NoClassDefFoundError: scala/tools/nsc/Main
Caused by: java.lang.ClassNotFoundException: scala.tools.nsc.Main
at java.net.URLClassLoader$$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: scala.tools.nsc.Main. Program will exit.
[arya@drfunkenstein ~]$$ |
@paulp said: |
@refried said: But just to confirm that Paul is testing the same thing: my symlink foo/bar points to the scala/bin directory. So whereas scala/bin/../lib exists, foo/bar/../lib doesn't. |
@paulp said:
Ah. You are right, I was not testing the same thing. However I do not consider what you are reporting a bug. I vote to close this as invalid. What you are doing amounts to putting the scala scripts and the libs in different locations, and fixing it would require looking in both /path/to/link/../lib AND /path/to/file/../lib. I think it's better to say "don't do that." |
@refried said:
I can't think of any reasonable case where /path/to/link/bin -> /path/to/scala/bin
/path/to/link/lib -> /path/to/scala/lib
# why are you rebuilding all the root level links? or /path/to/link/bin -> /path/to/scala/bin
/path/to/link/lib (physical directory)
or
/path/to/link/lib -> /path/to/otherscala/lib
# mixing and matching different bin and lib dirs?? Even if you are trying to mix and match different components, just put them in the same physical directory, and The reason I noticed this at all is that at my school, where we have a single home directory shared across machines of varied platforms (irix/sunos/solaris/redhat/ubuntu) which generally can't share binaries, I have an unusual setup where my path is built based on symlinks in the filesystem:
for example: <path>/eclipse-3.4-x86_64 -> /net/hc295/arya/links/hd22-home/software/eclipse/eclipse-3.4-x86_64
<path>/jdk1.6.0_03 -> /net/hd22/pfunk/devtools/jdk1.6.0_03/bin/
<path>/scala-2.8 -> /net/hc295/arya/scala-2.8.0.r18093-b20090624020115/bin/ I know it's a weird situation, but scala is the first program I've run into trouble with on this. i.e. eclipse and javac both find their respective libraries fine. Specifically, javac is looking for its libraries relative to the physical path to itself. Maybe the right fix is to look in both paths as you suggested (I'm not sure), but as long as we only support one or the other, I suggest switching it up, like Sun has. See: [arya@drfunkenstein tmp4]$$ ls -l
total 0
lrwxrwxrwx 1 arya stud 24 2009-06-30 12:41 bin -> ../tmp3/jdk1.6.0_03/bin/
[arya@drfunkenstein tmp4]$$ bin/javac -version
javac 1.6.0_03
[arya@drfunkenstein tmp4]$$ mv `realpath bin`/../lib/ .
`../tmp3/jdk1.6.0_03/lib/' -> `./lib'
[arya@drfunkenstein tmp4]$$ ls -l
total 8
lrwxrwxrwx 1 arya stud 24 2009-06-30 12:41 bin -> ../tmp3/jdk1.6.0_03/bin/
drwxr-xr-x 2 arya pfunk 72 2007-11-03 20:25 lib
[arya@drfunkenstein tmp4]$$ bin/javac -version
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
[arya@drfunkenstein tmp4]$$ |
@refried said: |
@refried said: --- scalac.orig 2009-06-23 20:12:29.000000000 -0400
+++ scalac 2009-06-30 13:36:16.786948000 -0400
@@ -26,7 +26,7 @@
SOURCE=`dirname "$SOURCE"`/${TARGET:-.};
fi;
done;
-SCALA_HOME=`dirname "$SOURCE"`/..;
+SCALA_HOME=`readlink \`dirname "$SOURCE"\``/..;
SCALA_HOME=`cd "$SCALA_HOME"; pwd`;
# Remove spaces from SCALA_HOME on windows
if $cygwin; then ...and similarly in the other scripts where SCALA_HOME is initialized. |
@cunei said: SCALA_HOME="$$(cd "$$(cd $$(dirname "$$SOURCE"); pwd -P)"/..; pwd)" or, in simpler steps: SCALA_HOME=`dirname "$$SOURCE"`
SCALA_HOME=`cd "$$SCALA_HOME"; pwd -P`
SCALA_HOME=`cd "$$SCALA_HOME"/..; pwd` |
@cunei said: SCALA_HOME="$$(cd "$$(cd "$$(dirname "$$SOURCE")"; pwd -P)"/..; pwd)" |
@refried said: |
@cunei said: |
@cunei said: |
Arya Irani (refried) said: |
Arya Irani (refried) said: |
Commit Message Bot (anonymous) said: Removed assumption that bash is in /bin. Removed --posix option to bash. I took the waste-half-a-day step of installing vmware fusion so I could :javap now sort of works on windows (not for repl-defined classes as yet) |
The text was updated successfully, but these errors were encountered: