Compiling on OSX - redirect from RE: [fltk.general] Changes to x, y, w, h meaning in sub windows? - [General Use]

18 views
Skip to first unread message

MacArthur, Ian (Leonardo, UK)

unread,
Aug 2, 2017, 4:52:23 AM8/2/17
to fltkg...@googlegroups.com

> In my earlier attempt I used the XCode / Framework approach, which
> seemingly ended in corrupt libraries. So I tried taking your
> instructions literally, complete with a fresh download, to start from a
> very clean, well known starting point. Oops. Not so well known...

> Ken


Hi Ken,

I'm currently about 5 miles from my Mac, so can't check this, but to build fltk at the command line, it generally goes something like this:

- install Xcode and make sure the command line tools are also added (ISTR that Apple have made this harder recently, which may be pertinent in your case.)

- download the tarball (or grab svn latest)

- unpack the tarball into a clean working directory

- cd into the working directly and invoke configure. You need not set any "special" options to configure.

Now this step is "tricky" on recent Mac's as Apple seem to have moved a lot of the tools into "odd" places; try "which configure" to see if it is in scope and in the path for your shell. If not, try "locate configure" to see where it actually is on your machine and add that to the path.

On my machine, this pretty much Just Works, but this machine was updated from a much older version of Xcode that put things in "sensible" places. I hear that newer Macs with recent Xcode do not play nice at times...

Let us know whether your shell can see configure, and what path it finds it in; it may be useful reference info for others I think.

- Once configure completes, invoke "make" and wait a bit. By rights, it should Just Work.

- Invoke "test/demo" and try out the test samples to see that everything built OK.



Invoking the compiler from the shell, I always just use "gcc" or "g++". Apple no longer use a gcc compiler AFAIK, but they do provide some stubs that invoke their current compiler (LLVM/clang/whatever) as if it were gcc, and that works well for me.

In your shell, try "which gcc" and let us know what reports - is it finding a compiler?

If so, try "gcc -v" and show us what that reports; we need to see what compiler it is actually trying to call (the Apple wrapper stubs can call several different compiler personalities at this stage, we need to know which is in use here.)


Also, be interesting to know whether your Mac has the autoconf tools installed. My (older) Mac does, but I hear that Apple no longer distribute the autoconf tools with Xcode, so that might be problematic (though sould not affect "normal" building with the stock fltk tarball of course.) Again, the results from "locate autoconf" might be useful to see here.

Looking forward to the answers!

Cheers,
--
Ian








Leonardo MW Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

Greg Ercolano

unread,
Aug 2, 2017, 12:05:06 PM8/2/17
to fltkg...@googlegroups.com
On 08/02/17 01:52, MacArthur, Ian (Leonardo, UK) wrote:
> Hi Ken, I'm currently about 5 miles from my Mac, so can't check this, but to build fltk at the command line, it generally goes something like this:

I too think it's that Ken has Xcode installed but NOT the Xcode command line compiler tools,
which for whatever reason Apple chose to recently make a separate install.

Also of note: if you google for his error: "/bin/sh: /Applications/Xcode: No such file or directory"
one sees it as a failure for a /lot/ of different make oriented toolkits; openSSL, homebrew, ruby, etc etc.
Many seem to cite the problem of the Xcode command line tools not being installed, which seems to
weigh in favor of that being the issue.

Assuming this is the case, we should probably:

o Update the README for the mac to include info about the new Xcode requirement for the separate command line tools install.
o See if we can figure out why configure is running to completion OK (it sounds like it is?) when the tools /arent/ installed

Greg Ercolano

unread,
Aug 2, 2017, 12:14:34 PM8/2/17
to fltkg...@googlegroups.com
BTW, I haven't researched this fully, but just looking at some of the above google
searches, here's some possibly relevant info:

https://recalll.co/app/?q=ios%20-%20Instaling%20OpenSSL%20lib%20for%20Xcode%20-%20Stack%20Overflow
"Beginning with Xcode 4.3 Apple stopped bundling command line tools as standard with Xcode."

..so perhaps we should cite that (after vetting the info) in our docs wrt
mentioning the bit about Apple's separate command line tools install.

Also from that page:

"In a build phase script for armv6 & armv7 Xcode will use the bundled tools (in the question
the cc (clang) compile). But for simulator builds, build phase scripts use the system versions.
If you haven't explicitly installed the tools the build will fail.
Xcode > Preferences > Downloads"

I'm not sure if that's saying when doing cross compiles, you'll specifically run into
this problem. Perhaps this is why configure passes, but fltk build fails? Ken might be
building for a ppc target (see his configure flags citing OSX 10.4 as a minimum build)
in which case cross compiling may be relevant.

Manolo

unread,
Aug 3, 2017, 8:48:16 AM8/3/17
to fltk.general, ian.ma...@leonardocompany.com
Complete procedure to build FLTK on Mac OS X :

Starting from a fresh install of Mac OS X on a totally empty disk partition

1) download and install Xcode (available free in the App Store)

2) download fltk-1.3.4-1-source.tar.gz from the download section of www.fltk.org, untar it

3) Open Xcode (in Applications)
Xcode indicates "Installing components"

4) Open fltk-1.3.4-1/ide/Xcode4/FLTK.xcodeproj
Xcode proposes "Automatically create schemes" --> do that
Select target Demo
Build. --> success
Run. --> all test programs run OK.
Select target Fluid, Build, Run --> OK

5) in Terminal, cd to fltk-1.3.4-1/
Type :  
    ./configure
It stops and proposes "Install command line developer tools"  ---> click "Install"
Some software gets downloaded (needs internet access) and installed.

6) in terminal, type again:
    ./configure
    make
Success. All test apps and fluid are built.

7) To show that the fltk-config script is working, in Terminal, cd to examples and type:

../fltk-config --use-gl --compile OpenGL3test.cxx

The OpenGL3test app is built and runs OK.



Manolo

unread,
Aug 3, 2017, 9:24:35 AM8/3/17
to fltk.general, ian.ma...@leonardocompany.com
Procedure to build FLTK on Mac OS X using CMake:

Get the CMake Mac OS app from the CMake web site.
I used make-3.1.0-rc1-Darwin64-universal.dmg

Put the CMake app in the /Applications folder

Run CMake
-click 'Browse source' and select the fltk-1.3.4-1/ folder
-click 'Browse build' and create a folder where CMake will work and put its products
(I used fltk-1.3.4-1/cmake-build/)
-click 'Configure'
accept the default 'Unix Makefile' choice
-click 'Generate'
Quit CMake

In Terminal, cd to fltk-1.3.4-1/cmake-build/ and type
   make
Let the build procedure run to completion.

The built products are:
fltk-1.3.4-1/cmake-build/bin/fluid
fltk-1.3.4-1/cmake-build/bin/examples/*
fltk-1.3.4-1/cmake-build/lib/libfltk*.a



Reply all
Reply to author
Forward
0 new messages