Problem with EiffelStudio graphics app project build on Mac

by James Sutton (modified: 2009 Jan 17)

I have installed MacPorts and EiffelStudio on a MacBook Pro. I used the MacPorts automatic installer. The build fails when I try to compile a graphics application, though it works for a console app. I have disabled precompilation as this failed. Specifically the C build fails, and it looks as though it doesn't have the right shell PATH, as it is not finding pkg-config. The ~/.bashrc and ~/.tcshrc are correct, though there is no ~./profile. I copied the .bashrc to .profile, but to no avail. I have checked that the PATH is correct in a Mac Terminal, and in an X Terminal, and pkg-config is found.

start of C build log:

Eiffel C/C++ Compilation Tool - Version 6.0 Copyright Eiffel Software 1985-2007. All Rights Reserved

Preparing C compilation /Applications/MacPorts/Eiffel63/ line 43: pkg-config: command not found Compiling C code in C30 Compiling C code in C30 Compiling C code in C29 /Applications/MacPorts/Eiffel63/ line 43: pkg-config: command not found /Applications/MacPorts/Eiffel63/ line 43: pkg-config: command not found Compiling C code in C28 /Applications/MacPorts/Eiffel63/ line 43: pkg-config: command not found Compiling C code in C27 /Applications/MacPorts/Eiffel63/ line 43: pkg-config: command not found Compiling C code in C26

... etc

  • James Sutton (8 years ago 17/1/2009)

    With a little perseverance I found the problem. MacPorts added a line to .tcshrc:

    setenv PATH /opt/local/bin:/opt/local/sbin:$PATH

    Presumably because tcsh is my default shell. However the C-build uses bash, and .bashrc didn't have the modification. So when I added:

    export PATH=/opt/local/bin:/opt/local/sbin:$PATH

    to .bashrc it started working

    I suppose MacPorts should add this to all possible shell startups, but it seems there should be a neater solution.

    • Paul Bates (8 years ago 20/2/2009)

      I've always wondered why MacPorts didn't just do this in the first place, bash is the default shell on MacOSX. I assumed that it is because the port install path can be changed, but if it is set in the .tschrc then I don't know.

      .bashrc isn't the best place to put an export, use .profile instead. Because ports are installed on a system-wide level it might be an idea to put it in /.profile instead of ~/.profile. But only do this if you control your accounts because it may mess with other user accounts. FYI - EiffelStudio port installs into /Applications/MacPorts, which is why there is a problem with precompiles and permissions (run ec/estudio as root to precompile successfully.)

      MacPorts 1.7.0 (recently released) modified my ~/.profile, strengthening the fact that this is the correct place to put things, but it only added an export for MANPATH. However, I already have my paths set up (see below) so MacPorts may have checked the accessibility of paths during an install and skipped adding an export for PATH.

      I generally do not like touching my shell login scripts and Leopard users are treated to /etc/paths.d so you don't need to do this. Simply execute from terminal:

      $ sudo bash $ echo -ne "/opt/local/bin\n/opt/local/sbin" > /etc/paths.d/macports $ echo -ne "/Applications/MacPorts/Eiffel63/studio/spec/macosx-x86/bin" > /etc/paths.d/eiffelstudio $ echo -ne "/opt/local/share/man" > /etc/manpaths.d/macports $ exit

      or create a script and execute it as root:

      #!/bin/bash if [ "`id -u`" != "0" ]; then echo "You must be root in order to execute this script!" exit fi # Add global execution paths echo -ne "/opt/local/bin\n/opt/local/sbin" > /etc/paths.d/macports echo -ne "/Applications/MacPorts/Eiffel63/studio/spec/macosx-x86/bin" > /etc/paths.d/eiffelstudio # Add global man-pages paths echo -ne "/opt/local/share/man" > /etc/manpaths.d/macports

      I'm using MacPorts 1.7.0 and there is no installed macport file in /etc/paths.d so it should be safe to execute the above commands/script.