xcode/perlbrew & building CPAN modules - make options? SDKs? Getting build errors - xcode

I'm brand new to OSX, but have been using UNIX/Linux for decades. Just got a new MBP Retina running latest OSX 10.8.1.
installed fink
installed perlbrew
installed xcode
All's well, except I can't get a lot of CPAN modules to build. I am guessing I need to add some magic xcode SDK to get needed libs?
Here's an example:
$ cpanm Wx
...
make[2]: *** No rule to make target `/Users/dfelicia/perl5/perlbrew/perls/perl-5.16.1/lib/5.16.1/darwin-thread-multi-2level/CORE/cc_runtime.h', needed by `RichText.o'.
Stop.
make[1]: *** [subdirs] Error 2
make: *** [subdirs] Error 2
Regardless of the module that fails to build (and there are many), the failure is always with cc_runtime.h.
What am I missing?
I built perl 5.16.2 using the perlbrew arguments from here: http://wiki.wxperl.info/w/index.php/Mac_OS_X_Platform_Notes

Ah ha. I figured out that fink was injecting its perl into the shell env (PERL5LIB, PERLHOME, #INC, etc.). How annoying. I ditched fink and am using Mac Ports, instead.
Anyhow, with a clean env I am able to build everything.

Guesswork on my side as I've never really gotten into OSX:
Have you tried installing MakeMaker as suggested here? Sounds like it could make sense if you have a lot of failures.
CPAN should do that for you though...

Related

I can't install ffmpegs (dependencies) - error with doxygen [mac 10.12.6 Sierra]

It installed about 70% of the dependencies it needed to get ffmpegs going, but it got stuck at installing 'doxygen'.
This is the error I got:
==> Installing dependencies for ffmpeg: doxygen, little-cms2, openjpeg, opus, rust, libgit2, cargo-c, rav1e, flac, libsndfile, libsamplerate, rubberband, sdl2, swig, llvm, snappy, speex, srt, leptonica, libb2, lz4, libarchive, tesseract, theora, x264, x265, xvid, docbook, boost, source-highlight, asciidoc, docbook-xsl, libyaml, ruby, asciidoctor, gnu-getopt, xmlto, libsodium, zeromq and zimg
==> Installing ffmpeg dependency: doxygen
==> cmake ..
==> make
Last 15 lines from /Users/macbook/Library/Logs/Homebrew/doxygen/02.make:
In file included from /tmp/doxygen-20220723-61533-5m5mdv/doxygen-1.9.4/src/outputlist.h:25:
/tmp/doxygen-20220723-61533-5m5mdv/doxygen-1.9.4/src/searchindex.h:29:10: fatal error: 'variant' file not found
#include <variant>
^~~~~~~~~
1 error generated.
make[2]: *** [src/CMakeFiles/doxymain.dir/__/generated_src/code.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/doxymain.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 46%] Linking CXX static library ../lib/libvhdlparser.a
cd /tmp/doxygen-20220723-61533-5m5mdv/doxygen-1.9.4/build/vhdlparser && /usr/local/Cellar/cmake/3.23.2/bin/cmake -P CMakeFiles/vhdlparser.dir/cmake_clean_target.cmake
cd /tmp/doxygen-20220723-61533-5m5mdv/doxygen-1.9.4/build/vhdlparser && /usr/local/Cellar/cmake/3.23.2/bin/cmake -E cmake_link_script CMakeFiles/vhdlparser.dir/link.txt --verbose=1
/usr/bin/ar qc ../lib/libvhdlparser.a CMakeFiles/vhdlparser.dir/CharStream.cc.o CMakeFiles/vhdlparser.dir/ParseException.cc.o CMakeFiles/vhdlparser.dir/Token.cc.o CMakeFiles/vhdlparser.dir/TokenMgrError.cc.o CMakeFiles/vhdlparser.dir/__/generated_src/VhdlParser_adj.cc.o CMakeFiles/vhdlparser.dir/VhdlParserTokenManager.cc.o
/usr/bin/ranlib ../lib/libvhdlparser.a
[ 46%] Built target vhdlparser
make: *** [all] Error 2
Do not report this issue to Homebrew/brew or Homebrew/core!
Error: You are using macOS 10.12.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
old version.
Can someone please help me am not sure what it is, that I am supposed to do.
Looks like we're in the same boat. Fighting the "good fight", as it were. We should probably both just bail to linux or even windows, because god knows they are going to keep making this hard for us....
However, probably like yourself, a combination of inertia and "good reasons" keeps us staying the course ;)
Basically, the issue is described correctly by the others here (lack of c++ 17 support) and in my case (and likely yours as well) is because gcc is a symlink to clang (9.0 if you are using the latest version compatible with our os)
Telling brew to use real gcc (I assume you have compiled it already, and if not - gcc 11.3.0 is a dependency for ffmpeg anyhow, so go ahead and build it; brew install gcc) can be done like this :
HOMEBREW_CC=gcc-11 HOMEBREW_CXX=g++-11 brew install doxygen
However, the above didn't work for me because - although it solved the c++ 17 issue, it exposed another problem :(
It seems that for some reason the minimum macos version number is messed up (I think because the sdk headers for 10.13 are installed with the latest version of xcode compatible with our os) and so the compilation fails. Although there is almost certainly a better/cleaner way to deal with this issue, I solved it by manually compiling and installing doxygen after editing the code.
In the doxygen/filesystem/filesystem.hpp file around line 4491 you need to change the line
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
to
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 111400
Then compile doxygen (extract the source from the brew cache), cd to the cmake folder then run
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/doxygen/1.9.4 -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_VERBOSE_MAKEFILE=ON -Wno-dev -DBUILD_TESTING=OFF -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
make
make install
brew link doxygen
Then continue the brew install ffmpeg. I had trouble with nettle as well, and needed to compile and install that one manually too because the version of libcrypto packaged with macos (libressl) is incompatible. I had to do the steps shown in "brew info openssl#1.1" in order to make sure the compiler used the openssl libcrypto that IS compatible and I couldn't figure out how to make brew do this for me.
Fun fun fun. I am not all that hopeful that the rest of the compilation will go without issue, but it is chugging away again now. I get the distinct impression that this is SO not worth the hassle/trouble.
Good luck!
** EDIT **
I'm still slogging through it, and it is taking a LONG time. But as I encounter more issues I will try and detail them here with the hope that each issue I encounter is reasonably easy to overcome.
llvm failed to compile with lots of missing header errors. Directing brew to use gcc-11 like i did with doxygen worked to compile it further (27%) but still failed (it looks like because it is calling clang specific options as a result of the brew cmake config passed to it... i'm still working on this one...)
Conclusion - I gave up. It isn't worth the time in my view.
Instead I installed macports and used "sudo port install ffmpeg-upstream" to install ffmpeg-5. Unless you have some dying need to compile yourself, I recommend you do this as well.
I've spent quite some time to get around this issue as well and I ended up with another solution. I merely edited the formula to suit my needs :
brew edit doxygen
Once there, spot the "def install" block then edit the file so that it looks like this :
fails_with :clang
def install
inreplace "CMakeLists.txt", "MACOS_VERSION_MIN 10.14", "MACOS_VERSION_MIN 10.11"
Save, exit.
In short, just add the "fails_with" line and the "inreplace" line. The first one causes brew to not use clang (so you need to have a gcc copy somewhere). This is to solve the C++17 issue. The second one patches the CMakeLists.txt file to allows cmake to do its magic. Once done, "brew install doxygen" should succeed.

Error installing libmaxminddb

I am trying to install the GEolite2 database on a netbsd server. I can't get past the first make for libmaxmindb. I get the following error;
make all-recursive
Making all in src
Making all in bin
Making all in t
make: don't know how to make man/man1/*.1. Stop
make: stopped in /usr/local/maxmind/libmaxminddb-1.1.1
*** Error code 1
Stop.
make: stopped in /usr/local/maxmind/libmaxminddb-1.1.1
*** Error code 1
Stop.
make: stopped in /usr/local/maxmind/libmaxminddb-1.1.1
Hpw can I either fix this or get around it?
UPDATE:
I downloaded the tarball for 1.1.1 from github.com/maxmind/libmaxminddb/releases/download/1.1.1/….
I noticed that the man directory has no Makefile in it and from what I could tell, maybe it should.
I am using NetBSD 6.0.1 and ran the steps in the Readme.
configure - ran normally
make - failed as shown above. –
I also tried starting from a git clone - same result.
On BSD systems one should always use GNU Make with Makefiles generated by GNU Automake.
I see in README.md for the libmaxminddb repository on github.com that one is expected to run the bootstrap script after cloning the repo (which is quite normal, though more often the script is called autogen).
If you don't already have GNU Make and the GNU Autotools installed I recommend using pkgsrc to install them.

XCode and gcc errors

So, I feel like my xcode/gcc/however they are supposed to work together has been broken for a while. Trying to download various technologies (most recently redis) has always ended in sadness. When I tried to make the redis I get
-bash-3.2$ make
cd src && make all
LINK redis-server
/bin/sh: gcc-4.6: command not found
make[1]: *** [redis-server] Error 127
make: *** [all] Error 2
This is the kind of error I've been gettng forever. For reference, I'm running Mac 10.7.5, my latest xcode is 4.6 and my latest gcc is 4.2. Any ideas on how I can make this work? I'd rather not upgrade my Mac OS if possible. Thanks!
I honestly don't know if this is the right way to fix this, but this issue became so problematic for me that I was willing to try anything. I noticed that I definitely had a
/usr/bin/gcc
file. And I notice that my system couldn't find the /gcc-4.6.
So.... I just did one of these numbers
sudo cp /usr/bin/gcc /usr/bin/gcc-4.6
and voila. It works now. Now I can do it all, including essential tasks like compiling any C code. So, hopefully this helps someone out.

Errors when installing a Perl module using make - Mac OSX 10.7

The problem:
I can't seem to install perl modules correctly, JSON-2.53 in particular.
I have done the following:
Searched for a similar problem and tried its solution - did not work.
perl ".../config.h, needed by `Makefile'" not working after OSX Lion upgrade
Installed XCode command line developer utilities (c compiler, make, etc)
Read version compatibility documentation on this particular perl module: http://metacpan.org/pod/JSON
Ran the following commands to make and install the desired perl module:
$perl Makefile.PL
Welcome to JSON (v.2.53)
If you install JSON::XS v.2.27, it makes JSON faster.
************************** CAUTION **************************
This is 'JSON version 2' and there are many differences *
to version 1.xx *
Please check your applications useing old version. *
See to 'INCOMPATIBLE CHANGES TO OLD VERSION' and 'TIPS' *
Writing Makefile for JSON
(verified that the Makefile has been written)
$make
make: *** No rule to make target `/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE/config.h', needed by `Makefile'. Stop.
What does that error even mean? What can I do to successfully make install this module?
Here are some additional items that may help you assist me in debugging this issue:
$which make
/Applications/Xcode.app/Contents/Developer/usr/bin/make
$which perl
/usr/bin/perl
$perl -v
This is perl 5, version 12, subversion 3 (v5.12.3) built for darwin-thread-multi-2level
I think you need to download and reinstall XCode. If I recall correctly for 10.7, after downloading Xcode from the app store it drops an installer into your Applications folder. You need to run it and try installing the command line tools again (from Xcode's prefernces pane). I know you mentioned you did this already, but a bit more background might explain why it's worth another try.
Here are the relevant lines in the Makefile from my Mac:
PERL_INC = /System/Library/Perl/5.12/darwin-thread-multi-2level/CORE
# Where is the Config information that we are using/depend on
CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
Later on in the Makefile CONFIGDEP is used as a dependency in a target. I believe in your case make is looking for /System/Library/Perl/5.12/darwin-thread-multi-2level/CORE/config.h and can't find it. The error you're seeing is make's obtuse way of saying file not found.
config.h contains specific information about the OS but is not needed for running scripts. It's only referenced when you want to compile a module. With stock OSX you get enough perl to execute scripts. Install XCode and you get the bits (like config.h) to do perl "development". I use quotes because you can write and run perl scripts without Xcode. But as you discovered, compiling a module requires the additional files Xcode provides. (Incidentally, RedHat does the same thing. You have to install the perl-devel package to get config.h. The perl runtime is in a separate package.)
Here are some things you can try:
Verify /System/Library/Perl/5.12/darwin-thread-multi-2level/CORE/config.h exists. If not, Xcode command line utilities were not installed properly. Try it again.
If config.h exists, check its content and make sure it looks sane. It's a C header file and consists of comments and #define statements.
If you don't have access to view config.h, you have a permission issue. Try using sudo make as a bypass. Disk Utility (found in Applications -> Utilities) might be able to permanently fix this.
You could risk changing the Makefile by removing "$(PERL_INC)$(DFSEP)config.h" from CONFIGDEP. I did this on my 10.8 Mac and it worked without issue (it passed all tests as well). However, if you don't find the root cause of your config.h issue, the next time you want to install a perl module you may find yourself right back where you started.
I had this exact same error, whilst this may not be a solution for you.... after reinstalling an updated xcode compatible with the OSX version (+rebooting after the install) I still had the error - to cut a long story short I noticed there was no config.h in /CORE/ after the error.....the solution that worked was to touch config.h and create the file first and then re-run the make. Hope this helps someone.

Trouble installing/compiling lua on macosx

I have been attempting to compile/install Lua on Snow Leopard. I have changed the target platform in the Makefile.std to macosx and I still get the following issue:
sudo make -f Makefile.std macosx
make[1]: *** No rule to make target 'macosx'. Stop
make: *** [macsox] Error 2
I also changed the target of the same Makefile.std file in the src directory.
Is there something I'm missing here?
I have tried "make macosx" amongst other variations...
This should be easy.
Did you download the source from lua.org? The official distribution does not contain a Makefile.std. Doing "make macosx" should just work. Get the official tarball.
Note also that there are Lua packages in MacPorts and Fink.

Resources