How to build a amd64 library or application

Added by Ernst Gill 6 months ago

I try to build/port libraries and applications as explained in the Wiki Building/Porting packages for Nexenta. This is working for 32 bit libraries and applications, but it builds never 64 bit amd64 libraries or applications. My computer works with amd64 (Intel Xeon X3450). I did search on Nextenta side and the hole net for any documentation about this subject. No usefull information found. So my question is: how to build a amd64 library and application ???


Replies

RE: How to build a amd64 library or application - Added by Anil Gulecha 6 months ago

Hi Ernst,

Typically, the NCP userland is 32 bit only. We have ported a few libraries which contain both 32 and 64 bit binaries in them. Solaris can run 32 bit apps in 64 bit mode, so while the kernel is 64 bit, it can run 32 bit userland packages.

If you want to custom build an app for 64-bit processors, simply use -m64 with gcc.

If you want to port libraries/apps to 64 bit.. you'll need to play with debian/rules so it also builds with -m64. Take a look at nss or nspr package, and go through the debian/rules file to see how 32 bit and 64 bit binaries are both included in the package.

apt-get source nspr
apt-get source nss

Thanks Anil

RE: How to build a amd64 library or application - Added by Ernst Gill 6 months ago

Hi Anil,

Thanks, but I'am a bit surprised.

I picked up an existing library as an excersis: I choose the library 'zlib1g' because it is simple and small. dpkg -L zlib1g /. /usr /usr/lib /usr/lib/amd64 /usr/lib/amd64/libz.so.1.2.3.3 /usr/lib/libz.so.1.2.3.3 /usr/share /usr/share/doc /usr/share/doc/zlib1g /usr/share/doc/zlib1g/changelog.gz /usr/share/doc/zlib1g/copyright /usr/share/doc/zlib1g/changelog.Debian.gz /usr/lib/libz.so.1 /usr/lib/amd64/libz.so.1

As you could see this library includes also a 64 bit library. I was full of hope using this as an example. Nope, it just generates the 32 bit library and nothing else. Any explanation ?

Thanks Ernst

RE: How to build a amd64 library or application - Added by Anil Gulecha 6 months ago

Ernst Gill wrote:

Hi Anil,

Thanks, but I'am a bit surprised.

I picked up an existing library as an excersis: I choose the library 'zlib1g' because it is simple and small. dpkg -L zlib1g /. /usr /usr/lib /usr/lib/amd64 /usr/lib/amd64/libz.so.1.2.3.3 /usr/lib/libz.so.1.2.3.3 /usr/share /usr/share/doc /usr/share/doc/zlib1g /usr/share/doc/zlib1g/changelog.gz /usr/share/doc/zlib1g/copyright /usr/share/doc/zlib1g/changelog.Debian.gz /usr/lib/libz.so.1 /usr/lib/amd64/libz.so.1

As you could see this library includes also a 64 bit library. I was full of hope using this as an example. Nope, it just generates the 32 bit library and nothing else. Any explanation ?

Thanks Ernst

zlib1g is a special case.. it was built using Tim's shadow environment scripts.. which basically builds a package in both 32 and 64 bit environment, and creates a deb out of both.

Infact, I'm currently trying to modify zlib1g so it will build both 32/64 and package without any additional setup.

For now you can take a look at nss and nspr. Once alpha5 is releases, zlib1g will also be built in both 32 and 64 bit by debian/rules.

Cheers Anil