mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Programming (https://www.mersenneforum.org/forumdisplay.php?f=29)
-   -   MacPorts for OS X software-update (https://www.mersenneforum.org/showthread.php?t=16625)

ewmayer 2012-03-11 20:22

MacPorts for OS X software-update
 
I find myself stuck in a never-ending lib-update loop as I try to build an open-source graphing package I downloaded last night, called Inkscape. That project recommends Mac users install MacPorts to ease the update/build cycle ... did that, MacPorts installed fine. The first several times I got a "you need a newer version of libXYZ", following that with "sudo port install libXYZ" worked OK, in the sense that the ensuing retry of ./configure in the Inkscape build-dir got past the previous lib-version error. But then I hit the following "libpng" error, and as you can see, even after updating the lib, the configure script is still finding the older version of libpng:

[color=red]configure: error: libpng >= 1.2 is needed to compile inkscape[/color]

OK, so let's get the latest version:
[color=blue]
ernst-w-mayers-macbook:inkscape-0.48.2 ewmayer$ sudo port install libpng
Password:
---> Computing dependencies for libpng
---> Fetching archive for libpng
---> Attempting to fetch libpng-1.4.9_0.darwin_9.i386.tbz2 from [url]http://packages.macports.org/libpng[/url]
---> Fetching libpng
---> Attempting to fetch libpng-1.4.9.tar.bz2 from [url]http://cdnetworks-us-1.dl.sourceforge.net/project/libpng/libpng14/1.4.9[/url]
---> Verifying checksum(s) for libpng
---> Extracting libpng
---> Configuring libpng
---> Building libpng
---> Staging libpng into destroot
---> Installing libpng @1.4.9_0
---> Activating libpng @1.4.9_0
---> Cleaning libpng
[/color]
OK, that looks good, let's retry the configure:
[color=blue]
ernst-w-mayers-macbook:inkscape-0.48.2 ewmayer$ ./configure
checking build system type... i386-apple-darwin9.6.1
checking host system type... i386-apple-darwin9.6.1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking how to create a pax tar archive... gnutar
checking for style of include used by make... GNU
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
...
checking for locale.h... yes
checking for LC_MESSAGES... yes
checking libintl.h usability... no
checking libintl.h presence... no
checking for libintl.h... no
checking for pkg-config... /opt/local/bin/pkg-config
checking for msgfmt... (cached) /opt/local/bin/msgfmt
checking for gmsgfmt... (cached) /opt/local/bin/msgfmt
checking for OpenMP flag of C++ compiler... unknown
checking for png_read_info in -lpng... no[/color][color=red]
configure: error: libpng >= 1.2 is needed to compile inkscape
[/color]
Go directly to jail ... do not pass Go ...

Is it possible this could be a lib-search-order issue?

ldesnogu 2012-03-11 22:06

Do you have libpng-dev?

Try to look in config.log where the error occurs, it usually has the full gcc error message which might help.

ccorn 2012-03-12 09:56

[QUOTE=ewmayer;292637]
ernst-w-mayers-macbook:inkscape-0.48.2 ewmayer$ ./configure
[...]
checking for png_read_info in -lpng... no
configure: error: libpng >= 1.2 is needed to compile inkscape
[...]
Is it possible this could be a lib-search-order issue?[/QUOTE]

Inspecting config.log should clarify this.

If so, then the MacPorts port of inkscape should pass this stage.
(MacPorts sets CPPFLAGS and LDFLAGS or C_INCLUDE_PATH and LIBRARY_PATH with appropriate -I${prefix}/include and -L${prefix}/lib.)

In any case, Portfiles are easy to read ("port cat inkscape") and modify. After all, it's Tcl syntax, and "man portfile" helps a lot.

ewmayer 2012-03-12 19:29

1 Attachment(s)
[QUOTE=ldesnogu;292641]Do you have libpng-dev?

Try to look in config.log where the error occurs, it usually has the full gcc error message which might help.[/QUOTE]

I have attached the log. In the meantime I am going to try the prebuilt Mac OS binary - the reason I didn't grab that to begin with it that it says it needs OS X v10.6 whereas my system is 10.5.8. I have an upgrade disc (burned by an Apple buddy) for 10.6, but have so far avoided it because I've heard a few too many cautionary tales about people having major issues with the upgrade, and I simply cannot afford that kind of major time-wastage (or worse, system-offline-ness) right now.

ldesnogu 2012-03-13 10:40

The offending lines are:

[code]configure:8217: checking for png_read_info in -lpng
configure:8242: g++ -o conftest -g -O2 -Wno-strict-aliasing -Wall -Wformat -Wformat-security -W -D_FORTIFY_SOURCE=2 conftest.cpp -lpng -lz -lm >&5
ld: library not found for -lpng
collect2: ld returned 1 exit status[/code]Try to locate libpng, I guess configure fails to provide the path to the library. Usually configure has options such as --with-png-path; look at configure --help.

EDIT: quickly looked at configure.ac and it looks like no such option exists... So I see two possibilites:
1. edit configure (around line 8217, see above)
2. create a link in the default library path to libpng

ccorn 2012-03-13 13:49

There are no -L flags in the link line. Add CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib to your ./configure command. (Replace /opt/local with your MacPorts prefix.) Another option: Use "sudo port install inkscape", but make sure that the numerous dependencies get installed with the variants (e.g. +quartz) you want. Try "port -y install inkscape" for a dry run. Edit: Corrected the *FLAGS settings.

ewmayer 2012-03-14 01:08

[QUOTE=ldesnogu;292869]The offending lines are:

[code]configure:8217: checking for png_read_info in -lpng
configure:8242: g++ -o conftest -g -O2 -Wno-strict-aliasing -Wall -Wformat -Wformat-security -W -D_FORTIFY_SOURCE=2 conftest.cpp -lpng -lz -lm >&5
ld: library not found for -lpng
collect2: ld returned 1 exit status[/code]Try to locate libpng, I guess configure fails to provide the path to the library.[/QUOTE]

ccorn's guess below was right ... on my system libpng is in /opt/local/lib; I verified that the MacPorts-uodated vrsion of that I got a couple days ago is in there, as well.

[QUOTE=ccorn;292881]There are no -L flags in the link line. Add CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib to your ./configure command. (Replace /opt/local with your MacPorts prefix.) Another option: Use "sudo port install inkscape", but make sure that the numerous dependencies get installed with the variants (e.g. +quartz) you want. Try "port -y install inkscape" for a dry run. Edit: Corrected the *FLAGS settings.[/QUOTE]

Should I add the paths by modifying the configure file (and if so where, since there are CPPFLAGS refereces all over the place and I don't see and "master definitions" of that variable), or as command-line arguments appended to ./configure?

ccorn 2012-03-19 19:01

[QUOTE=ewmayer;292944]Should I add the paths by modifying the configure file (and if so where, since there are CPPFLAGS refereces all over the place and I don't see and "master definitions" of that variable), or as command-line arguments appended to ./configure?[/QUOTE]

The usage recommended by newer autoconf versions is to pass those settings as command-line arguments like this:
[code]./configure CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib[/code]
The classic usage employs the environment of the configure run like this:
[code]CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib ./configure[/code]
You may also want to add more configure options. For an overview, try
[code]./configure --help | less[/code]
(If this makes you grin, you are not alone.)

ewmayer 2012-03-25 01:23

[QUOTE=ccorn;293523]The usage recommended by newer autoconf versions is to pass those settings as command-line arguments like this:
[code]./configure CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib[/code][/QUOTE]

I ended up doing just that - It successfully got past the previous sticking point, only to hang shortly thereafter due to another dependency, in this case the package needed itself required multiple other packages (this endless-seeming proliferation of branching seems to be nearly ubiquitous with MacPorts-usage), one of which is apparently not MacPorts-enabled. Sure, I *could* manually download and make, just as I *could* spend every waking hour for the next month trying to get some package to build which at this point I merely want to evaluate for suitability-for-my-needs, but enough. At that point I said f*** it, let me just install good old gnuplot ... that can also be easily done (or better, easily attempted) using MacPorts, but much like Inkscape, fails on one of the dependencies. First, check out how many other pkgs MacPorts-gnuplot tries to install:
[i]
sudo port install gnuplot
Password:
---> Computing dependencies for gnuplot
---> Dependencies to be installed: gd2 autoconf m4 automake jpeg libtool xpm xorg-libXext xorg-libX11 xorg-bigreqsproto xorg-inputproto xorg-kbproto xorg-libXau xorg-xproto xorg-libXdmcp xorg-libxcb python27 db46 libedit openssl python_select sqlite3 python27 xorg-libpthread-stubs xorg-xcb-proto libxml2 xorg-util-macros xorg-xcmiscproto xorg-xextproto xorg-xf86bigfontproto xorg-xtrans xorg-libXt xorg-libsm xorg-libice lua readline pango Xft2 xrender xorg-renderproto cairo libpixman xorg-xcb-util pdflib
[/i]
Each one of those may or may not itself need yet-other packages ... anyway it gets the first 2 installed, but now barfs on 'm4':
[i]
---> Configuring m4
Error: Target org.macports.configure returned: configure failure: shell command failed (see log for details)
Error: Failed to install m4
Log for m4 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_m4/m4/main.log
Error: The following dependencies were not installed: gd2 autoconf m4 automake jpeg libtool xpm xorg-libXext xorg-libX11 xorg-bigreqsproto xorg-inputproto xorg-kbproto xorg-libXau xorg-xproto xorg-libXdmcp xorg-libxcb python27 db46 libedit openssl python_select sqlite3 python27 xorg-libpthread-stubs xorg-xcb-proto libxml2 xorg-util-macros xorg-xcmiscproto xorg-xextproto xorg-xf86bigfontproto xorg-xtrans xorg-libXt xorg-libsm xorg-libice lua readline pango Xft2 xrender xorg-renderproto cairo libpixman xorg-xcb-util pdflib
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
[/i]
From the above main.log, it seems to be claiming simple C-compilation fails:
[i]
:notice:configure ---> Configuring m4
:debug:configure Using compiler 'Mac OS X gcc 4.0'
:debug:configure Executing org.macports.configure (m4)
:debug:configure Environment: CPATH='/opt/local/include' CFLAGS='-pipe -O2 -arch i386' CPPFLAGS='-I/opt/local/include' CXXFLAGS='-pipe -O2 -arch i386' LIBRARY_PATH='/opt/local/lib' MACOSX_DEPLOYMENT_TARGET='10.5' CXX='/usr/bin/g++-4.0' CC_PRINT_OPTIONS_FILE='/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_m4/m4/work/.CC_PRINT_OPTIONS' F90FLAGS='-pipe -O2 -m32' LDFLAGS='-L/opt/local/lib -arch i386' OBJC='/usr/bin/gcc-4.0' FCFLAGS='-pipe -O2 -m32' GI_SCANNER_DISABLE_CACHE='1' INSTALL='/usr/bin/install -c' OBJCFLAGS='-pipe -O2 -arch i386' FFLAGS='-pipe -O2 -m32' CC_PRINT_OPTIONS='YES' CC='/usr/bin/gcc-4.0'
:debug:configure Assembled command: 'cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_m4/m4/work/m4-1.4.16" && ./configure --prefix=/opt/local --program-prefix=g ac_cv_libsigsegv=no'
:debug:configure Executing command line: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_m4/m4/work/m4-1.4.16" && ./configure --prefix=/opt/local --program-prefix=g ac_cv_libsigsegv=no
:info:configure checking for a BSD-compatible install... /usr/bin/install -c
:info:configure checking whether build environment is sane... yes
:info:configure checking for a thread-safe mkdir -p... build-aux/install-sh -c -d
:info:configure checking for gawk... no
:info:configure checking for mawk... no
:info:configure checking for nawk... no
:info:configure checking for awk... awk
:info:configure checking whether make sets $(MAKE)... yes
:info:configure checking for gcc... /usr/bin/gcc-4.0
:info:configure checking whether the C compiler works... no
:info:configure configure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_m4/m4/work/m4-1.4.16':
:info:configure configure: error: C compiler cannot create executables
:info:configure See `config.log' for more details
[/i]
In /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_m4/m4/work/m4-1.4.16/config.log, the offender appears to be in this section:
[i]
## ----------- ##
## Core tests. ##
## ----------- ##

configure:3397: checking for a BSD-compatible install
configure:3465: result: /usr/bin/install -c
configure:3476: checking whether build environment is sane
configure:3526: result: yes
configure:3667: checking for a thread-safe mkdir -p
configure:3706: result: build-aux/install-sh -c -d
configure:3720: checking for gawk
configure:3750: result: no
configure:3720: checking for mawk
configure:3750: result: no
configure:3720: checking for nawk
configure:3750: result: no
configure:3720: checking for awk
configure:3736: found /usr/bin/awk
configure:3747: result: awk
configure:3758: checking whether make sets $(MAKE)
configure:3780: result: yes
configure:3927: checking for gcc
configure:3954: result: /usr/bin/gcc-4.0
configure:4183: checking for C compiler version
configure:4192: /usr/bin/gcc-4.0 --version >&5
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:4203: $? = 0
configure:4192: /usr/bin/gcc-4.0 -v >&5
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5490~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5490)
configure:4203: $? = 0
configure:4192: /usr/bin/gcc-4.0 -V >&5
gcc-4.0: argument to `-V' is missing
configure:4203: $? = 1
configure:4192: /usr/bin/gcc-4.0 -qversion >&5
i686-apple-darwin9-gcc-4.0.1: no input files
configure:4203: $? = 1
configure:4223: checking whether the C compiler works
configure:4245: /usr/bin/gcc-4.0 -pipe -O2 -arch i386 -I/opt/local/include -L/opt/local/lib -arch i386 conftest.c >&5
can not open CC_PRINT_OPTIONS_FILE /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_m4/m4/work/.CC_PRINT_OPTIONS
configure:4249: $? = 1
configure:4287: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU M4"
| #define PACKAGE_TARNAME "m4"
| #define PACKAGE_VERSION "1.4.16"
| #define PACKAGE_STRING "GNU M4 1.4.16"
| #define PACKAGE_BUGREPORT "bug-m4@gnu.org"
| #define PACKAGE_URL "http://www.gnu.org/software/m4/"
| #define PACKAGE "m4"
| #define VERSION "1.4.16"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:4292: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_m4/m4/work/m4-1.4.16':
configure:4294: error: C compiler cannot create executables
See `config.log' for more details
[/i]
Again, any ideas? This is starting to get annoying.

Mathew 2012-03-25 01:38

ewmayer,

I used [URL="http://code.google.com/p/rudix/wiki/m4"]this for M4[/URL] hopefully it will be less annoying for you.

ewmayer 2012-03-25 02:19

[QUOTE=Mathew;294085]ewmayer,

I used [URL="http://code.google.com/p/rudix/wiki/m4"]this for M4[/URL] hopefully it will be less annoying for you.[/QUOTE]

Thanks ... I downloaded the .pkg file for Snow Leopard, and ran the installer, successfully. But ... MacPorts apparently is still trying to install the same particular freeware version as before, because again trying the install-gnuplot again tries to build m4 fails precisely as before:
[i]
---> Computing dependencies for gnuplot
---> Dependencies to be installed: gd2 autoconf m4 automake jpeg libtool xpm xorg-libXext xorg-libX11 xorg-bigreqsproto xorg-inputproto xorg-kbproto xorg-libXau xorg-xproto xorg-libXdmcp xorg-libxcb python27 db46 libedit openssl python_select sqlite3 python27 xorg-libpthread-stubs xorg-xcb-proto libxml2 xorg-util-macros xorg-xcmiscproto xorg-xextproto xorg-xf86bigfontproto xorg-xtrans xorg-libXt xorg-libsm xorg-libice lua readline pango Xft2 xrender xorg-renderproto cairo libpixman xorg-xcb-util pdflib
---> Configuring m4
Error: Target org.macports.configure returned: configure failure: shell command failed (see log for details)
Error: Failed to install m4
Log for m4 is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_m4/m4/main.log
Error: The following dependencies were not installed: gd2 autoconf m4 automake jpeg libtool xpm xorg-libXext xorg-libX11 xorg-bigreqsproto xorg-inputproto xorg-kbproto xorg-libXau xorg-xproto xorg-libXdmcp xorg-libxcb python27 db46 libedit openssl python_select sqlite3 python27 xorg-libpthread-stubs xorg-xcb-proto libxml2 xorg-util-macros xorg-xcmiscproto xorg-xextproto xorg-xf86bigfontproto xorg-xtrans xorg-libXt xorg-libsm xorg-libice lua readline pango Xft2 xrender xorg-renderproto cairo libpixman xorg-xcb-util pdflib
Error: Status 1 encountered during processing.
[/i]
Do I need to un-install the above compile-error-afflicted version of m4, or somehow tell MacPorts to instead use the m4 package I got from the above link?


All times are UTC. The time now is 08:00.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.