For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Porting Open Cascade to OS X.3

Anonymous's picture
Forums: 

Hey Everyone,

Man this forum can be hot sometimes... However I have not found what I am looking for and I hope to get some nice hints...

I am working on porting OCC5.1 to Mac OS 10.3

After debugging and fixing files, we ( Brian and I ) succeeded compiling all the source codes with GCC 3.3 on a G5 computer and we actually got draw to work partially when calling TTOPOLOGY. However, XSDRAWEXE still doesn't work.

Currently when running TTOPOLOGY with GDB ( the debugger) we get the following error:

-------
Standard AllocMemory failed to mmap : Bad file descriptor

Program received signal EXC_BAD_ACCESS, Could not access memory.
Standard::MAllocate(int) (aSize=40960000) at ../../../src/Standard/Standard.cxx:43
1
431 *(Standard_Address*)aStorage = theAllocList;
--------

We visibly have a memory allocation issue here. And we can't get MMAP to work properly.

Any hints? Is memory allocation in OS X that different from Linux???

Thanks in advance for your reply

Torsten Sadowski's picture

I found the following in Apples documentation:

Differences between Mac OS X and BSD

Mac OS X does not support memory-mapped devices through the mmap() function. (Graphic device support and other subsystems provide similar functionality, but using different APIs.) In Mac OS X, this interface should be done through user clients. See the Apple I/O Kit documents for additional information.

Could you send me a diff of your changes against the 5.1 sources? I could compile TKernel using gcc2.95 but using 3.3 beats my abilities. I would also like to know, if you imported everything into XCode or if you used configure.

Torsten

Jules's picture

Thanks a lot for your feedback Torsten.

I will definitely look into the Apple I/O Kit.
So how would you proceed to compile using gcc2.95 but with 3.3 beat?

As far as sending you the diff, that might take me some time because I have made a bunch of little changes here and there in different source codes that I have to go through...

I tried to go back to gcc 2.95 at some point ( but after compiling successfully with 3.3) and there were so many problems that I felt like debugging it backward ( in other words "enbugging my codes again".

And to answer your last question, I did not import into xcode. I actually looked into that but I could not figure out the proper way to do it. Have you tried it?

Let me know if down the road you have any other hint. This memory allocation sucks!
I gave up on mmap and I am currently trying to get MAllocate to work...

Thanks again...

Jules

Torsten Sadowski's picture

I didn't succeed with gcc 3.3 because strstream.h has been replaced by sstream with a changed implementation. Any hints what to do there would be helpful.

Using the old compiler was rather straightforward. You can change the default compiler with:
sudo gcc_select 2 (or 3 or 3.3)

then the configure make process worked with very few changes until linking which did not work because libtool (ld) was given arguments it did not understand.

Torsten

Jules's picture

If you do a

find /usr/include -name strstream\* -print

you will be able to see something like the following
./gcc/darwin/2.95.2/g++/strstream
./gcc/darwin/2.95.2/g++/strstream.h
./gcc/darwin/3.1/g++-v3/backward/strstream
./gcc/darwin/3.1/g++-v3/backward/strstream.h
./gcc/darwin/3.3/c++/backward/strstream

This shows you that you can only use strstream on gcc3.3. Therefore you wanna modifiy strstream.h into strsteam in your code and that will fix the error.

Good luck

Jules

Torsten Sadowski's picture

At last, everything compiled and linked. I just can't run (crash) any application. All I get is
tmac:/Volumes/Temp/OpenCASCADE5.1/ros/adm/make totty$ TTOPOLOGY
dyld: TTOPOLOGY Undefined symbols:
__ZSt3cin
__ZSt4cout
__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
__ZSt4endsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
...lots more

Any Hints?

Torsten

Torsten Sadowski's picture

At last, everything compiled and linked. I just can't run (crash) any application. All I get is
tmac:/Volumes/Temp/OpenCASCADE5.1/ros/adm/make totty$ TTOPOLOGY
dyld: TTOPOLOGY Undefined symbols:
__ZSt3cin
__ZSt4cout
__ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
__ZSt4endsIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
...lots more

Any Hints?

Torsten

Theo's picture

Torsten:

I am trying to recompile OCC5.1 on g++ 3.2 and 3.3 and are getting stuck too. Your idea of switching to a supported compiler g++ 2.96 or something like that is something that I wanted to do but don't know how. Your suggest using the sudo command comes back for me with "gcc_select unknown" and reading the sudo man page makes me believe that that would only work if you already have the compilers installed. Do you know how to have say g++ 2.96 and 3.2 coexist on a Linux box? I figure if I can get OCC51 at least compiling and running on something that is supported than the porting to 3.2 will be easier since I have something to compare it to.

Any insight would be appreciated.

Theo

Jules's picture

Theo,

Remember that on this topic we are talking about working on MAC OS X only... You seem to be talking about linux here...

Please don't mix, you can get you fingers burned :-)

Theo's picture

Yeah, you are right, that was some wishful thinking on my part. In your post to me on the other topic, when you indicated that you had been successful in compiling with 3.3 were you talking about OS X as well, or have you been successful in compiling it with 3.3 on Linux?

poundsmack's picture

best of luck with the OSX port. i would love to see open cascade on OSX. i wish i could help but i am not much of a programmer unless open cascade was in python (which it is not)

venkat's picture

Jules:

I get crashes when running any of the programs - with similar backtrace :
#0 Standard::MAllocate(int) (aSize=40960000) at ../../../src/Standard/Standard.cxx:421
#1 0x042b623c in TCollection_AsciiString::TCollection_AsciiString() (this=0x8151b60) at ../../../inc/Standard_Allocate.lxx:14
#2 0x04286038 in OSD_Environment::OSD_Environment() (this=0x8151b60) at ../../../src/OSD/OSD_Environment.cxx:32

The Fink Apt package patch file has workarounds for the mmap, munmap and msync functions. I plan to apply them and do a clean build.

Jules's picture

Thanks Venkat,

I did not know about that. let me know if you succeed using the patch... I will read about it when I have a chance to.

Jules

Jules's picture

Thanks Venkat,

I did not know about that. let me know if you succeed using the patch... I will read about it when I have a chance to. For me I changed some parametters in standard.cxx to ignore mmap and I am able to run draw using TTopology, AISViewer and XSDRAWEXE, but not XDEDRAWEXE.

Also although I can use the command draw line to draw, my tk menu is blank. Any hint on that please?

And the last problem I am also having is that I can run it from the network. I have to be on the computer I build it to run. Otherwise it says "This isn't a Tk application" ( when I try to run it from X11 on another computer). Have you encountered the same problem?

And do you have an idea how to fix it?

Let me know

Jules

venkat's picture

Jules:

No clues about the problem with the blank menu or running over the network.

Looks like your approach of modifying MMgt_MMap is a better option to get over the mmap problem.

I am now having problem loading plugins - I got the following error:
could not open: FWOSPlugin ; reason: dlcompat: file "libFWOSPlugin.so" not found
*** Abort *** an exception was raised, but no catch was found.
... The exception is:0x17c88690 : Plugin_Failure: could not open:FWOSPlugin; reason:dlcompat: file "libFWOSPlugin.so" not foundaf1.Location: XmlPlugin
03a56822-8269-11d5-aab2-0050044b1af1.Loca

I sym linked all the dylibs in /usr/local/lib but I still get the following error:
*** Abort *** an exception was raised, but no catch was found.
... The exception is:0x17c88690 : Plugin_Failure: could not find the factory in:FWOSPlugin dlcompat: Symbol "PLUGINFACTORY" not found

venkat's picture

Jules:

No clues about the problem with the blank menu or running over the network.

Looks like your approach of modifying MMgt_MMap is a better option to get over the mmap problem.

I am now having problem loading plugins - I got the following error:
could not open: FWOSPlugin ; reason: dlcompat: file "libFWOSPlugin.so" not found
*** Abort *** an exception was raised, but no catch was found.
... The exception is:0x17c88690 : Plugin_Failure: could not open:FWOSPlugin; reason:dlcompat: file "libFWOSPlugin.so" not foundaf1.Location: XmlPlugin
03a56822-8269-11d5-aab2-0050044b1af1.Loca

I sym linked all the dylibs in /usr/local/lib but I still get the following error:
*** Abort *** an exception was raised, but no catch was found.
... The exception is:0x17c88690 : Plugin_Failure: could not find the factory in:FWOSPlugin dlcompat: Symbol "PLUGINFACTORY" not found

Venkat

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.