Comments (20)
I also can't import FBX with assimp on Android
I don't have the full stack trace but I have this error:
09-13 09:24:26.365 6053-6053/com.qualcomm.QCARSamples.FrameMarkers A/libc﹕ Fatal signal 7 (SIGBUS) at 0x746421ea (code=1), thread 6053 (es.FrameMarkers)
I think it may be related
from assimp.
Can we get the FBX file(s) you used so we can reproduce?
from assimp.
Any of the binary FBX files in our test data folder should trigger it.
from assimp.
I'm interested in assimp releasing a new version of their software so I will try to push this oldest issues a bit.
Is there any news on this issue since the last comment?
Thanks in advance.
from assimp.
I've also ran into this issue as well. Any update?
I have assimp loading other formats such as .obj but it's failing on fbx.
Thanks
from assimp.
same here with:
const struct aiScene* assimpScene = importer.ReadFileFromMemory((const void *) buffer,
lenght,
aiProcess_Triangulate | aiProcess_GenSmoothNormals,
"fbx");
from assimp.
solved
in FBXParser.cpp -> ParseTokenAsFloat
in android there is a sigbus because bad memory aligment, i've solved it with memcpy //commented parts are the previous ones
if(t.IsBinary())
{
const char* data = t.begin();
if (data[0] != 'F' && data[0] != 'D') {
err_out = "failed to parse F(loat) or D(ouble), unexpected data type (binary)";
return 0.0f;
}
if (data[0] == 'F') {
ai_assert(t.end() - data == 5);
// no byte swapping needed for ieee floats
float returnFloat;
memcpy(&returnFloat, data+1, sizeof(float));
return returnFloat;//*reinterpret_cast<const float*>(data+1);
}
else {
ai_assert(t.end() - data == 9);
// no byte swapping needed for ieee floats
double returnFloat;
memcpy(&returnFloat, data+1, sizeof(double));
return (float) returnFloat;//static_cast<float>(*reinterpret_cast<const double*>(data+1));
}
}
from assimp.
Awesome finding.
I strongly suspect that other loaders are suspected of similar code as well ...
from assimp.
currently i've integrated assimp to my c++ opengl engine for android and ios, if i found any other issue i will post it
my patch is a little uggly but it was a hotfix, how you will integrate it in a cleaner way?
from assimp.
I think we'll go with memcpy.
reinterpret_cast breaks strict aliasing rules. The union trick is allowed by many compilers, but strictly speaking it is a violation of a rule that writing to an union with type A and directly thereafter reading with type B is undefined behaviour as well.
from assimp.
Thanks! Very glad to solve this. Re-open if the issue persists (I don't have the means of checking on Android right now ... )
from assimp.
I've noticed a number of other places in FBXParser.cpp where we reinterpret_cast doubles, uint64s, etc... Are they not also candidates for the memcpy workaround?
from assimp.
Frankly, yes, almost every reinterpret_cast
in the entire library should be a candidate. I just saw there is plenty of them.
from assimp.
Any update? Still got crash if loading fbx files on Android.
from assimp.
You can use Clang's undefined sanitizer to debug this on desktop. It will shout at you whenever you do unaligned loads. GCC 5 should also have this feature. You might have to use Linux though, not sure what Clang windows status is.
from assimp.
I have also experienced this issue - binary fbx file can't be loaded on Android.
I have narrowed down the problem to buggy behavior of AndroidJNIIOSystem
.
https://github.com/assimp/assimp/blob/master/port/AndroidJNI/AndroidJNIIOSystem.cpp
By using irrlicht and leveraging its filesystem interface, I have solved the problem.
https://github.com/zaki/irrlicht/blob/ogl-es/source/Irrlicht/Android/CAndroidAssetReader.cpp
from assimp.
Hi, I'm getting a similar error, however the fixes mentioned here are applied.
I'm using the compiled .so of the latest version of assimp.
I/DEBUG(191): Revision: '11'
I/DEBUG(191): ABI: 'arm'
I/DEBUG(191): signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x9c79f32a
I/DEBUG(191): r0 9c79f332 r1 a37ad0b4 r2 9c79f332 r3 9c79f32a
I/DEBUG(191): r4 b9a20c10 r5 9caef1c0 r6 9c4b5008 r7 00000000
I/DEBUG(191): r8 b99a7c50 r9 a37ad838 sl b98e5eb0 fp a37ad094
I/DEBUG(191): ip 00000000 sp a37ad060 lr 9d0642e0 pc 9d064328 cpsr 600f0010
I/DEBUG(191): backtrace:
I/DEBUG(191): #00 pc 008c4328 /data/app/lib/arm/libAssimp32.so (Assimp::FBX::ParseTokenAsID(Assimp::FBX::Token const&, char const_&)+260)
I/DEBUG(191): #1 pc 008fb350 /data/app/lib/arm/libAssimp32.so (Assimp::FBX::Document::ReadObjects()+988)
I/DEBUG(191): #2 pc 008f9874 /data/app/lib/arm/libAssimp32.so (Assimp::FBX::Document::Document(Assimp::FBX::Parser const&, Assimp::FBX::ImportSettings const&)+276)
I/DEBUG(191): #3 pc 008c23d8 /data/app/lib/arm/libAssimp32.so (Assimp::FBXImporter::InternReadFile(std::string const&, aiScene_, Assimp::IOSystem_)+860)
I/DEBUG(191): #4 pc 0033d5fc /data/app/lib/arm/libAssimp32.so (Assimp::BaseImporter::ReadFile(Assimp::Importer const_, std::string const&, Assimp::IOSystem_)+244)
I/DEBUG(191): #5 pc 00353a9c /data/app/lib/arm/libAssimp32.so (Assimp::Importer::ReadFile(char const_, unsigned int)+1920)
I/DEBUG(191): #6 pc 0032ad98 /data/app/lib/arm/libAssimp32.so (aiImportFileExWithProperties+376)
Any suggestions? Thanks in advance.
from assimp.
I guess these errors are caused by the dynamic cast stuff done in the code. We haven't fixed all places until now.
from assimp.
See #1686
from assimp.
Closed by #1686
from assimp.
Related Issues (20)
- How to reliably detect transparent materials?
- Bug: Pthreads in Assimp 5.3.0 with vcpkg
- Bug: FBX number of bones quadrupled HOT 2
- Bug: failing tests on Haiku HOT 3
- Bug: Issue 67963 in oss-fuzz: assimp:assimp_fuzzer: Null-dereference READ in Assimp::ComputeUVMappingProcess::Execute
- OBJ file format do not load default material
- Bug:FBX failed during ImportScene HOT 1
- [USD] Support load .usd/.usda/.usdc/.usdz models via "tinyusdz" project (prototyping branch) HOT 7
- Process_SplitByBoneCount only adds one subdivided mesh back HOT 1
- Bug: undefined reference to zlib functions when linking assimp statically HOT 8
- Bug: Binary PLY - Wrong texture display HOT 7
- Bug: OBJ - load material throw exception when material has user-defined description HOT 9
- Bug: Issue 65838 in oss-fuzz: assimp:assimp_fuzzer: Index-out-of-bounds in Assimp::Q3DImporter::InternReadFile
- Bug: error: ‘void* __builtin_memmove(void*, const void*, long unsigned int)’ forming offset 8 is out of the bounds [0, 8] [-Werror=array-bounds=] HOT 4
- Bug:Export fbx but no tangents HOT 3
- [BUG] Assimp's revision.h : Assimp
- Bug: heap-buffer-overflow of ReadFileFromMemory HOT 1
- IOS开发 ,导出fbx格式 HOT 3
- Bug: Build error ISO C99 and later do not support implicit function declarations HOT 1
- Bug: Issue 55843 in oss-fuzz: assimp:assimp_fuzzer: Integer-overflow in Assimp::DXF::LineReader::operator++
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from assimp.