eclipse.jdt.ls icon indicating copy to clipboard operation
eclipse.jdt.ls copied to clipboard

Working on FreeBSD

Open orbitz opened this issue 2 years ago • 14 comments

Has anyone gotten this working on FreeBSD? I've tried the latest milestone and trick it into using the linux configuration, however it fails for expected reasons around loading linux specific classes, such as org.eclipse.equinox.launcher.gtk.linux.x86_64.

Is there any "generic" configuration I could use?

orbitz avatar Sep 07 '22 18:09 orbitz

Would it be possible to provide the error log(s) from the launch ? I think freebsd is its own osgi.os value, which means we would need to build an additional product to support it.

I tried the following change to JDT-LS :

diff --git a/pom.xml b/pom.xml
index 5343eef3..97f08368 100644
--- a/pom.xml
+++ b/pom.xml
@@ -170,6 +170,11 @@
                                                                <ws>cocoa</ws>
                                                                <arch>x86_64</arch>
                                                        </environment>
+                                                       <environment>
+                                                               <os>freebsd</os>
+                                                               <ws>gtk</ws>
+                                                               <arch>x86_64</arch>
+                                                       </environment>
                                                </environments>
                                                <dependency-resolution>
                                                        <!-- <optionalDependencies>ignore</optionalDependencies> -->

This fails though because https://download.eclipse.org/eclipse/updates/4.25-I-builds/I20220817-1800/plugins/ , one of our target platform locations, doesn't contain the freebsd fragments for things like org.eclipse.swt & org.eclipse.equinox.launcher.

You would basically need to build those components, and then I think this would all work. Also, does https://github.com/daemonblade/freebsd-eclipse help at all ?

You could try adding the flag -os linux to the Eclipse launch command and see if that works. It should override the value detected. This is an argument to Eclipse itself (not the JVM), so I would make sure to pass it before the -vmargs call, if there is one.

rgrunber avatar Sep 08 '22 18:09 rgrunber

I can install Eclipse, at least:

Below is the list of packages available. If I have eclipse installed can I somehow use jdtls with that?

The specific error was not being able to load some.stuff.gtk.linux. I can get the specific one if it helps but what you've said I would think matches pretty clearly to what I'm seeing.

Thank you for taking helping!

pkg search eclipse
eclipse-4.24                   Eclipse IDE 2022-06
eclipse-EPIC-0.6.35_3          EPIC adds Perl support to the Eclipse IDE Framework
eclipse-ShellEd-1.0.2a_4       Shell script editor for Eclipse
eclipse-cdt-9.0.1              C/C++ plugin for Eclipse IDE
eclipse-drjava-0.9.8_6         DrJava plugin for Eclipse
eclipse-ecj-4.4.2_1            Eclipse Java Compiler
eclipse-findbugs-3.0.1.20150306.5.a4.d1 Eclipse plug-in that provides FindBugs support
eclipse-glassfish-5.1.0_1      Eclipse Jakarta EE Platform
eclipse-pydev-8.2.0            Eclipse plugin for Python and Jython development

orbitz avatar Sep 08 '22 18:09 orbitz

It looks installing eclipse I get the FreeBSD versions of the packages I need. What I'm not sure of is how to tell jdtls to use them.

        /usr/local/share/eclipse/p2/org.eclipse.equinox.p2.core/cache/binary/org.eclipse.sdk.ide.executable.gtk.freebsd.amd64_4.24.0.v20220616-0004
        /usr/local/share/eclipse/plugins/org.eclipse.core.filesystem.freebsd.amd64_1.2.300.v20220616-0004.jar
        /usr/local/share/eclipse/plugins/org.eclipse.core.net.freebsd.source_1.0.100.v20220616-0004.jar
        /usr/local/share/eclipse/plugins/org.eclipse.core.net.freebsd_1.0.100.v20220616-0004.jar
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.launcher.gtk.freebsd.amd64_1.2.500.v20220616-0004/META-INF/MANIFEST.MF
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.launcher.gtk.freebsd.amd64_1.2.500.v20220616-0004/META-INF/MANIFEST.MF.orig
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.launcher.gtk.freebsd.amd64_1.2.500.v20220616-0004/about.html
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.launcher.gtk.freebsd.amd64_1.2.500.v20220616-0004/eclipse_11701.so
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.launcher.gtk.freebsd.amd64_1.2.500.v20220616-0004/launcher.gtk.linux.x86_64.properties
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd.source_1.0.200.v20220616-0004.jar
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/.api_description
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/META-INF/MANIFEST.MF
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/META-INF/MANIFEST.MF.orig
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/about.html
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/fragment.properties
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/fragment.xml
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/GBusType.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/GError.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/GList$ByReference.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/GList.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/LinuxPasswordProvider$LibGio.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/LinuxPasswordProvider$LibSecret.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/LinuxPasswordProvider.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/SecretCollectionFlags.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/SecretSchema.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/SecretSchemaAttribute.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/SecretSchemaAttributeType.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/SecretSchemaFlags.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/SecretServiceFlags.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/nls/LinuxPasswordProviderMessages.class
        /usr/local/share/eclipse/plugins/org.eclipse.equinox.security.freebsd_1.0.200.v20220616-0004/org/eclipse/equinox/internal/security/linux/nls/messages.properties
        /usr/local/share/eclipse/plugins/org.eclipse.swt.gtk.freebsd.amd64.source_3.120.0.v20220616-0004.jar
        /usr/local/share/eclipse/plugins/org.eclipse.swt.gtk.freebsd.amd64_3.120.0.v20220616-0004.jar

orbitz avatar Sep 08 '22 19:09 orbitz

What happens if you make the following changes to JDT-LS :

diff --git a/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target b/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target
index bb6d5ed2..c3199c69 100644
--- a/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target
+++ b/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target
@@ -43,6 +43,7 @@
                <unit id="org.eclipse.jdt.java19patch.feature.group" version="0.0.0"/>
                <unit id="org.eclipse.jdt.java19patch.source.feature.group" version="0.0.0"/>
         </location>
+        <location path="/usr/local/share/eclipse/plugins/" type="Directory"/>
     </locations>
     <targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
-</target>
\ No newline at end of file
+</target>
diff --git a/pom.xml b/pom.xml
index 5343eef3..97f08368 100644
--- a/pom.xml
+++ b/pom.xml
@@ -170,6 +170,11 @@
                                                                <ws>cocoa</ws>
                                                                <arch>x86_64</arch>
                                                        </environment>
+                                                       <environment>
+                                                               <os>freebsd</os>
+                                                               <ws>gtk</ws>
+                                                               <arch>x86_64</arch>
+                                                       </environment>
                                                </environments>
                                                <dependency-resolution>
                                                        <!-- <optionalDependencies>ignore</optionalDependencies> -->

Basically, /usr/local/share/eclipse/plugins/ contains what you need, so adding it to the target platform along with listing the additional environment should permit it to build.

rgrunber avatar Sep 08 '22 20:09 rgrunber

Testing now.

Also, do I need to make any changes to config dir? the jdtls python file also needs to be updated to support FreeBSD but I'm not sure what config dir to point it at, or how to change the existing configs.

orbitz avatar Sep 08 '22 20:09 orbitz

Yup! You'll need to add an entry at https://github.com/eclipse/eclipse.jdt.ls/blob/ed9d3c77ff9a6d0de6caf0813705d4c6a8aedab7/org.eclipse.jdt.ls.product/scripts/jdtls.py#L55 to support freebsd.

Also https://github.com/eclipse/eclipse.jdt.ls/blob/ed9d3c77ff9a6d0de6caf0813705d4c6a8aedab7/org.eclipse.jdt.ls.product/publish-assembly.xml#L15 & https://github.com/eclipse/eclipse.jdt.ls/blob/ed9d3c77ff9a6d0de6caf0813705d4c6a8aedab7/org.eclipse.jdt.ls.product/pom.xml#L102 (might be a 2nd spot copy-config-linux-slim)

rgrunber avatar Sep 08 '22 21:09 rgrunber

The configurations contain an "osgi.bundle" variable and I'm not quite sure how to rework that for my needs as I don't really understand the path format (for example a bunch of them have @4 at the end?). Is there a primer on this format or do you have any suggestions for how to resolve this? One thing I want to try is to take take a milestone build and symlink the list of jars and dirs into the plugins dir and then construct the osgi.bundle variable to match.

orbitz avatar Sep 09 '22 06:09 orbitz

I've made some progress. I've taken the most recent milestone build, symlinked in my FreeBSD specific jars, then modified config_linux to replace the linux specific ones with my FreeBSD ones in osgi.bundle. The error I'm getting is:

org.eclipse.core.runtime.CoreException: Plug-in org.eclipse.jdt.ls.core was unable to load class org.eclipse.jdt.ls.core.internal.LanguageServer.

I can see that the jar that contains that class is being open by the process, I'm just not sure why it's not finding it.

orbitz avatar Sep 10 '22 13:09 orbitz

Rather than modifying the configuration after the build, it might be easier to add the OS-specific bundles to https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.product/languageServer.product & https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.product/syntaxServer.product . This should ensure the config folder contains them. The @4 is just a reference to the OSGi start level.

Since the class that failed to load is within the bundle itself, I would guess maybe the bundle failed to start. Maybe something about the Activator start, in https://github.com/eclipse/eclipse.jdt.ls/blob/ed9d3c77ff9a6d0de6caf0813705d4c6a8aedab7/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JavaLanguageServerPlugin.java#L156 failed.

rgrunber avatar Sep 12 '22 03:09 rgrunber

I've made some progress! But I'm not sure what to do here:

Cannot complete the install because one or more required items could not be found.
        Software being installed: Java Language Server 1.0.0 (languageServer.product 1.0.0)
        Missing requirement for filter properties ~= $0: languageServer.product.executable.gtk.freebsd.x86_64 1.0.0 requires 'org.eclipse.equinox.p2.iu; org.eclipse.equinox.launcher.gtk.freebsd.x86_64 0.0.0' but it could not be found
        Cannot satisfy dependency:
                From: Java Language Server 1.0.0 (languageServer.product 1.0.0)
                To: org.eclipse.equinox.p2.iu; toolinglanguageServer.product.application [1.0.0,1.0.0]
        Cannot satisfy dependency:
                From: toolinglanguageServer.product.application 1.0.0
                To: org.eclipse.equinox.p2.iu; languageServer.product.executable.gtk.freebsd.x86_64 [1.0.0,1.0.0]
86_64 failed: Call to p2 director application failed with exit code 13. Program arguments were: [-metadataRepository, file:/tmp/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/,file:/tmp/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/ta
rgetPlatformRepository/, -artifactRepository, file:/tmp/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/,file:/resolution-context-artifacts@%252Ftmp%252Feclipse.jdt.ls%252Forg.eclipse.jdt.ls.product,file:/tmp/eclipse.jdt.ls/org.eclipse.jd
t.ls.product/target/,file:/tmp/eclipse.jdt.ls/org.eclipse.jdt.ls.core/target/,file:/tmp/eclipse.jdt.ls/org.eclipse.jdt.ls.logback.appender/target/,file:/usr/home/orbitz/.m2/repository/, -installIU, languageServer.product, -destination, /tm
p/eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/products/languageServer.product/freebsd/gtk/x86_64, -profile, DefaultProfile, -profileProperties, org.eclipse.update.install.features=true, -roaming, -p2.os, freebsd, -p2.ws, gtk, -p2.arch
, x86_64]. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-p2-director-plugin:2.7.2:materialize-products (create-distributions) on project org.eclipse.jdt.ls.product: Installation of product lang
uageServer.product for environment freebsd/gtk/x86_64 failed

I have made the changes you suggested.

One thing is that I can see that package in my plugins directory is actually a directory that looks like:

/usr/local/share/eclipse/plugins/org.eclipse.equinox.launcher.gtk.freebsd.amd64_1.2.500.v20220616-0004:
META-INF
about.html
eclipse_11701.so
launcher.gtk.linux.x86_64.properties

I'm not sure how to link all these up. Any ideas? Thanks!

orbitz avatar Sep 12 '22 07:09 orbitz

I got it to compile! But...I'm back to:

!ENTRY org.eclipse.equinox.launcher.gtk.freebsd.amd64 2 0 2022-09-12 10:03:25.085
!MESSAGE Could not resolve module: org.eclipse.equinox.launcher.gtk.freebsd.amd64 [34]
  Unresolved requirement: Require-Capability: eclipse.platform; filter:="(& (osgi.ws=gtk) (osgi.os=freebsd) (osgi.arch=amd64))"
  Unresolved requirement: Require-Capability: eclipse.platform; filter:="(& (osgi.ws=gtk) (osgi.os=freebsd) (osgi.arch=amd64))"


!ENTRY org.eclipse.osgi 4 0 2022-09-12 10:03:25.086
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in org.eclipse.jdt.ls.core was unable to load class org.eclipse.jdt.ls.core.internal.LanguageServer.
        at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:212)
        at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:198)
        at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:920)
        at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:246)
        at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:63)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
Caused by: java.lang.ClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.jdt.ls.core (51).
        at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:126)
        at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:570)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:335)
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:397)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:500)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:622)
        at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:196)
        ... 16 more
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin.start() of bundle org.eclipse.jdt.ls.core.
        at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:839)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:767)
        at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1032)
        at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:371)
        at org.eclipse.osgi.container.Module.doStart(Module.java:605)
        at org.eclipse.osgi.container.Module.start(Module.java:468)
        at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:513)
        at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:117)
        ... 25 more
Caused by: java.lang.IllegalStateException: Workspace is already closed or not ready yet. Consider tracking the org.eclipse.core.resources.IWorkspace service (using your favorite technique, e.g. Declarative Services, ServiceTracker, Blueprint, ...) instead of calling the static method here to prevent such issues!
        at org.eclipse.core.resources.ResourcesPlugin.getWorkspace(ResourcesPlugin.java:489)
        at org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin.start(JavaLanguageServerPlugin.java:160)
        at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:818)
        at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:810)
        ... 32 more

I feel so close!

orbitz avatar Sep 12 '22 08:09 orbitz

I got all of the tests to pass (I'm trying from latest milestone, v0.15.0), but I had to disable the android tests because they were failing. And I'm still getting this. I guess I'm starting to think everything is working and there is something I can to do about the workspace. In this case I've got an open .java file and I just try to startup the jdtls with that and I'm getting that error. I'm also not quite sure why the workspace would already be closed.

orbitz avatar Sep 12 '22 13:09 orbitz

My guess is the first failure causes the others.

The org.eclipse.equinox.launcher.${ws}.${os}.${arch} contains (for example) Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x86_ 64)) in the META-INF/MANIFEST.MF . I'm just not sure what satisfies the requirement or how to fix it.

rgrunber avatar Sep 12 '22 15:09 rgrunber

It looks exactly like this:

Manifest-Version: 1.0
Created-By: Maven Archiver 3.5.2
Build-Jdk-Spec: 11
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.freebsd.amd64;sing
 leton:=true
Bundle-Version: 1.2.500.v20220616-0004
Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.5.0,1.7.0
 )"
Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=freebsd) (osgi.arch=am
 d64))
Bundle-Localization: launcher.gtk.freebsd.amd64
Eclipse-BundleShape: dir
Eclipse-SourceReferences: scm:git:https://github.com/eclipse-equinox/equ
 inox.binaries.git;path="rt.equinox.framework/bundles/org.eclipse.equino
 x.launcher.gtk.freebsd.amd64";commitId=d26bd248f21d20f408dc0aca1dd2b57a
 688dc1bf

orbitz avatar Sep 12 '22 15:09 orbitz

I was able to get jdtls to work on FreeBSD with Helix

I just built it normally (skipping tests.) It built without issues, but running it did not work ...

2023-01-18T12:44:59.842 helix_lsp::transport [ERROR] err <- "    raise Exception(\"Unknown platform {} detected\".format(platform))\n"
2023-01-18T12:44:59.842 helix_lsp::transport [ERROR] err <- "Exception: Unknown platform <module 'platform' from '/usr/local/lib/python3.10/platform.py'> detected\n"

So I did some poking around, trying to find out where this error was coming from. Found it in this built artifact:

eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/bin/jdtls.py

In the function get_shared_config_path(jdtls_base_path): there is some switching logic to determine if you're on Linux, Darwin or Windows. Else, it would throw the exception noted above!

For giggles, I commented out the exception and replaced it with:

config_dir = 'config_linux`

And to [very] much surprise, it worked! I fired up helix again and it worked (as far as I can tell) as well as it does on Linux using the same setup.

So I made a proper edit to this file:

- if system == 'Linux':
+ if system in ['Linux', 'FreeBSD']:

This fix will probably work for neovim and others as well ...

schlomie avatar Jan 18 '23 21:01 schlomie

If that works for you, we can definitely add it to the script. @schlomie , can you create a PR for this ?

rgrunber avatar Jan 18 '23 22:01 rgrunber

There are three linux specific jars in config_linux/config.ini. Whether or not using the Linux config for FreeBSD fully works or not is to be determined. I haven't encountered anything wonky yet, but I can't guarantee it works for all use cases.

Sure, I can do a PR quick.

schlomie avatar Jan 18 '23 22:01 schlomie

Closing as it seems getting something to work on FreeBSD succeeded, and we were able to merge some of the work into the JDT-LS script to simplify things a bit.

rgrunber avatar Apr 01 '23 01:04 rgrunber