Link error: magic_open

Hi,

Do I need another package other than libmagic-dev ?

Linking CXX executable bro
CMakeFiles/bro.dir/util.cc.o: In function bro_init_magic(magic_set**, int)': /work/jpd/dyn/src/dynect2/edge_processing/bro/src/util.cc:1705: undefined reference to magic_open’
/work/jpd/dyn/src/dynect2/edge_processing/bro/src/util.cc:1712: undefined reference to magic_error' /work/jpd/dyn/src/dynect2/edge_processing/bro/src/util.cc:1717: undefined reference to magic_load’
/work/jpd/dyn/src/dynect2/edge_processing/bro/src/util.cc:1719: undefined reference to magic_error' /work/jpd/dyn/src/dynect2/edge_processing/bro/src/util.cc:1722: undefined reference to magic_close’
CMakeFiles/bro.dir/util.cc.o: In function bro_magic_buffer(magic_set*, void const*, unsigned long)': /work/jpd/dyn/src/dynect2/edge_processing/bro/src/util.cc:1729: undefined reference to magic_buffer’
/work/jpd/dyn/src/dynect2/edge_processing/bro/src/util.cc:1732: undefined reference to `magic_error’

What version of Bro is this you're building? As of 2.3 we don't use libmagic anymore.

  .Seth

I see where the libmagic version 5.16 was manually added to the build:

https://github.com/bro/bro/commit/c48c5316299898d05533ee9f5b0273b575391a1f

Then at a later point this was removed.

Ubuntu 14.04 currently uses: libmagic-dev:amd64 1:5.14-2ubuntu3.2

Any insight appreciated .

I see libmagic was pulled out and new plug module was added:

https://github.com/bro/bro/commit/bbd409d274fa36fe66f0ac3a6d43bc56d2e0d67f

I see where the libmagic version 5.16 was manually added to the build:

https://github.com/bro/bro/commit/c48c5316299898d05533ee9f5b0273b575391a1f

Then at a later point this was removed.

Yes, IIRC, this method of integrating libmagic never made it in to a release version of Bro, so it’s probably not something you need to worry about.

Ubuntu 14.04 currently uses: libmagic-dev:amd64 1:5.14-2ubuntu3.2

If you are using a version of Bro older than 2.3, that libmagic-dev should work fine — at least I don’t have a problem with it when compiling Bro 2.2.

As mentioned, Bro 2.3 and later won’t require libmagic, so if you can use that instead, it would sidestep whatever your issue is. Else, we’ll need more details: best if you can give step-by-step instructions to reproduce your problem, including which Bro version and any non-default configuration flags used.

- Jon