ZLIB FreeBSD 9.1 version + deflateInit_ Symbol not found

Nagesh Akula Nagesh.Akula at Emulex.Com
Tue Nov 4 08:32:31 UTC 2014


Hi John,
We are compiling our driver as a module, not as a built-in.  
When we load our module (.ko that uses zlib), we were hitting at symbol not found.

As you said, DDB_CTF is added by default in BSD 10.0 kernel configuration, but not there in 9.1 kernel.

So, I have added DDB_CTF config option manually, recompiled the kernel. On this booted kernel, our module is loading file with zlib. 
No issue.

Is it suggestible to have DDB_CTF config option ?  If so, is it a 9.0 kernel limitation to not to have DDB_CTF by default (in GENERIC) configuration. ?

-Nagesh A

-----Original Message-----
From: John-Mark Gurney [mailto:jmg at funkthat.com] 
Sent: Tuesday, November 04, 2014 12:45 AM
To: Nagesh Akula
Cc: freebsd-drivers at freebsd.org
Subject: Re: ZLIB FreeBSD 9.1 version + deflateInit_ Symbol not found

Nagesh Akula wrote this message on Mon, Nov 03, 2014 at 06:28 +0000:
> I am trying to add compression algorithm within the kernel module.
> 
> For this, I have included <net/zlib.h> library calls.
> 
> With this getting an linker error,
> in FreeBSD 9.1 OS version, getting kldload linker error on deflateInit_ symbol.
> 
> link_elf_obj: symbol deflateInit_ undefined
> linker_load_file: Unsupported file type
> 
> But, in FreeBSD 10.0 version, the zlib library is able to link properly, and module is working fine.
> 
> Please let me know, if there is any way to link ZLIB with our module in FreeBSD 9.1 ?

This is probably because zlib is only compiled when using one of the following device/options in FreeBSD: crypto, geom_uzip, ipsec, mxge, netgraph_deflate, ddb_ctf, gzio, or geom_uncompress...

Are you trying to compile you're code as a module or as a static part of the kernel?

If you're doing it as a part of the kernel, then you need to update sys/conf/files to include your device/option on the line that has net/zlib.c on it...

As for why it works on 10, but not 9, is that DDB_CTF was added to GENERIC, and DDB_CTF forces the inclusion of zlib...  So, you could possibly load a module that uses zlib, or if that doesn't work, recomile your kernel to include such a device...

Let me know if you have any more questions..

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the freebsd-drivers mailing list