Esri / cityengine-sdk

CityEngine is a 3D city modeling software for urban design, visual effects, and VR/AR production. With its C++ SDK you can create plugins and standalone apps capable to execute CityEngine CGA procedural modeling rules.
https://esri.github.io/cityengine/cityenginesdk
Apache License 2.0
206 stars 64 forks source link

Running into a problem when building prt4cmd, and getting Segmentation Fault when running #4

Closed andr7430 closed 10 years ago

andr7430 commented 10 years ago

I am on OSX, and I am trying to build/run the example project (prt4cmd). I am able to generate the make files without a problem. However, when I try to build the sample, the first time, I run into an error. However if I try "make install" again, it builds the project without a problem. Then I tried to run the project by calling bin/prt4cmd, but I am running into a Segmentation fault: 11. I have tried to provide it various arguments (according to the README), but all of them came back with the same error. I have attached a screen shot. screen shot 2014-03-28 at 3 04 02 pm

mistafunk commented 10 years ago

hi andrew, thanks for your interest.

there are two issues in the cmake script when compiling on osx 10.9 with clang, please try these changes in the examples/prt4cmd/src/CMakeLists.txt and let me know:

-target_link_libraries(${PROJECT} ${PRT_LIBRARY} ${Boost_LIBRARIES})
+target_link_libraries(${PROJECT} ${Boost_LIBRARIES} ${PRT_LIBRARY})

 if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,'$ORIGIN'")

 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
-       add_custom_command(TARGET ${PROJECT} POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL}
-               -change ${PRT_CORE_LIBRARY} @rpath/libcom.esri.prt.core.dylib
-               ${PROJECT})
+#      add_custom_command(TARGET ${PROJECT} POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL}
+#              -change ${PRT_LIBRARY} @rpath/libcom.esri.prt.core.dylib
+#              ${PROJECT})

 endif()
andr7430 commented 10 years ago

Hey yep you are right, it is because I am using clang. Cool, after I made the above changes, it works. Just need something to open the .obj file now haha. screen shot 2014-04-01 at 7 46 46 pm

andr7430 commented 10 years ago

Also I want to figure out how to compile boost using gcc-4.2. Since I think the reason that the second example(stlenc) is failing to compile is because I am using Clang. I downloaded boost using homebrew but it is automatically compiling it using clang I think.

mistafunk commented 10 years ago

good to hear you got it working.

for building the stl encoder you need the exact same compiler environment as the sdk itself used because it is a C++ interface (denoted by the "prtx" namespace in the ce sdk). this also means that all dependencies like boost need to be compiled with the exact same compiler.

in contrast the "prt" api is C only and is compiler independent - if you got the link order right... ;-)

i think the easiest thing to do is to use homebrew to install gcc-4.2.1 and then manually download boost and compile it with gcc 4.2.1 (this is well explained in the boost documentation).