You are here

Using "make_project.py all" omits "basic.dylib" from link binary with libraries in Xcode 6

3 posts / 0 new
Last post
Using "make_project.py all" omits "basic.dylib" from link binary with libraries in Xcode 6
#1

Hello.

Just switched to a new Macbook pro that came with Yosemite and Xcode 6. I downloaded rosetta_bin_mac_2015.02.57538_bundle.

While trying to run "make_project.py all", I had to copy the version.py into the "main/source/xcode" directory from the "main/source" directory.

Starting up Xcode and opening the project, some modules (like basic) compiled with no problems. However, when it tries to compile core.1 (and other targets), I get the following error:

Undefined symbols for architecture x86_64:
"basic::Tracer::Tracer(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, basic::TracerPriority, bool)", referenced from:
___cxx_global_var_init in Graph.o
"basic::Tracer::~Tracer()", referenced from:
___cxx_global_var_init in Graph.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To fix this, I had to open up the target and add basic.dylib to the link binary with libraries page (basic was listed in the target dependencies part of the screen, it was just missing from the "link binary with libraries" portion)

Any ideas on what I did wrong with the "make_project.py all" command?

Thanks in advance.
Kevin

Category: 
Post Situation: 
Sun, 2015-02-22 20:53
kmolloy717

Hi. Few things. First, why are you trying to compile Rosetta if you already have the binaries? Second, have you tried using Scons, which is the typical way to build? https://www.rosettacommons.org/docs/latest/Build-Documentation.html

Here is information on getting Xcode to read the libraries properly from the devel wiki. I'm not sure if it works as I do not use Xcode for Rosetta development. Netbeans and eclipse are both really simple to setup if all you want to do is be able to click through and explore Rosetta code.

Generating an Xcode project file

Xcode project files are used to group together the files, build targets and compilation settings and serve as the mechanism by which projects are opened and saved. The canonical build tool for Rosetta is SCons and Xcode can be configured to use SCons as an external build system. However, Xcode will not index code that it does not compile, which severely limits its utility. A python script that reads the src.settings files and updates the Xcode project file is used to make Xcode aware of files added by other developers. This script can be found in rosetta/rosetta_source/xcode/make_project.py. To update your Xcode project file, use the follwoing command:

python make_project.py all

After this, you can double-click on rosetta/rosetta_source/xcode/Rosetta.xcodeproj or type:

open rosetta/rosetta_source/xcode/Rosetta.xcodeproj

Adding a new application

By default, the Xcode project only contains and builds the libraries, however it is likely that you will want to build an application that is of interest to you. It's pretty easy to add a new application to Xcode, but it consists of a few steps that will be detailed below.

Make sure the navigator is visible by selecting the left-most tab in the view toolbar along the top-right of the main Xcode window.
Select the Rosetta project in the navigator
Select one of the existing executable targets in the left-hand pane of the editor section (there should be two navigator thingy's: one on the left and one in the editor window: when you click the triangle, it should show up). Executable targets have an icon that resembles a terminal as opposed to a library. [to see the targets you must have the Editor view selector in Standard (top right, left icon)
Right click (or ctrl-click, or two finger tap or whatever you do to bring up a context menu) and select "Duplicate". You can also simply select the target and type "⌘D".
Change the name of the target in the left-hand panel by double-clicking the text
Change the value of "Product Name" in the Packaging section of the Build Settings tab.
Click on the Build Phases tab and change the .cc file that is compiled in the "Compile Sources" section to the correct file for your application.
Uncheck 'copy items', and select 'Create folder references' in the options dialog that appears
Click the drop down bar in the top left of the window, just to the right of the Run and Stop buttons and select "Manage Schemes..."
Rename the newly created scheme to something appropriate and uncheck the "Shared" checkbox on the right.
Back in the left-panel, move your .cc file from under Rosetta to under Apps by drag-and-drop
Hit ⌘R to Run! Compiling should commence.

Fri, 2015-03-20 12:04
jadolfbr

There is a bug that the basic library is not correctly annotated as link-time dependance of core.1 in certain versions of Rosetta.

I've been informed (I don't use XCode myself) that to fix it, go into the settings for the Rosetta project under "Build Phases", and then add basic.dylib to "Link Binary With Libraries".

Mon, 2015-03-30 14:22
rmoretti