OpenJDK - undefined symbol _ZN23G1SATBCardTableModRefBS24write_ref_array_pre_work - runtime-error

After successfully building OpenJDK on linux, I'm facing a runtime error on executing java
This is the error -
rkbalgi#osboxes ~/jvm_work/openjdk8 $ ./build/linux-x86_64-normal-server-release/jdk/bin/java -version
Error: dl failure on line 864
Error: failed /home/rkbalgi/jvm_work/openjdk8/build/linux-x86_64-normal-server-release/jdk/lib/amd64/server/libjvm.so, because /home/rkbalgi/jvm_work/openjdk8/build/linux-x86_64-normal-server-release/jdk/lib/amd64/server/libjvm.so: undefined symbol: _ZN23G1SATBCardTableModRefBS24write_ref_array_pre_workIP7oopDescEEvPT_i
The bootstrap JDK used during build is -
rkbalgi#osboxes ~/jvm_work/openjdk8 $ /usr/lib/jvm/java-7-openjdk-amd64/bin/java -version
java version "1.7.0_95"
OpenJDK Runtime Environment (IcedTea 2.6.4) (7u95-2.6.4-3)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
OS Info -
rkbalgi#osboxes ~/jvm_work/openjdk8 $ uname -a
Linux osboxes 4.4.0-53-generic #74-Ubuntu SMP Fri Dec 2 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
Any pointers to what could be the issue?

This error can be fixed by moving template method write_ref_array_pre_work to header g1SATBCardTableModRefBS.hpp as described here (sorry, link in Chinese, but this is the only solution that I found)

In $hotspot/src/share/vm/gc_implementation/g1 ,there is two files.
g1SATBCardTableModRefBS.cpp
g1SATBCardTableModRefBS.hpp
you should move template method write_ref_array_pre_work from g1SATBCardTableModRefBS.cpp to g1SATBCardTableModRefBS.hpp
I added it to g1SATBCardTableModRefBS.hpp just like the blow.
Notice:You should change G1SATBCardTableModRefBS:: (T* dst, int count) to (T* dst, int count),or you will get extra qualification error in C++
template <class T> void write_ref_array_pre_work(T* dst, int count) {
if (!JavaThread::satb_mark_queue_set().is_active()) return;
T* elem_ptr = dst;
for (int i = 0; i < count; i++, elem_ptr++) {
T heap_oop = oopDesc::load_heap_oop(elem_ptr);
if (!oopDesc::is_null(heap_oop)) {
enqueue(oopDesc::decode_heap_oop_not_null(heap_oop));
}
}
}
It worked for me when I'm using make version 3.8.1.

Related

GNU make 3.82 run time error on Ubuntu-20.04: Segmentation fault (core dumped)

I downloaded gnu-make-3.82 from GNU and make & install it on a specific directory (e.g. dir) on my Ubuntu-20.04 machine.
Then I run
$file dir/make
It returns:
ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=ef2934bdbc32938713fd4cb1c9a733e8b6785af0, for GNU/Linux 3.2.0, with debug_info, not stripped
When I run
$dir/make --version
It returns:
GNU Make 3.82
Built for x86_64-unknown-linux-gnu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
When I run it with even the simplest Makefile, it generates the error:
Segmentation fault (core dumped)
Why? What additional work I need to do to make it work well?
According to tips from #steeldriver, I made the following changes to dir.c.
diff --git a/dir.c b/dir.c
index adbb8a9..c343e4c 100644
--- a/dir.c
+++ b/dir.c
## -1299,15 +1299,40 ## local_stat (const char *path, struct stat *buf)
}
#endif
+/* Similarly for lstat. */
+#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
+# ifndef VMS
+# ifndef HAVE_SYS_STAT_H
+int lstat (const char *path, struct stat *sbuf);
+# endif
+# else
+ /* We are done with the fake lstat. Go back to the real lstat */
+# ifdef lstat
+# undef lstat
+# endif
+# endif
+# define local_lstat lstat
+#elif defined(WINDOWS32)
+/* Windows doesn't support lstat(). */
+# define local_lstat local_stat
+#else
+static int
+local_lstat (const char *path, struct stat *buf)
+{
+ int e;
+ EINTRLOOP (e, lstat (path, buf));
+ return e;
+}
+#endif
+
void
dir_setup_glob (glob_t *gl)
{
gl->gl_opendir = open_dirstream;
gl->gl_readdir = read_dirstream;
gl->gl_closedir = free;
+ gl->gl_lstat = local_lstat;
gl->gl_stat = local_stat;
- /* We don't bother setting gl_lstat, since glob never calls it.
- The slot is only there for compatibility with 4.4 BSD. */
}
Then remake the make and run it. It works fine without any warnings or erros.

Python 3.8.0a3 failed to get the Python codec of the filesystem encoding

When I call the embedded python from my c++ app, the application crashes. Something in _PyCodec_Lookup is not working. Debugging seems to indicate the error comes from this line in file codecs.c:
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
if (interp->codec_search_path == NULL && _PyCodecRegistry_Init())
goto onError;
interp->codec_search_path is NULL and _PyCodecRegistry_Init() returns -1.
This problems is already known; Solutions like removing python27, or setting environment variables PYTHONPATH or PYTHONHOME to either "" or the src path do not work.
I link to cpython version 3.8.0a3 which I've compiled with the included scripts inside the PCBUILD folder, using the same compiler as my applications (MSVC 15 2017).
The OS is windows 8.1 64 bit.
My application links to the produced binary python38.dll / python38.lib successfully but then crashes at runtime, and I have no idea what might cause the trouble - people suggest the environment is polluted, but it must not depend on the system's environment. How would I confidently ship the app to other people's computers? Did I maybe miss some compile flags or defines?
I'm sure you are, but you are doing this after Py_Initialize ?
I include the python3.8 dll but when starting up I take the executable full
path and then add that to the python path (the code below is not tested but
it's roughly what I do)
void py_add_to_path (const char *path)
{
PyObject *py_cur_path, *py_item;
char *new_path;
int wc_len, i;
wchar_t *wc_new_path;
char *item;
new_path = strdup(path);
py_cur_path = PySys_GetObject("path");
for (i = 0; i < PyList_Size(py_cur_path); i++) {
char *tmp = strappend(new_path, PATHSEP);
myfree(new_path);
new_path = tmp;
py_item = PyList_GetItem(py_cur_path, i);
if (!PyUnicode_Check(py_item)) {
continue;
}
item = py_obj_to_str(py_item);
if (!item) {
continue;
}
tmp = strappend(new_path, item);
free(new_path);
new_path = tmp;
free(item);
}
/* Convert to wide chars. */
wc_len = sizeof(wchar_t) * (strlen(new_path) + 1);
wc_new_path = (wchar_t *) malloc(wc_len, "wchar str");
mbstowcs(wc_new_path, new_path, wc_len);
PySys_SetPath(wc_new_path);
}
Seems a bit old now but looks like there is need to add the Lib folder including all the python system files to the search paths of the application.
Take a look at this Python port for UWP
It has an embedded python34app.zip that includes the codec files.

how to make loadable kernel module on solaris? no linux

1. how to create loadable kernel module on solaris 11?
simple loadable kernel module (hello world).
I searched, but only showed how to create a Linux kernel module.
in linux, header linux/kernel.h, but not included header on solaris
2. how to compile loadable kernel module on solaris 11?
gcc -D_KERNEL -m64 -c cpluscplus.cpp
Is it appropriate to compile as above?
64bit, x86
Here's the minimal hello world kernel module I can come up with:
#include <sys/modctl.h>
#include <sys/cmn_err.h>
/*
* Module linkage information for the kernel.
*/
static struct modlmisc modlmisc = {
&mod_miscops, "test module"
};
static struct modlinkage modlinkage = {
MODREV_1, (void *)&modlmisc, NULL
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
int
_info(struct modinfo *modinfop)
{
cmn_err(CE_NOTE, "hello kernel");
return (mod_info(&modlinkage, modinfop));
}
Compiling this as 64-bit binary with Oracle Developer Studio 12.6 and the Solaris linker like so:
cc -D_KERNEL -I include -m64 -c foomod.c
ld -64 -z type=kmod -znodefs -o foomod foomod.o
For GCC you will likely need a distinct set of options.
Then load it with:
modload ./foomod
This will complain about signature verification. This is innocuous unless you are running the system with Verified Boot enabled.
Check that module is loaded:
# modinfo -i foomod
ID LOADADDR SIZE INFO REV NAMEDESC
312 fffffffff7a8ddc0 268 -- 1 foomod (test module)
# dmesg | tail -1
Mar 16 12:22:57 ST091 foomod: [ID 548715 kern.notice] NOTICE: hello kernel
This works on Solaris 11.4 SRU 33 running on x86 machine (VirtualBox instance in fact).

Minecraft Worlds Crash

Please Help My Minecraft Crashes When I join A World. BTW I am using mods. Here Is My Crash Report
---- Minecraft Crash Report ----
WARNING: coremods are present: Java8CheckerCoremod
(Pixelmon-1.8-4.1.1-universal.jar) Contact their authors BEFORE
contacting forge
// Ooh. Shiny.
Time: 1/17/16 11:44 AM Description: Exception in server tick loop
java.lang.NullPointerException: Exception in server tick loop at
com.pixelmonmod.pixelmon.worldGeneration.structure.towns.ComponentTownPart.func_74875_a(ComponentTownPart.java:55)
at
net.minecraft.world.gen.structure.StructureStart.func_75068_a(StructureStart.java:45)
at
net.minecraft.world.gen.structure.MapGenStructure.func_175794_a(MapGenStructure.java:93)
at
net.minecraft.world.gen.ChunkProviderGenerate.func_73153_a(ChunkProviderGenerate.java:415)
at
net.minecraft.world.gen.ChunkProviderServer.func_73153_a(ChunkProviderServer.java:269)
at net.minecraft.world.chunk.Chunk.func_76624_a(Chunk.java:1126) at
net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:52)
at
net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12)
at
net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344)
at
net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302)
at
net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12)
at
net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:117)
at
net.minecraft.world.gen.ChunkProviderServer.func_73158_c(ChunkProviderServer.java:92)
at
net.minecraft.server.MinecraftServer.func_71222_d(MinecraftServer.java:302)
at
net.minecraft.server.integrated.IntegratedServer.func_71247_a(IntegratedServer.java:112)
at
net.minecraft.server.integrated.IntegratedServer.func_71197_b(IntegratedServer.java:126)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:438)
at java.lang.Thread.run(Thread.java:745)
A detailed walkthrough of the error, its code path and all known
details is as follows:
-- System Details -- Details: Minecraft Version: 1.8 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_25,
Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM
(mixed mode), Oracle Corporation Memory: 876196800 bytes (835 MB) /
2034081792 bytes (1939 MB) up to 2134114304 bytes (2035 MB) JVM
Flags: 6 total;
-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump
-Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M IntCache: cache: 11, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.10 FML v8.0.99.99 Minecraft
Forge 11.14.4.1577 7 mods loaded, 7 mods active States: 'U' =
Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' =
Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E'
= Errored UCHIJAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) UCHIJAA FML{8.0.99.99} [Forge Mod Loader]
(forge-1.8-11.14.4.1577.jar) UCHIJAA Forge{11.14.4.1577} [Minecraft
Forge] (forge-1.8-11.14.4.1577.jar) UCHIJAA customnpcs{1.8.0}
[CustomNPCs] (CustomNPCs_1.8.0.jar) UCHIJAA cfm{3.5.1}
[ยง9MrCrayfish's Furniture Mod] (MrCrayfishFurnitureModv3.5.1(1.8).jar)
UCHIJAA pixelmon{4.1.1} [Pixelmon] (Pixelmon-1.8-4.1.1-universal.jar)
UCHIJAA worldedit{6.1} [WorldEdit] (worldedit-forge-mc1.8-6.1.jar)
Loaded coremods (and transformers): Java8CheckerCoremod
(Pixelmon-1.8-4.1.1-universal.jar)
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread. Profiler Position: N/A (disabled) Player Count:
0 / 8; [] Type: Integrated Server (map_client.txt) Is Modded:
Definitely; Client brand changed to 'fml,forge'
You need to delete all the mods and start again as you have installed some that have overlapped.

Cross platform way of testing whether a file is a directory

Currently I have some code like (condensed and removed a bunch of error checking):
dp = readdir(dir);
if (dp->d_type == DT_DIR) {
}
This works swimmingly on my Linux machine. However on another machine (looks like SunOS, sparc):
SunOS HOST 5.10 Generic_127127-11 sun4u sparc SUNW,Ultra-5_10
I get the following error at compile time:
error: structure has no member named `d_type'
error: `DT_DIR' undeclared (first use in this function)
I thought the dirent.h header was crossplatform (for POSIX machines). Any suggestions.
Ref http://www.nexenta.org/os/Porting_Codefixes:
The struct dirent definition in solaris does not contain the d_type field. You would need to make the changes as follows
if (de->d_type == DT_DIR)
{
return 0;
}
changes to
struct stat s; /*include sys/stat.h if necessary */
..
..
stat(de->d_name, &s);
if (s.st_mode & S_IFDIR)
{
return 0;
}
Since stat is also POSIX standard it should be more cross-platform. But you may want to use if ((s.st_mode & S_IFMT) == S_IFDIR) to follow the standard.

Resources