Illegal storage access...

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
phreak4257

Re: Illegal storage access...

Post by phreak4257 »

g++ test.cpp -I/opt/opencascade-6.3/ros/inc -L/opt/opencascade-6.3/ros/lin/lib64 -D_OCC64 -lTKPShape -lTKFillet
/opt/opencascade-6.3/ros/Linux/lib64/libTKernel.so.0: undefined reference to `dlclose'
/opt/opencascade-6.3/ros/Linux/lib64/libTKernel.so.0: undefined reference to `dlsym'
/opt/opencascade-6.3/ros/Linux/lib64/libTKernel.so.0: undefined reference to `dlopen'
/opt/opencascade-6.3/ros/Linux/lib64/libTKernel.so.0: undefined reference to `dlerror'
collect2: ld returned 1 exit status

does this with or without OCC64
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Illegal storage access...

Post by wmayer »

Then try:
g++ test.cpp -I/opt/opencascade-6.3/ros/inc -L/opt/opencascade-6.3/ros/lin/lib64 -D_OCC64 -lTKPShape -lTKFillet -lTKernel -ldl
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Illegal storage access...

Post by yorik »

For me the test app compiles fine (debian 64bits)
phreak4257

Re: Illegal storage access...

Post by phreak4257 »

./a.out
Polyline is null
Polyline is null
Polyline is null
Polyline is null

Not sure what it means that this works, but FreeCAD fails.
phreak4257

Re: Illegal storage access...

Post by phreak4257 »

I also tried without -D_OCC64, and got a segfault

Here is the last part of the strace output:


open("/opt/opencascade-6.3/ros/Linux/lib64/libTKGeomAlgo.so.0", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3601\16\0\0\0\0\0@"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=4947008, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fefd557b000
mmap(NULL, 9383296, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fefd0a9d000
mprotect(0x7fefd0f45000, 2093056, PROT_NONE) = 0
mmap(0x7fefd1144000, 69632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4a7000) = 0x7fefd1144000
mmap(0x7fefd1155000, 2338176, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fefd1155000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fefd557a000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fefd5579000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fefd5578000
arch_prctl(ARCH_SET_FS, 0x7fefd5578700) = 0
mprotect(0x7fefd1144000, 36864, PROT_READ) = 0
mprotect(0x7fefd15e2000, 8192, PROT_READ) = 0
mprotect(0x7fefd19a1000, 20480, PROT_READ) = 0
mprotect(0x7fefd1eee000, 24576, PROT_READ) = 0
mprotect(0x7fefd2118000, 4096, PROT_READ) = 0
mprotect(0x7fefd238d000, 12288, PROT_READ) = 0
mprotect(0x7fefd29a0000, 24576, PROT_READ) = 0
mprotect(0x7fefd2cd1000, 12288, PROT_READ) = 0
mprotect(0x7fefd30f1000, 20480, PROT_READ) = 0
mprotect(0x7fefd345f000, 16384, PROT_READ) = 0
mprotect(0x7fefd3777000, 24576, PROT_READ) = 0
mprotect(0x7fefd3a49000, 20480, PROT_READ) = 0
mprotect(0x7fefd3dc2000, 16384, PROT_READ) = 0
mprotect(0x7fefd3fe1000, 4096, PROT_READ) = 0
mprotect(0x7fefd4266000, 4096, PROT_READ) = 0
mprotect(0x7fefd4557000, 28672, PROT_READ) = 0
mprotect(0x7fefd4775000, 4096, PROT_READ) = 0
mprotect(0x7fefd4bb7000, 40960, PROT_READ) = 0
mprotect(0x7fefd4ffc000, 20480, PROT_READ) = 0
mprotect(0x7fefd5352000, 36864, PROT_READ) = 0
mprotect(0x604000, 4096, PROT_READ) = 0
mprotect(0x7fefd5585000, 4096, PROT_READ) = 0
set_tid_address(0x7fefd55787d0) = 25962
set_robust_list(0x7fefd55787e0, 0x18) = 0
futex(0x7fffdd583c1c, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x7fffdd583c1c, 0x189 /* FUTEX_??? */, 1, NULL, 7fefd5578700) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, {0x7fefd1f06790, [], SA_RESTORER|SA_SIGINFO, 0x7fefd1f107d0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7fefd1f06820, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7fefd1f107d0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
futex(0x7fefd4560ac8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
brk(0) = 0x1629000
brk(0x164a000) = 0x164a000
open("/dev/zero", O_RDWR) = 3
mmap(0x20000000, 4096000, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x20000000
brk(0x166d000) = 0x166d000
brk(0x168f000) = 0x168f000
brk(0x16b2000) = 0x16b2000
brk(0x16d5000) = 0x16d5000
brk(0x16f7000) = 0x16f7000
brk(0x171a000) = 0x171a000
brk(0x173b000) = 0x173b000
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Illegal storage access...

Post by wmayer »

Then try:


#include "config.h"
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <Geom_Plane.hxx>
#include <Handle_Geom_Plane.hxx>
#include <BRep_Tool.hxx>
#include <BRepMesh.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <Poly_Polygon3D.hxx>
#include <Handle_Poly_Polygon3D.hxx>
#include <TopExp_Explorer.hxx>
#include <gp_Ax2.hxx>
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <gp_Trsf.hxx>
#include <iostream>

int main(int argc, char** argv)
{
gp_Pnt p(0,0,0);
gp_Dir d(0,0,1);
double radius=1.0, height=4.0, angle=2.0*Standard_PI;
BRepPrimAPI_MakeCylinder mkCyl(gp_Ax2(p,d),radius, height, angle);
TopoDS_Shape Face = mkCyl.Shape();
BRepMesh::Mesh(Face,0.1);

// go through all edges
TopExp_Explorer ex;
for (ex.Init(Face, TopAbs_EDGE); ex.More(); ex.Next()) {
const TopoDS_Edge& aEdge = TopoDS::Edge(ex.Current());
gp_Trsf myTransf;
TopLoc_Location aLoc;
Handle(Poly_Polygon3D) aPoly = BRep_Tool::Polygon3D(aEdge, aLoc);
if (!aPoly.IsNull()) {
Standard_Integer nbNodesInFace = aPoly->NbNodes();
std::cout << nbNodesInFace << " nodes found" << std::endl;
}
else {
std::cout << "Polyline is null" << std::endl;
}
}
}

g++ test.cpp -I/opt/opencascade-6.3/ros/inc -L/opt/opencascade-6.3/ros/lin/lib64 -D_OCC64 -lTKPShape -lTKFillet -lTKernel -ldl -lTKPrim
phreak4257

Re: Illegal storage access...

Post by phreak4257 »

is there an IRC channel for FreeCAD?

# g++ test.cpp -I/opt/opencascade-6.3/ros/inc -L/opt/opencascade-6.3/ros/lin/lib64 -D_OCC64 -lTKPShape -lTKFillet -lTKernel -ldl -lTKPrim
/tmp/ccW6GWry.o: In function `main':
test.cpp:(.text+0x18a): undefined reference to `BRepMesh::Mesh(TopoDS_Shape const&, double)'
collect2: ld returned 1 exit status

Sorry this is so much trouble, but I hope this may help others, too.

Cheers,
PH
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Illegal storage access...

Post by wmayer »

Sorry, there is no IRC channel for FreeCAD.

Then try:
g++ test.cpp -I/opt/opencascade-6.3/ros/inc -L/opt/opencascade-6.3/ros/lin/lib64 -D_OCC64 -lTKPShape -lTKFillet -lTKernel -ldl -lTKPrim -lTKMesh

The problem with the thousands of OCC classes which library must be used to link with. I really hope that this reproduces the problem now...
phreak4257

Re: Illegal storage access...

Post by phreak4257 »

Polyline is null
Polyline is null
Polyline is null
Polyline is null
Polyline is null
Polyline is null
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Illegal storage access...

Post by wmayer »

And do you get the same result when not using the _OCC64 flag?

g++ test.cpp -I/opt/opencascade-6.3/ros/inc -L/opt/opencascade-6.3/ros/lin/lib64 -lTKPShape -lTKFillet -lTKernel -ldl -lTKPrim -lTKMesh

The test application bascially does the same as FreeCAD does when creating a shape.
Post Reply