FLTK logo

Re: [fltk.coredev] Restore CMake build w/ OPTION_USE_PANGO on macOS

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Restore CMake build w/ OPTION_USE_PANGO on macOS Manolo Feb 19, 2021  
 

On Friday, February 19, 2021 at 2:18:44 PM UTC+1 Albrecht Schlosser wrote:
On 2/19/21 12:46 PM Manolo wrote:
>
> On Friday, February 19, 2021 at 11:07:17 AM UTC+1 Albrecht Schlosser wrote:
>
> Can you tell me what I need to install to build with X11 and Pango on
> macOS? Note that I'm a complete noob on macOS.
>
> ...
>
> (2) CMake: I downloaded the .dmg file from CMake and "installed" it
> into the Applications folder.
>
> That's what I use too, as I like to use the GUI mode.

I also added the executable folder (not the .app folder) to my PATH and
now I can also run `cmake' or `cmake-gui' from the commandline. That's good.

How would I make this PATH change permanent, or would you recommend
installing symlinks as suggested elsewhere? How do you deal with such
installed tools and their paths?
I wouldn't add a folder inside an app to my path. I'd rather copy the cmake exe
to /usr/local/bin or $HOME/bin.


> With this config I could build FLTK and all the demos (default: ARM).
> Then I changed the CMake option to build universal apps and built
> again:
> bingo, universal apps created.
>
> We knew already from another user that FLTK builds and runs well on M1.
> What I still ignore is whether x86_64 FLTK-based apps run on the M1,
> through Rosetta.

I'm now trying to do this. The first (naive) attempt was to build x86
apps and just execute them:

albrecht@mars x64 % grep ARCH CMakeCache.txt
CMAKE_OSX_ARCHITECTURES:STRING=x86_64
OPTION_ARCHFLAGS:STRING=
albrecht@mars x64 % file bin/test/hello.app/Contents/MacOS/hello
bin/test/hello.app/Contents/MacOS/hello: Mach-O 64-bit executable x86_64
albrecht@mars x64 % bin/test/hello.app/Contents/MacOS/hello
zsh: bad CPU type in executable: bin/test/hello.app/Contents/MacOS/hello

So the build worked but execution not. Hmm, Rosetta not available? ...

Now running `blocks' from the Finder yields:

To open "blocks", you need to install Rosetta. Do you want to install it
now?

Clicking [Install] ... installs ... no further message ...

Now running the same blocks executable (in Finder) works.

And from the terminal the same command as above (s/hello/blocks/) works
as well. Does this answer your question?
Great. So it seems that, provided the user installs Rosetta, x86_64 apps run on the M1.


> I did not yet install Xcode, homebrew, or any other tools. I'd like to
> have a complete build environment for FLTK so I can test my
> modifications, particularly CMake but also configure / autoconf
> (missing
> now), X11 etc.
>
> Should I install homebrew? (How?)
>
> I'm not a homebrew user. I use Fink instead
>         https://www.finkproject.org/
> because I liked its choice to put everything in a specific part of the
> file system isolated from macOS. That used to be /sw
> and has been changed to /opt/sw more recently.
>
> There's a problem now: Fink does not support macOS 11 yet. So you can't
> install it (I tried).
> However, my version inherited from macOS 10.15 works well with 11.x. So
> I still use it.
> I can share it.

Thanks, I'll take a look at Homebrew first. Gonzalo posted a link to a
video. I'll watch it and see...

> My use of Fink explains why CMake files prepared for Linux need change:
> CMake command
>     find_library(HAVE_LIB_PANGO pango-1.0 ${CMAKE_LIBRARY_PATH} )
> doesn't find the pango lib because it's not in CMAKE_LIBRARY_PATH which
> doesn't include /opt/sw/lib.
> The modified CMake command
>    find_library(HAVE_LIB_PANGO pango-1.0 ${CMAKE_LIBRARY_PATH}
> ${PANGOXFT_LIBRARY_DIRS})
> works for a user of Fink without hardcoded /opt/sw string.
>
> Anyway, that situation reflects the fact there's not a single source of
> packaged software
> for macOS, and FLTK should be able to support several setups, if possible.

Yep, I think this is very important. I'm looking for a more general way,
like extending the PATH environment variable. Not exactly that but an
equivalent CMake way. Basically the user should provide their
installation paths of such additional libraries and CMake should find
these. Maybe we'll end up with a user provided list in an option field
("additional library search paths") or the user must set an appropriate
CMake variable. Then the rest should "just work".

I'd like to try to find the best "CMake compatible" way rather than
editing our CMake support files. Similar to the removal of hardcoded
paths from configure.ac ...

The modified (and simplified for clarity) CMake code to locate Pango
would become :
  pkg_check_modules(PANGOXFT pangoxft)
  if (PANGOXFT_FOUND )
    include_directories (${PANGOXFT_INCLUDE_DIRS} )
    find_library(HAVE_LIB_PANGO pango-1.0 ${CMAKE_LIBRARY_PATH} ${PANGOXFT_LIBRARY_DIRS})
  endif  (PANGOXFT_FOUND )

My view was this is quite "CMake compatible" since there's no hardcoded path
and we have CMake use PANGOXFT_LIBRARY_DIRS that it just computed
with command pkg_check_modules(PANGOXFT pangoxft).

For this to work, I believe the condition is that pkg-config must be found in the PATH
so pkg_check_modules() runs correctly.


> How do I install autoconf?
>
> Normally, you would get it via Fink. In the absence of that, download M4
> from http://ftp.gnu.org/gnu/m4/ and autoconf from
> http://ftp.gnu.org/gnu/autoconf/
> Then do
> ./configure
> make
> make install
> once for m4 and once for autoconf,.

Okay, thanks, I'll try this - unless I can install it via Homebrew.

> Then you need to install Xquartz from https://www.xquartz.org/
> This will put an app called XQuartz in /Applications/Utilities/ that
> will be your X server.
> XQuartz automagically starts when an X11-based app is started.

Thanks again, I'll try that as well.

> At that point you should have enough to do that in FLTK:
> autoconf -f
> ./configure --enable-x11
> make
> and obtain working X11-based FLTK test apps, provided /usr/local/bin is
> in your path.
>
> I'll see what is possible for pango. I got it via Fink.

Maybe Homebrew? I'll investigate...

> All help would be very much appreciated. TIA.

Thank you very much for all your help. I'm making progress...

> Don't hesitate to ask.

Sure. Do you know a reliable source for a VNC server installation for
macOS? On Windows I installed TightVNC (as suggested by Greg) but this
appears to be only available on Linux and Windows. Any idea for macOS?

I'm not a VNC user, so no advice.

I would recommend you to use BBedit at http://www.barebones.com/products/bbedit/index.html
as an excellent source code editor. Its free mode does all I ever needed, including
as git mergetool.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/eb632776-f2f3-4ea5-a845-0b73419f3e11n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.