Skip to content
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

Error with build.sh #16

Open
PNHost opened this issue Jul 21, 2022 · 10 comments
Open

Error with build.sh #16

PNHost opened this issue Jul 21, 2022 · 10 comments
Labels
support request Support requests and problems with a local set-up

Comments

@PNHost
Copy link

PNHost commented Jul 21, 2022

I'm getting this error when running "build.sh"

First, run

./remap.sh: line 41: zip: command not found
Removed log4j from vanilla jar. Make sure to have it as a dependency in pom.xml!
Applying class mappings...
Exception in thread "main" java.lang.IllegalArgumentException
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:170)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:153)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:436)
        at net.md_5.ss.repo.RuntimeRepo.getClass0(RuntimeRepo.java:25)
        at net.md_5.ss.repo.ClassRepo.getClass(ClassRepo.java:22)
        at net.md_5.ss.repo.AggregateRepo.getClass0(AggregateRepo.java:30)
        at net.md_5.ss.repo.ClassRepo.getClass(ClassRepo.java:22)
        at net.md_5.ss.model.ClassInfo$1.apply(ClassInfo.java:97)
        at net.md_5.ss.model.ClassInfo$1.apply(ClassInfo.java:92)
        at com.google.common.collect.Iterators$8.transform(Iterators.java:799)
        at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
        at com.google.common.collect.Iterators$7.computeNext(Iterators.java:651)
        at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
        at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
        at net.md_5.ss.remapper.EnhancedRemapper.findFieldDeclarer(EnhancedRemapper.java:45)
        at net.md_5.ss.remapper.EnhancedRemapper.mapFieldName(EnhancedRemapper.java:107)
        at net.md_5.ss.remapper.ClassRemapper.visitField(ClassRemapper.java:71)
        at org.objectweb.asm.ClassReader.readField(ClassReader.java:768)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:689)
        at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
        at net.md_5.ss.model.ClassInfo.remap(ClassInfo.java:120)
        at net.md_5.ss.SpecialSource.map(SpecialSource.java:96)
        at net.md_5.ss.SpecialSource.main(SpecialSource.java:44)
Failed to apply class mappings.

Second run

Downloading unmapped vanilla jar...
Removing log4j...
Applying class mappings...
Applying member mappings...
Exception in thread "main" java.util.zip.ZipException: zip END header not found
        at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1607)
        at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1497)
        at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1504)
        at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1308)
        at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1271)
        at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:733)
        at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850)
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:248)
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
        at java.base/java.util.jar.JarFile.<init>(JarFile.java:350)
        at java.base/java.util.jar.JarFile.<init>(JarFile.java:321)
        at java.base/java.util.jar.JarFile.<init>(JarFile.java:287)
        at net.md_5.ss.SpecialSource.map(SpecialSource.java:69)
        at net.md_5.ss.SpecialSource.main(SpecialSource.java:44)
Failed to apply member mappings.
@archer-321
Copy link

./remap.sh: line 41: zip: command not found makes me believe that you don't have zip in your PATH.

If you're running the bash file with Git Bash on Windows, you could try this Stackoverflow answer. Alternatively, you could install MSYS2 and use pacman to install zip if the base installation doesn't provide it (pacman -S zip).

Sadly, I can't help you if you're using macOS, but if their base system doesn't include zip, installing something like Info-ZIP would be the first step. I'm using Info-ZIP on my (GNU/Linux) distribution to provide the zip binary.

@archer-321 archer-321 added the support request Support requests and problems with a local set-up label Jul 22, 2022
@Verdanix
Copy link

I followed the StackOverflow post, and it still occurs. I only get the first error so far

@archer-321
Copy link

If the error message still contains zip: command not found, the zip binary is not in your PATH (in Bash, you should be able to confirm that with which zip).

Modern (or custom) installations of Git might have different install paths. You can print the current contents of PATH with

echo $PATH

While I expect Git Bash's built-in bin directory path to be in a more Unix-like format, you can most likely identify it in the Git installation directory.

Alternatively, you could try a project like MSYS2. Even if its base group doesn't contain zip, MSYS ships with a package manager, so you should be able to install zip with

pacman -S zip

@Verdanix
Copy link

Verdanix commented Jul 27, 2022

It doesn't contain the error when I run "which zip", however when I try ./build.sh it shows the error again.

@archer-321
Copy link

I can confirm that in my default installation of Git on Windows, there's no copy of Info-ZIP's ZIP installed.

@roccodev surprisingly, Windows doesn't have much support for managing ZIP files from the command line. Since it is not straightforward to mix MSYS2 installations and Git for Windows (because of Cygwin problems), do you think we should provide a more self-contained means to modify the Minecraft JAR? IIRC, Java itself has (limited) support for managing JAR/ZIP files.


@PrismoidNW meanwhile, you could try manually removing log4j from the Minecraft JAR file:

  1. Delete the work directory in the KigPaper root directory
  2. Run ./build.sh once in Git Bash (this should still fail as zip is not found)
  3. Navigate to work/1.8.8 in the KigPaper directory
  4. Rename 1.8.8-nolog4j.jar to 1.8.8-nolog4j.zip
  5. Open the ZIP file in Windows Explorer
  6. Delete the log4j folder in org/apache/logging
  7. Rename 1.8.8-nolog4j.zip back to 1.8.8-nolog4j.jar
  8. Delete 1.8.8-cl.jar if it exists
  9. Run ./build.sh again

Please note that, currently, you need Java 8 to build KigPaper this way: java -version should print something like 1.8.0_342.
Additionally, you will need a working installation of Apache Maven in your PATH.

If you run into the java.util.zip.ZipException: zip END header not found issue again if any of the previous steps go wrong (e.g. if you try to use Java 17 to apply class mappings), you should delete work/1.8.8/1.8.8-cl.jar and try again.

@Verdanix
Copy link

I found out that the org/apache/logging folder is just empty.

@Smart123s
Copy link

Smart123s commented Aug 19, 2022

./remap.sh: line 41: zip: command not found makes me believe that you don't have zip in your PATH.

If you're running the bash file with Git Bash on Windows, you could try this Stackoverflow answer. Alternatively, you could install MSYS2 and use pacman to install zip if the base installation doesn't provide it (pacman -S zip).

Sadly, I can't help you if you're using macOS, but if their base system doesn't include zip, installing something like Info-ZIP would be the first step. I'm using Info-ZIP on my (GNU/Linux) distribution to provide the zip binary.

./remap.sh: line 41: zip: command not found is also present in the GitHub Actions log.

https://github.com/ProjectKig/KigPaper/runs/6780682041?check_suite_focus=true#step:7:185

I had similar issues when I cloned the repo on Windows then used dos2unix * to convert CRLF to LF. Then either running ./build.sh in WSL or in Windows via docker build container threw me the same issue that was mentioned above.

I cloned the repo in WSL then ran the docker build container on Windows without any issues. Then I tried running ./build.sh in WSL which failed, but I suppose that's because I was using Java 18 and was lazy to downgrade to an actually supported Java version.

docker command: docker build -t ghcr.io/projectkig/kigpaper/kig-paper-builder:ver-1.8.8 -f docker\build.Dockerfile .

Then I used the following command to pull the compiled paper.jar from the build container: docker run -v C:/Users/USERNAME/Desktop:/opt/mount --rm --entrypoint cp ghcr.io/projectkig/kigpaper/kig-paper-builder:ver-1.8.8 /build/PaperSpigot-Server/target/paperspigot-1.8.8-R0.1-SNAPSHOT.jar /opt/mount/ (thanks for the copy command)


EDIT: starting the server gave this error:

The crash below is Windows only!

PS C:\lol> & 'C:\Program Files\Java\jre1.8.0_333\bin\java' -jar .\paperspigot-1.8.8-R0.1-SNAPSHOT.jar
Loading libraries, please wait...
java.lang.NoClassDefFoundError: Could not initialize class org.fusesource.jansi.WindowsAnsiOutputStream
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.apache.logging.log4j.core.appender.ConsoleAppender.getOutputStream(ConsoleAppender.java:128)
        at org.apache.logging.log4j.core.appender.ConsoleAppender.getManager(ConsoleAppender.java:104)
        at org.apache.logging.log4j.core.appender.ConsoleAppender.createAppender(ConsoleAppender.java:99)
        at org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:53)
        at org.apache.logging.log4j.core.LoggerContext.<init>(LoggerContext.java:63)
        at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:217)
        at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:114)
        at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:81)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:83)
        at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:34)
        at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:387)
        at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:322)
        at net.minecraft.server.v1_8_R3.MinecraftServer.<clinit>(MinecraftServer.java:53)
        at org.bukkit.craftbukkit.Main.main(Main.java:201)

@roccodev
Copy link
Member

The Docker issue has been fixed in e1bae31, could you try building that instead?

@Smart123s
Copy link

The server startup issue was Windows only, so I've opened a new issue at #17

build.sh didn't crash in ArchWSL after switching to Java 8. (it's still building, I'll edit once it finishes, but it got past the crash point), although that shouldn't be related to a change in the docker container, since I wasn't using docker.

@Verdanix
Copy link

Verdanix commented Sep 3, 2022

Yea, I still get the issue even after the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support request Support requests and problems with a local set-up
Projects
None yet
Development

No branches or pull requests

5 participants