Bug 73647

Summary: Problem of building sysutils/pecl-fileinfo
Product: Ports & Packages Reporter: Uranus <uranus>
Component: Individual Port(s)Assignee: Alex Dupre <ale>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Uranus 2004-11-07 18:40:25 UTC
The port sysutils/pecl-fileinfo can't be built on FreeBSD 5.3-STABLE.
When I build this one, I got the following error messages at configuration time:
checking for fileinfo support... yes, shared
checking for magic files in default path... not found
configure: error: Please reinstall the libmagic distribution

Fix: I can't find the `magic.h' in the /usr/include and /usr/local/include directories
which are searched by the `configure' program.
But I can find out it in the path `/usr/src/contrib/file/magic.h'.
So I just copied it into `/usr/include' and then make it again.

I got the following messages when I did it:
checking for magic files in default path... found in /usr
checking for magic_open in -lmagic... no
configure: error: wrong magic lib version or lib not found

Then I read `libmagic' and write a little program to test magic_open().
I used the command "gcc test.c -o test -lmagic" and got the messages:
/usr/lib/libmagic.so: undefined reference to 	nflate'
/usr/lib/libmagic.so: undefined reference to 	nflateEnd'
/usr/lib/libmagic.so: undefined reference to 	nflateInit2_'

It seems to lack of the libz.
So I re-compiled by `-lz': gcc test.c -o test -lmagic -lz.
It's no any linking errors.

Finally, I modified the `config.m4' in `/usr/ports/sysutils/pecl-fileinfo/work/Fileinfo-0.2':


And then I configured and built successfully.
I can't ensure that it will work fine at runtime.

I just hope that this information is helpful.--P9uLjEtGsXTvORFJ30jqBoMFnIDNh9XqjDBh9f7mgiEsCYhB
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- config.m4.bak       Mon Nov  8 02:32:59 2004
+++ config.m4   Mon Nov  8 02:33:21 2004
@@ -36,7 +36,7 @@
   ],[
     AC_MSG_ERROR([wrong magic lib version or lib not found])
   ],[
-    -L$FILEINFO_DIR/lib -lm
+    -L$FILEINFO_DIR/lib -lm -lz
   ])
                                                                                
   MAGIC_MIME_LOCATIONS="/usr/local/share/file/magic /usr/share/file/magic /etc/magic"
How-To-Repeat: 1. cd /usr/ports/sysutils/pecl-fileinfo
2. make install
Comment 1 Thierry Thomas freebsd_committer freebsd_triage 2004-11-07 20:34:38 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale


Over to the maintainer.
Comment 2 Uranus 2004-11-08 14:05:59 UTC
Another information.

I installed `portupgrade' and ran the command `pkgdb -F', and I found that pecl-fileinfo depends on `sysutils/file'.
The dependency was listed in the Makefile, but it  passed the checking because there is already a `libmagic.so.1' in the system.

The `sysutils/file' seems to be built-in in the FreeBSD 5.3-STABLE (/usr/src/contrib/file), and there are some problems:
    1. never copied its `magic.h' to the path `/usr/include'.
    2. should be linked with the libz.so, but the ports `sysutils/file' didn't need to do the step.
Comment 3 David E. O'Brien freebsd_committer freebsd_triage 2004-11-19 04:04:25 UTC
State Changed
From-To: open->closed

Fix commited (install magic.h).