Opened 4 years ago
Last modified 4 years ago
#1865 accepted defect
Issues in macOS jbigi and jcpuid with i2p-0.9.27/core/c/jbigi/build_jbigi.sh and i2p-0.9.27/core/c/jcpuid/build.sh
Reported by: | Aniba | Owned by: | zzz |
---|---|---|---|
Priority: | minor | Milestone: | undecided |
Component: | other | Version: | 0.9.27 |
Keywords: | Cc: | ||
Parent Tickets: | Sensitive: | no |
Description
I found these performing a native compile of jbigi for macOS. I suggest modifying the shell scripts and documentation.
For i2p-0.9.27/core/c/jbigi/build_jbigi.sh
:
There is no /usr/local/lib/libgmp.so
dynamic library for macOS. The easiest way to get this is with Macports. These commands download, compile, and set Macports gcc as the default compiler if you put /opt/local/bin
first in the PATH
environment variable.
sudo port install gmp sudo port select --list gcc sudo port select --set gcc mp-gcc6 export PATH=/opt/local/bin:$PATH gcc --version
Now replace /usr/local/lib
with /opt/local/lib
in the file core/c/jbigi/build_jbigi.sh
.
$ diff build_jbigi.sh build_jbigi.sh.orig 81c81 < LIBPATH="-L.libs -L/opt/local/lib" --- > LIBPATH="-L.libs -L/usr/local/lib"
Now build the dynamic library:
./build.sh dynamic sudo cp lib/libjbigi.jnilib /path/to/i2p
The documentation calls this file libjbigi.so
, which isn't the case on macOS.
A successful build looks like this in http://127.0.0.1:7657/logs.jsp :
Jbigi: Locally optimized library libjbigi-osx-corei_64.jnilib loaded from file
There are also issues with jcpuid
. For i2p-0.9.27/core/c/jcpuid/build.sh
There is the misspelling dawrin
the Java INCLUDES
path. This should be:
INCLUDES="-I. -Iinclude -I${JAVA_HOME}/include/ -I${JAVA_HOME}/include/darwin/"
This allows for a successful build:
cd ../jcpuid/ build.sh sudo cp lib/freenet/support/CPUInformation/libjcpuid-x86-darwin.jnilib /path/to/i2p/libjcpuid-x86-osx.jnilib
But I2P fails to load this file. The logs say:
Launching a JVM... Picked up JAVA_TOOL_OPTIONS: -Djava.awt.headless=true WrapperManager: Initializing... Starting I2P 0.9.27-0 WARNING: The resource libjcpuid-x86_64-osx.jnilib was not a valid library for this platform java.lang.UnsatisfiedLinkError: /private/var/folders/89/wdg033px169fj4vq8kwh_xch0000gn/T/i2p-tM7I5QHu.tmp/libjcpuid.so: dlopen(/private/var/folders/89/wdg033px169fj4vq8kwh_xch0000gn/T/i2p-tM7I5QHu.tmp/libjcpuid.so, 1): no suitable image found. Did find: /private/var/folders/89/wdg033px169fj4vq8kwh_xch0000gn/T/i2p-tM7I5QHu.tmp/libjcpuid.so: malformed mach-o image: symbol table underruns __LINKEDIT WARNING: Resource name [libjcpuid-x86-osx.jnilib] was not found WARNING: Native CPUID library jcpuid not loaded - will not be able to read CPU information using CPUID INFO: Locally optimized library libjbigi-osx-corei_64.jnilib loaded from file
Subtickets
Change History (6)
comment:1 Changed 4 years ago by
Component: | unspecified → other |
---|
comment:2 Changed 4 years ago by
Owner: | set to zzz |
---|---|
Status: | new → accepted |
Fixed typo, added some docs from above, in def5538b083766e526d06defe407dc44f90d8217 0.9.27-6
Awaiting your test results from comment 1
comment:3 Changed 4 years ago by
The test didn't fix the issue. I did the following from the i2p
directory, trying the locally compiled libjcpuid.jnilib with different names in different locations. The error log is below.
sudo mv ./lib/jbigi.jar ./jbigi.jar.bak sudo mv libjcpuid-x86_64-osx.jnilib libjcpuid-x86-osx.jnilib # restart sudo mv libjcpuid-x86-osx.jnilib libjcpuid.jnilib # restart sudo mv libjcpuid.jnilib ./lib/libjcpuid.jnilib # restart
wrapper.log
:
Processor: uninitialized (unrecognized) ... Launching a JVM... Picked up JAVA_TOOL_OPTIONS: -Djava.awt.headless=true WrapperManager: Initializing... Starting I2P 0.9.27-0 WARNING: Resource name [libjcpuid-x86-osx.jnilib] was not found WARNING: Native CPUID library jcpuid not loaded - will not be able to read CPU information using CPUID INFO: Locally optimized library libjbigi-osx-corei_64.jnilib loaded from file TERM trapped. Shutting down. CRIT [r 1 shutdown] net.i2p.router.Router : Shutting down the router... CRIT [r 1 shutdown] net.i2p.router.Router : Starting final shutdown(3) CRIT [r 1 shutdown] net.i2p.router.Router : Shutdown(3) complete <-- Wrapper Stopped --> Wrapper Started as Daemon Java Service Wrapper Community Edition 64-bit 3.5.25 Copyright (C) 1999-2014 Tanuki Software, Ltd. All Rights Reserved. http://wrapper.tanukisoftware.com Launching a JVM... Picked up JAVA_TOOL_OPTIONS: -Djava.awt.headless=true WrapperManager: Initializing... Starting I2P 0.9.27-0 WARNING: Resource name [libjcpuid-x86-osx.jnilib] was not found WARNING: Native CPUID library jcpuid not loaded - will not be able to read CPU information using CPUID INFO: Locally optimized library libjbigi-osx-corei_64.jnilib loaded from file
comment:4 Changed 4 years ago by
Also, compiling a native version of libjbigi.jnilib
has made a huge difference in CPU usage.
I had a big problem with the original install using 100 percent of my CPU. The only fix was to throttle the bandwidth down to nearly nothing.
After using this natively compiled libjbigi.jnilib
, this 100% CPU problem goes away and I am able to increase the bandwidth substantially.
I do not see this fix mentioned in the faqs that discuss the 100% CPU problem — I'd suggest adding this to the faqs and finding a way to include native libgmp
support because the original install configuration has poor CPU performance.
comment:5 Changed 4 years ago by
Huh? We do have native libgmp support. That's what jbigi and jcpuid is for. We ship jbigi.jar containing 7 different architectures for osx.
If the original installation didn't use any of the shipped jbigis, or used the wrong one, or the one it picked is too slow, please enter a separate ticket for that. Include logs, I2P version info, and hardware and OS info. Note that the bundled jbigis changed in 0.9.26 installations, and they were included in the 0.9.27 update.
Looks like the file needs to be named libjcpuid.jnilib
Name it to that and it should load it.
For testing, to make sure you aren't loading out of jbigi.jar, move it out of the lib/ dir
I will take a look at your other suggestions.