Saved File Corrupted: FreeCAD built from source on 10.6.8

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
jpstaub
Posts: 21
Joined: Tue Apr 29, 2014 8:21 pm

Re: Saved File Corrupted: FreeCAD built from source on 10.6.

Post by jpstaub »

peterl94 wrote:Homebrew should save the cmake log to /Library/Logs/Homebrew/freecad/01.cmake.
You're right. It did. The included file comes from a failed --HEAD build attempt with boost149 inserted as the boost dependency in Sanelson's freecad.rb.

Since I don't know what I'm doing I'll stop here. If there's something I can try please advise and I'll give it a go and report back.

Wish I knew how the 3702 distro was built as it is fully functional on my machine.

Jake
Attachments
01.cmake.zip
FreeCAD --HEAD build with boost149 dependency
(9.44 KiB) Downloaded 38 times
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: Saved File Corrupted: FreeCAD built from source on 10.6.

Post by shoogen »

peterl94 wrote:Homebrew should save the cmake log to /Library/Logs/Homebrew/freecad/01.cmake. I'm going to run FreeCAD in gdb tomorrow to see if I can find out exactly what is causing it.
shoogen wrote:I would expect QT 4.8.6 and FreeCAD 0.15.4138 (f119e740c8) to show the Mac OS version.
I saw your commit, so I was wondering about that -- I'll look into it.
Newer versions have the function MacVersion(). Older versions seem only to have the variable MacintoshVersion. But MacVersion (which i used is the Enum :roll: )
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Saved File Corrupted: FreeCAD built from source on 10.6.

Post by peterl94 »

Yeah, it looks like the function is only in 5.x
peterl94
Veteran
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Saved File Corrupted: FreeCAD built from source on 10.6.

Post by peterl94 »

Okay, I figured out how to fix the problem (when installing with --HEAD). The problem was caused by the hombrew gcc runtime (linked by gfortran) conflicting with the xcode gcc runtime. Thankfully, gfortran is not needed anymore. I'm going to submit a pull request to sanelson, but in the meantime, here is the working formula:

Code: Select all

require "formula"

class Freecad < Formula
  homepage "http://sourceforge.net/projects/free-cad/"
  head "git://git.code.sf.net/p/free-cad/code"
  url "http://downloads.sourceforge.net/project/free-cad/FreeCAD%20Source/freecad-0.14.3702.tar.gz"
  sha1 "048f2aa9cabc71fa4e2b6e10c9a61d8e728faa36"

  # Debugging Support
  option 'with-debug', 'Enable debugging build'

  # Should work with OCE (OpenCascade Community Edition) or Open Cascade
  # OCE is the prefered option
  option 'with-opencascade', 'Build with OpenCascade'
  
  occ_options = []
  if MacOS.version < 10.7
    occ_options = ['--without-tbb']
  end
  
  if build.with? 'opencascade'
    depends_on 'opencascade' => occ_options
  else
    depends_on 'oce' => occ_options
  end

  # Build dependencies
  depends_on 'doxygen' => :build
  depends_on 'cmake' => :build
  depends_on 'swig' => :build
  unless build.head?
    depends_on :fortran => :build
  end
  
  # Required dependencies
  depends_on 'boost'
  #depends_on 'sip'
  depends_on 'xerces-c'
  depends_on 'eigen'
  depends_on 'coin'
  depends_on 'qt'
  #depends_on 'pyqt'
  depends_on 'shiboken'
  depends_on 'pyside'
  depends_on 'python'

  # Recommended dependencies
  depends_on 'freetype' => :recommended

  # Optional Dependencies
  depends_on :x11 => :optional

  def install
    if build.with? 'debug'
      ohai "Creating debugging build..."
    end
    unless build.head?
      # Enable Fortran
      libgfortran = `$FC --print-file-name libgfortran.a`.chomp
      ENV.append 'LDFLAGS', "-L#{File.dirname libgfortran} -lgfortran"
    end
    
    # Brewed python include and lib info
    # TODO: Don't hardcode bin path
    python_prefix = `#{Formula['python'].prefix}/bin/python-config --prefix`.strip
    python_library = "#{python_prefix}/Python"
    python_include_dir = "#{python_prefix}/Headers"

    # Find OCE cmake file location
    # TODO add opencascade support/detection
    oce_dir = "#{Formula['oce'].opt_prefix}/OCE.framework/Versions/#{Formula['oce'].version}/Resources"

    # Handle recent CMAKE build prefix changes
    cmake_build_robot_arg = ''
    if build.head?
      cmake_build_robot_arg = '-DBUILD_ROBOT=OFF'
    else
      cmake_build_robot_arg = '-DFREECAD_BUILD_ROBOT=OFF'
    end

    # Set up needed cmake args
    args = std_cmake_args + %W[
      #{cmake_build_robot_arg}
      -DPYTHON_LIBRARY=#{python_library}
      -DPYTHON_INCLUDE_DIR=#{python_include_dir}
      -DOCE_DIR=#{oce_dir}
      -DFREETYPE_INCLUDE_DIRS=#{Formula.factory('freetype').opt_prefix}/include/freetype2/
    ]

    if build.with? 'debug'
      # Create debugging build and tack on the build directory
      args << '-DCMAKE_BUILD_TYPE=Debug' << '.'
    
      system "cmake", *args
      system "make", "install"
    else
      # Create standard build and tack on the build directory
      args << '.'
    
      system "cmake", *args
      system "make", "install/strip"
    end
  end

  def caveats; <<-EOS.undent
    After installing FreeCAD you may want to do the following:

    1. Amend your PYTHONPATH environmental variable to point to
       the FreeCAD directory
         export PYTHONPATH=#{bin}:$PYTHONPATH
    EOS
  end
end
Edit: the reason the build failed with boost 1.49 is that the boost149 formula apparently doesn't install boost_signals
jpstaub
Posts: 21
Joined: Tue Apr 29, 2014 8:21 pm

Re: Saved File Corrupted: FreeCAD built from source on 10.6.

Post by jpstaub »

Excellent work! I successfully built --HEAD using the updated "freecad.rb" code and as far as I can tell, FreeCAD is fully functional. FreeCAD specifics are included below for reference.
peterl94 wrote:Edit: the reason the build failed with boost 1.49 is that the boost149 formula apparently doesn't install boost_signals
I noticed the same.

Regards,
Jake

OS: Mac OS X
Word size of OS: 32-bit
Word size of FreeCAD: 64-bit
Version: 0.15.Unknown
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 3.1.3
OCC version: 6.7.1
Post Reply