仅在声明std :: map <int,int>

如何解决仅在声明std :: map <int,int>

我正在尝试构建和加载共享库SO文件,并且加载也很好。当我添加以下行以创建地图时,它无法加载,并且无法加载。它可以编译并构建良好。我正在使用Eclipse和CDT。

编辑1:只需添加map 测试,SO文件的大小便从213 KB增加到253 KB。我不确定负载问题是否与大小增加有关。 下面是我的Java进程的命令,该命令正在尝试加载SO文件。

[java,-Xms256M,-Xmx512M,-XX:+ UseG1GC,-XX:+ ScavengeBeforeFullGC,-XX:+ ExplicitGCInvokesConcurrentAndUnloadsClasses,-XX:+ UseStringDeduplication,-XX:MaxMetaspaceSize = 300M,-XX:MetaspaceSize = 100M, -XX:CompressedClassSpaceSize = 128M,-Djava.awt.headless = true,-Dspring.profiles.active =产品驱动程序,测试服务-5.0.4-SNAPSHOT,-Ddcx.cs.rabbitmq.host = localhost,-Ddcx .cs.rabbitmq.port = 5672,-jar,测试服务-5.0.4-SNAPSHOT.jar,-Dfile.encoding = UTF-8,-Xdebug,-Xrunjdwp:transport = dt_socket,server = y,address = 5766 ,suspend = n,-Dcom.sun.management.jmxremote,-Dcom.sun.management.jmxremote.port = 5300,-Dcom.sun.management.jmxremote.rmi.port = 5300,-Dcom.sun.management.jmxremote .authenticate = false,-Dcom.sun.management.jmxremote.ssl = false,-Djava.rmi.server.hostname = 127.0.0.1,-Dspring.liveBeansView.mbeanDomain,-Dspring.application.admin.enabled = true,- DLOGSERIAL = null]

编辑2:在我的目标环境中的/ usr / lib /中已经存在libstdc ++。so.6

using namespace std;
map<int,int> test;

下面是我的制作文件

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include trunk/src/subdir.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables 

# All Target
all: libLinuxFTDI.so

# Tool invocations
libLinuxFTDI.so: $(OBJS) $(USER_OBJS)
    @echo 'Building target: $@'
    @echo 'Invoking: Cross G++ Linker'
    arm-linux-gnueabihf-g++ -L"C:\Users\srika\OneDrive\Desktop\LinuxFTDI\trunk\ftd2xx\arm" -shared -Wl,-soname=mftdi -o "libLinuxFTDI.so" $(OBJS) $(USER_OBJS) $(LIBS)
    @echo 'Finished building target: $@'
    @echo ' '

# Other Targets
clean:
    -$(RM) $(LIBRARIES)$(CC_DEPS)$(C++_DEPS)$(OBJS)$(C_UPPER_DEPS)$(CXX_DEPS)$(C_DEPS)$(CPP_DEPS) libLinuxFTDI.so
    -@echo ' '

.PHONY: all clean dependents

-include ../makefile.targets

它是从我的eclipse选项派生的。

下面是Java崩溃报告

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x76f415b0,pid=30591,tid=0x4fe5f470
#
# JRE version: OpenJDK Runtime Environment (8.0_121-b13) (build 1.8.0_121-internal-b13)
# Java VM: OpenJDK Client VM (25.121-b13 mixed mode linux-aarch32 )
# Problematic frame:
# C  [ld-linux-armhf.so.3+0x85b0]
#
# Core dump written. Default location: /opt/dcx-cs/driver/core or core.30591
#
# If you would like to submit a bug report,please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x50526800):  JavaThread "IPM-2B" daemon [_thread_in_native,id=30899,stack(0x4fe10000,0x4fe60000)]

siginfo: si_signo: 11 (SIGSEGV),si_code: 1 (SEGV_MAPERR),si_addr: 0x00000004

Registers:
R0=0x00000010
R1=0x40000000
R2=0x00000000
R3=0x00000000
R4=0x00000001
R5=0x00000000
R6=0x00000001
R7=0x4fe5d6f0
R8=0x76f61000
R9=0x00000001
R10=0x76e18afd
R11=0x52878058
R12=0x52877ed4
R13=0x4fe5d6e0
R14=0x76f47321
R15=0x76f415b0

Top of Stack: (sp=0x4fe5d6e0)
0x4fe5d6e0:   00000047 00000000 00000001 52878058
0x4fe5d6f0:   00000000 00000065 00000000 0000002c
0x4fe5d700:   00000077 00000000 00000000 00000000
0x4fe5d710:   76f61568 00000000 00000004 4fe5d6e8
0x4fe5d720:   00000000 00000000 00000084 52878210
0x4fe5d730:   00000001 00000001 4fe5d6e8 52877ed0
0x4fe5d740:   00000002 4fe5d6e8 00000000 00000000
0x4fe5d750:   00000000 00000045 00000000 00000089 

Instructions: (pc=0x76f415b0)
0x76f41590:   00 2b 40 f0 f0 84 fb 61 3a 6c db f8 7c 30 02 f0
0x76f415a0:   01 04 db f8 34 20 00 2b 0c bf 00 23 04 f0 01 03
0x76f415b0:   52 68 ba 62 1b b3 db f8 2c 30 5b 68 59 68 21 b1
0x76f415c0:   db f8 00 20 0a 44 cb f8 10 22 7a 6b c3 f8 04 b0 

Register to memory mapping:

R0=0x00000010 is an unknown value
R1=0x40000000 is an unknown value
R2=0x00000000 is an unknown value
R3=0x00000000 is an unknown value
R4=0x00000001 is an unknown value
R5=0x00000000 is an unknown value
R6=0x00000001 is an unknown value
R7=0x4fe5d6f0 is pointing into the stack for thread: 0x50526800
R8=0x76f61000: <offset 0x28000> in /lib/ld-linux-armhf.so.3 at 0x76f39000
R9=0x00000001 is an unknown value
R10=0x76e18afd: <offset 0xafd> in /lib/libdl.so.2 at 0x76e18000
R11=0x52878058 is an unknown value
R12=0x52877ed4 is an unknown value
R13=0x4fe5d6e0 is pointing into the stack for thread: 0x50526800
R14=0x76f47321: <offset 0xe321> in /lib/ld-linux-armhf.so.3 at 0x76f39000
R15=0x76f415b0: <offset 0x85b0> in /lib/ld-linux-armhf.so.3 at 0x76f39000


Stack: [0x4fe10000,0x4fe60000],sp=0x4fe5d6e0,free space=309k
Native frames: (J=compiled Java code,j=interpreted,Vv=VM code,C=native code)
C  [ld-linux-armhf.so.3+0x85b0]

Java frames: (J=compiled Java code,Vv=VM code)
j  java.lang.ClassLoader$NativeLibrary.load(Ljava/lang/String;Z)V+0
j  java.lang.ClassLoader.loadLibrary0(Ljava/lang/Class;Ljava/io/File;)Z+328
j  java.lang.ClassLoader.loadLibrary(Ljava/lang/Class;Ljava/lang/String;Z)V+48
j  java.lang.Runtime.load0(Ljava/lang/Class;Ljava/lang/String;)V+57
j  java.lang.System.load(Ljava/lang/String;)V+7
j  com.masimo.drivers.mdk.serial.util.NativeLibraryUtil.loadNativeLibrary(Ljava/lang/String;)Z+81
j  com.masimo.drivers.mdk.serial.jni.D2XXStack.<clinit>()V+22
v  ~StubRoutines::call_stub
j  com.masimo.drivers.mdk.serial.port.D2XXPort.<init>()V+1
j  com.nanthealth.drivers.common.management.SerialDriverInstance.getCom()Lcom/masimo/drivers/mdk/interfaces/communication/SerialDeviceCom;+46
j  com.nanthealth.drivers.philips.ipm.driver.PhilipsIPMDriver.createCoreDeviceDriver()V+49
j  com.nanthealth.drivers.common.management.DriverInstance.run()V+29
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
=>0x50526800 JavaThread "IPM-2B" daemon [_thread_in_native,0x4fe60000)]
  0x754da400 JavaThread "ForkJoinPool.commonPool-worker-0" daemon [_thread_blocked,id=30898,stack(0x4ff60000,0x4ffb0000)]
  0x52848800 JavaThread "Camel (camel-1) thread #8 - WireTap" daemon [_thread_blocked,id=30897,stack(0x4ffb0000,0x50000000)]
  0x52847c00 JavaThread "Camel (camel-1) thread #7 - RabbitMQConsumer" daemon [_thread_blocked,id=30896,stack(0x50d4f000,0x50d9f000)]
  0x75407800 JavaThread "DestroyJavaVM" [_thread_blocked,id=30592,stack(0x75523000,0x75573000)]
  0x50538000 JavaThread "Camel (camel-1) thread #6 - RabbitMQConsumer" daemon [_thread_blocked,id=30832,stack(0x50000000,0x50050000)]
  0x5156a400 JavaThread "pool-2-thread-12" [_thread_blocked,id=30831,stack(0x50050000,0x500a0000)]
  0x50cd1c00 JavaThread "AMQP Connection 127.0.0.1:5672" [_thread_in_native,id=30830,stack(0x500a0000,0x500f0000)]
  0x528fe000 JavaThread "Camel (camel-1) thread #5 - RabbitMQConsumer" daemon [_thread_blocked,id=30829,stack(0x500f0000,0x50140000)]
  0x51581c00 JavaThread "pool-2-thread-10" [_thread_blocked,id=30828,stack(0x50140000,0x50190000)]
  0x51580800 JavaThread "AMQP Connection 127.0.0.1:5672" [_thread_in_native,id=30827,stack(0x50190000,0x501e0000)]
  0x51fa6400 JavaThread "Camel (camel-1) thread #4 - seda://heartbeats" daemon [_thread_blocked,id=30826,stack(0x501e0000,0x50230000)]
  0x50c2a400 JavaThread "Camel (camel-1) thread #3 - seda://events" daemon [_thread_blocked,id=30825,stack(0x50230000,0x50280000)]
  0x51f34c00 JavaThread "Camel (camel-1) thread #2 - seda://waveform-envelopes" daemon [_thread_blocked,id=30824,stack(0x50280000,0x502d0000)]
  0x51f33c00 JavaThread "Camel (camel-1) thread #1 - seda://envelopes" daemon [_thread_blocked,id=30823,stack(0x502d0000,0x50320000)]
  0x50cd7c00 JavaThread "pool-2-thread-8" [_thread_blocked,id=30822,stack(0x50320000,0x50370000)]
  0x50c85c00 JavaThread "AMQP Connection 0:0:0:0:0:0:0:1:5672" [_thread_in_native,id=30821,stack(0x50370000,0x503c0000)]
  0x525db000 JavaThread "pool-2-thread-6" [_thread_blocked,id=30820,stack(0x503c0000,0x50410000)]
  0x525da000 JavaThread "AMQP Connection 0:0:0:0:0:0:0:1:5672" [_thread_in_native,id=30819,stack(0x50410000,0x50460000)]
  0x5152a400 JavaThread "pool-2-thread-4" [_thread_blocked,id=30818,stack(0x50460000,0x504b0000)]
  0x51808000 JavaThread "AMQP Connection 127.0.0.1:5672" [_thread_in_native,id=30817,stack(0x504b0000,0x50500000)]
  0x520f2800 JavaThread "pool-2-thread-2" [_thread_blocked,id=30816,stack(0x50810000,0x50860000)]
  0x52504c00 JavaThread "AMQP Connection 0:0:0:0:0:0:0:1:5672" [_thread_in_native,id=30815,stack(0x50860000,0x508b0000)]
  0x523f0c00 JavaThread "scheduling-1" [_thread_blocked,id=30794,stack(0x509b0000,0x50a00000)]
  0x52825c00 JavaThread "logback-2" daemon [_thread_blocked,id=30789,stack(0x51d24000,0x51d74000)]
  0x754b4400 JavaThread "AsyncAppender-Worker-ASYNC" daemon [_thread_blocked,id=30650,stack(0x51d74000,0x51dc4000)]
  0x5257c800 JavaThread "logback-1" daemon [_thread_blocked,id=30646,stack(0x52610000,0x52660000)]
  0x75479800 JavaThread "Service Thread" daemon [_thread_blocked,id=30598,stack(0x526e0000,0x52730000)]
  0x75476400 JavaThread "C1 CompilerThread0" daemon [_thread_blocked,id=30597,stack(0x52730000,0x527b0000)]
  0x75474c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked,id=30596,stack(0x527b0000,0x52800000)]
  0x75464800 JavaThread "Finalizer" daemon [_thread_blocked,id=30595,stack(0x52926000,0x52976000)]
  0x75461c00 JavaThread "Reference Handler" daemon [_thread_blocked,id=30594,stack(0x52976000,0x529c6000)]

Other Threads:
  0x7545d000 VMThread [stack: 0x529c6000,0x52a46000] [id=30593]
  0x7547b800 WatcherThread [stack: 0x52660000,0x526e0000] [id=30599]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap:
 def new generation   total 78656K,used 25964K [0x53200000,0x58750000,0x5dca0000)
  eden space 69952K,30% used [0x53200000,0x5467fc20,0x57650000)
  from space 8704K,57% used [0x57650000,0x57b2b700,0x57ed0000)
  to   space 8704K,0% used [0x57ed0000,0x57ed0000,0x58750000)
 tenured generation   total 174784K,used 10530K [0x5dca0000,0x68750000,0x73200000)
   the space 174784K,6% used [0x5dca0000,0x5e6e8bf0,0x5e6e8c00,0x68750000)
 Metaspace       used 23008K,capacity 23912K,committed 23960K,reserved 24880K

Card table byte_map: [0x530ff000,0x53200000] byte_map_base: 0x52e66000

Polling page: 0x76f5d000

CodeCache: size=32768Kb used=4456Kb max_used=4485Kb free=28311Kb
 bounds [0x73332000,0x7379a000,0x75332000]
 total_blobs=2194 nmethods=1984 adapters=140
 compilation: enabled



Edit3: 替换

map<int,int> test;

使用

std::map<int,int>& m(){
    static std::map<int,int>* ans;
    return *ans;
}

并且库加载正常。我不确定为什么,我不确定在我实际访问m()时它是否会工作。非常感谢

编辑4:

启用LD_DEBUG = all并启动Java进程。下面是控制台上的错误。

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x76fac5b0,pid=2092,tid=0x6042f470
#
# JRE version: OpenJDK Runtime Environment (8.0_121-b13) (build 1.8.0_121-internal-b13)
# Java VM: OpenJDK Client VM (25.121-b13 mixed mode linux-aarch32 )
# Problematic frame:
#       2092:   symbol=_dl_addr;  lookup in file=java [0]
      2092: symbol=_dl_addr;  lookup in file=/usr/lib/jvm/openjre-8/bin/../lib/aarch32/jli/libjli.so [0]
      2092: symbol=_dl_addr;  lookup in file=/lib/libc.so.6 [0]
      2092: binding file /lib/libdl.so.2 [0] to /lib/libc.so.6 [0]: normal symbol `_dl_addr' [GLIBC_PRIVATE]
C  [ld-linux-armhf.so.3+0x85b0]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping,try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/root/hs_err_pid2092.log
#
# If you would like to submit a bug report,please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-