[questions]
Libtorch GPU 1.2.0 and GCC version 5.4.0 are compiled under linux environment. The compilation is normal, but the following errors occur during operation:
*** Error in `./xxx/xxx/xxx': free(): invalid pointer: 0x00007f52a2101c50 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81329)[0x7f520ec08329]
/xxx/build/lib/libobject_detector.so(_ZN8nvinfer115PluginRegistrarINS_17YoloPluginCreatorEED2Ev+0x48)[0x7f52a1eeeb68]
/lib64/libc.so.6(__cxa_finalize+0x9a)[0x7f520ebc105a]
/data/hxy/git/6s_factory_analysis_ddb/code/build/lib/libobject_detector.so(+0x17123)[0x7f52a1ec8123]
======= Memory map: ========
00400000-00484000 r-xp 00000000 08:01 144443223
00684000-00687000 r--p 00084000 08:01 144443223
00687000-00688000 rw-p 00087000 08:01 144443223
00688000-00689000 rw-p 00000000 00:00 0
00919000-107cb9000 rw-p 00000000 00:00 0 [heap]
200000000-200200000 ---p 00000000 00:00 0
200200000-200400000 rw-s 00000000 00:05 40161 /dev/nvidiactl
Query similar problems in the official issue of pytoch, which are related to C + + abi
C + + ABI related issues
When you upgrade GCC Version (above 5.1), if you recompile the whole code, you will basically not encounter ABI problems. However, if you also rely on dynamic libraries compiled by other third parties, which are compiled with the old version of GCC (such as GCC 4.8), you may encounter ABI problems. At this time, add a definition
- D during compilation_ GLIBCXX_ USE_ CXX11_ ABI = 0
, then there should be no problem.
The GCC version of the libtorch GPU (1.2.0) tripartite library that the project relies on should be a running problem caused by still using the old abi
[solution]
Cmakelist.txt
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)
After compiling and running, the problem is solved!
[note]
After configuring cmake, pay attention to GCC and cxx versions to ensure the consistency of versions
cmake -DCMAKE_CXX_COMPILER=$(which g++) -DCMAKE_C_COMPILER=$(which gcc) ..
Confirm that the version is 5.4.0
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/local/bin/gcc
-- Check for working C compiler: /usr/local/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/local/bin/g++
-- Check for working CXX compiler: /usr/local/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
(SINGING)
https://zhuanlan.zhihu.com/p/125197727
https://github.com/pytorch/pytorch/issues/30507
Read More:
- After the go pointer is declared and assigned, a panic: runtime error: invalid memory address or nil pointer reference appears
- Abnormal crash of APP startup — pointer being free was not allocated * * set a breakpoint in malloc_ error_ break to debug
- Error in `./a.out‘: free(): invalid next size (fast): 0x0000000001da8010
- Error when creating partitions in Linux: no free sectors available solution
- The bash file written by windows runs in Linux system error
- Java uses ZipFile to decompress the zip file and runs normally under Windows. Linux reports an error
- Go start error: Panic: runtime error: invalid memory address or nil pointer reference
- The @ Autowired annotation in springboot is invalid in ordinary classes. How to solve and use the null pointer exception java.lang.nullpointerexception
- Linux running Makefile, G + + / GCC error: suffix or operations invalid for ‘vbroadcasts’
- linux/tensorflow: failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE
- How to Perfectly Uninstall ZoneAlarm Free Firewall
- Alpine Linux executable file crash report error / lib / x86 not found_ 64 Linux GNU / libc.so solution
- About ora-00257: archiver error. Connect internal only, until free
- Barrier free click path source code to read
- The solution of a Java exception has occurred. And error exception in thread when eclipse runs
- Ora-00257: archiver error. Connect internal only, until free
- Free dynamic screen capture drawing tool under MAC: KAP
- How to use C + + function pointer array
- Idea ignores compilation errors and runs in eclipse compilation mode
- Tomcat Error: because there was insufficient free space available after evicting expired cache entries