pog5/minecraft-freebsd

Fails to build on FreeBSD 14.0

justdie386 opened this issue · 14 comments

[  0% 1/1] cd /home/justdie/Downloads/lwjgl3/work/lwjgl3-3.3.3 && /usr/local/bin/cmake -E env JAVACMD=/usr/local/openjdk17/bin/java JAVA8_HOME=/usr/local/openjdk8 ant all && /usr/local/bin/cmake -E env JAVACMD=/usr/local/openjdk17/bin/java JAVA8_HOME=/usr/local/openjdk8 ant release -Dbuild.offline=yes -Djavadoc.skip=yes
Buildfile: /home/justdie/Downloads/lwjgl3/work/lwjgl3-3.3.3/build.xml

init:

check-dependencies:

-compile-generator:

compile-templates:

generate:

compile:

compile-tests:

compile-native:

compile-native-platform:
 [Compiler] cc --version: "FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)"
 [Compiler] /home/justdie/Downloads/lwjgl3/work/lwjgl3-3.3.3/modules/lwjgl/tinyfd/src/main/c/tinyfiledialogs.c:3295:30: warning: call to undeclared function 'realpath'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
 [Compiler]       lAllocatedCharString = realpath(lBuff,NULL); /*same as canonicalize_file_name*/
 [Compiler]                              ^
 [Compiler] /home/justdie/Downloads/lwjgl3/work/lwjgl3-3.3.3/modules/lwjgl/tinyfd/src/main/c/tinyfiledialogs.c:3295:28: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion]
 [Compiler]       lAllocatedCharString = realpath(lBuff,NULL); /*same as canonicalize_file_name*/
 [Compiler]                            ^ ~~~~~~~~~~~~~~~~~~~~
 [Compiler] 1 warning and 1 error generated.
FAILED: CMakeFiles/lwjgl3 /home/justdie/Downloads/lwjgl3/work/.build/CMakeFiles/lwjgl3 
cd /home/justdie/Downloads/lwjgl3/work/lwjgl3-3.3.3 && /usr/local/bin/cmake -E env JAVACMD=/usr/local/openjdk17/bin/java JAVA8_HOME=/usr/local/openjdk8 ant all && /usr/local/bin/cmake -E env JAVACMD=/usr/local/openjdk17/bin/java JAVA8_HOME=/usr/local/openjdk8 ant release -Dbuild.offline=yes -Djavadoc.skip=yes
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make: stopped in /home/justdie/Downloads/lwjgl3```
pog5 commented

Try disabling the warning-to-error conversion for that specific warning

Im rather unsure how to do that... I don't have much experience tweaking compilers

yeah i’ve been trying to figure out how to disable this goddamn error for the past 2 hours and at this point i think it’s probably faster to fix the code than to deal with cmake

No idea, but hit me up if you figure it out

Any fixes?

I think I found a fix, we need somebody to go onto a vm, compile it on 13.2 FreeBSD, and then upload a precompiled version of lwjgl3, and then we need put the libraries contents into the correct directories for Minecraft to load.

There used to be a precompiled version on this repo but recently the creator changed it all and it’s gone, the precompiled used to work perfectly for me

If we go into older versions of the repo we could find it but I’m not on FreeBSD for now so I’m not gonna bother

I fixed it, do you want a compilied version with the jars and libs that you can copy and paste into those paths, that the owner told us to check, when our build was completed? It works for me, FreeBSD 14.0. Let me know

I used this repo:
https://github.com/LWJGL/lwjgl3
And then I copied the cmake file from the current repo into that repo, I then used the cd command to the second repo, and used the following command:
/usr/local/bin/cmake -E env JAVACMD=/usr/local/openjdk17/bin/java JAVA8_HOME=/usr/local/openjdk8 ant all && /usr/local/bin/cmake -E env JAVACMD=/usr/local/openjdk17/bin/java JAVA8_HOME=/usr/local/openjdk8 ant release -Dbuild.offline=yes -Djavadoc.skip=yes
Then I made two files on my desktop:
Jars -- Inlcuding all the jars in the Release which was in the bin folder (in the repo I used to compile lwjgl3), then I did a search for .jars and copied and pasted all of them there
Libs -- I went into the repo I made my build, and typed .so and copied all of the files to the libs folder
Second Step:
For our jars I cd-ed to the directory and did this command:
sudo cp -r * /usr/local/share/java/classes/lwjgl3
For our libs I went into the directory and did this:
sudo cp -r * /usr/local/lib/lwjgl3
Then I used my Minecraft launcher, and it worked!
Hope this helps you out.

pog5 commented

There used to be a precompiled version on this repo but recently the creator changed it all and it’s gone, the precompiled used to work perfectly for me

I added a link to a older commit of the repo to the README file, try using that one instead

I've just corrected this missing function realpath() compilation error on freebsd in tinyfiledialogs v3.17.4
Please update your version of LWJGL with latest tinyfiledialogs from
https://sourceforge.net/projects/tinyfiledialogs

@Gamer100Dev's solution worked for me.

Yes, I'm on FreeBSD 14.0 RELEASE

To be clearer, git clone https://github.com/LWGJL/lwjgl3.

/usr/local/bin/cmake -E env JAVACMD=/usr/local/openjdk17/bin/java JAVA8_HOME=/usr/local/openjdk8 ant all && /usr/local/bin/cmake -E env JAVACMD=/usr/local/openjdk17/bin/java JAVA8_HOME=/usr/local/openjdk8 ant release -Dbuild.offline=yes -Djavadoc.skip=yes

  • Run: # mkdir /usr/local/share/java/classes/lwjgl3 /usr/local/lib/lwjgl3

  • Run: # find /PATH/TO/GIT/lwjgl3 -name "*.so" -exec cp {} /usr/local/lib/lwjgl3/ \;

  • Run: find /PATH/TO/GIT/lwjgl3 -name "*.jar" -exec cp {} /usr/local/share/java/classes/lwjgl3/ \;

  • Install minecraft-client & openjdk17-jre:
    # pkg install minecraft-client openjdk17-jre

  • Overwrite the original minecraft-runtime file with the one from the extracted tar:
    # cp /PATH/TO/EXTRACTED/TAR/lwjgl3/minecraft-runtime /usr/loca/share/minecraft-client/minecraft-runtime

  • In PrismLauncher, go to Settings > Java and set "Java Path" to:
    /usr/local/share/minecraft-client/minecraft-runtime

VVD commented

Use games/lwjgl3 from ports.