-
Notifications
You must be signed in to change notification settings - Fork 5
Getting Started
Building an IBIS-AMI model using the ibisami package is, currently, supported in three environments:
- Windows 64-bit
- Linux 64-bit
- MacOS X
The intent is that the same makefile be capable of building all six possible targets (i.e. - 32/64-bit Win/Lin/Mac), by detecting the setting of the OS environment variable, as well as the result of the uname command, if appropriate, and acting accordingly. The table, below, will be kept updated with the current state of affairs, in this regard:
OS | 32-bit | 64-bit |
---|---|---|
Windows | Yes | Yes |
Linux | Yes | Yes |
MacOS X | Yes | Yes |
Following are the specific instructions for setting up your environment to build the example Tx model included in the ibisami
package, for the first time.
-
If you haven't already, install Git for Windows.
Note: If asked, opt to include the Git Bash command shell in the installation. -
If you haven't already, install Chocolatey.
-
Launch the Git Bash command shell as an administrator, and execute the command:
choco install make
.
Then execute the command:exit
. -
Download and install Microsoft's Visual Studio 2019 - Community Edition (free).
Note: You'll save yourself some work, later, by accepting the default installation location.
Note: You must explicitly request that the C++ Tools package be installed! -
Install Boost.
In order to write a completely generic and reusable parser for the AMI parameter tree, we need something called polymorphic recursion. To my knowledge, this cannot be had using native C++, even with the C++11 flavor. So, I used the Boost libraries to provide it.
Note: You do NOT need to compile any portion of Boost. My use of Boost in ibisami is "headers-only". -
Download and unpack ibisami.
You can unpack the ibisami package anywhere you like. (You'll define an environment variable, in the next step, which takes care of locating it at build time.) However, you should give it its own directory to live in. -
Define the following environment variables:
- BOOST_ROOT - the root directory of your Boost installation, in DOS form.
- BOOST_ROOT_CYGWIN - the root directory of your Boost installation, in Cygwin form.
- IBISAMI_ROOT - the root directory of your ibisami installation, in Cygwin form.
- IBISAMI_ROOT_DOS - the root directory of your ibisami installation, in DOS form.
- MSVC_BASE - the base directory of your MSVC++ installation, in Cygwin form.
- MSVC_BASE_DOS - the base directory of your MSVC++ installation, in DOS form.
As an aid, here are my own definitions for these:
(Note: The following are just examples. Don't use them verbatim; edit them to reflect your system.)
BOOST_ROOT = C:\Users\dbanas\lib\boost\boost_1_58_0
BOOST_ROOT_CYGWIN = /c/Users/dbanas/lib/boost/boost_1_58_0
IBISAMI_ROOT = /c/Users/dbanas/Documents/GitHub/ibisami
IBISAMI_ROOT_DOS = C:\Users\dbanas\Documents\GitHub\ibisami
MSVC_BASE = /c/Program Files (x86)/Microsoft Visual Studio 11.0/VC
MSVC_BASE_DOS = C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC
Note: The flip in convention, above (i.e. - suffixed for Cygwin vs. suffixed for DOS) is nothing more than an unfortunate historical legacy.
Note: The folder assigned to the MSVC_BASE
and MSVC_BASE_DOS
environment variables, above, should be the one containing the vcvarsall.bat
file.
If, when you attempt the steps below, you get a strange error telling you that 'C:\Program'
is not a recognized command, you probably have these variables defined incorrectly.
- Launch the Git Bash command shell normally (i.e. - not as an administrator) and do the following:
- Move into the directory in which you unpacked ibisami.
- Execute the command:
conda activate pybert
- Execute the command:
make
. - Move into the example directory.
- Execute the command:
make
. - Execute the command:
make test_all
.
If all went well (i.e. - all make commands completed without error), you should find a new *.DLL file in your current directory. Congratulations! You have just built the ibisami example Tx model. You might consider posting a message to [email protected] announcing your success.
If you'd like to view the results of the test you just ran on the new model, open the test_results/{rx,tx}/test_results.xml
file in your browser.
The instructions for a Linux build are largely the same as for Windows. Obviously, steps 1 and 2, as well as the "MSVC..." and "..._DOS" versions of the environment variables, are unnecessary. Here are some (hopefully) helpful excerpts from my own Bash command history, in getting my own Linux build up and running:
(Note: The following are just examples. Don't take them verbatim; adjust them for your system if necessary.)
- sudo apt-get install g++ g++-multilib gcc gcc-multilib
- sudo apt-get install libboost-all-dev
- export IBISAMI_ROOT=/home/dbanas/prj/ibisami
- export BOOST_ROOT=/usr/include/boost
The exports and dependencies appear to be what they ought to:
dbanas@sammy:~/prj/ibisami/example$ nm -gD example_tx_x86.so | grep ' T '
00005d7c T AMI_Close
00005a0b T AMI_Init
dbanas@sammy:~/prj/ibisami/example$ nm -gD example_tx_x86_amd64.so | grep ' T '
000000000000e2ae T AMI_Close
000000000000dea5 T AMI_Init
dbanas@sammy:~/prj/ibisami/example$ ldd example_tx_x86_amd64.so
linux-vdso.so.1 => (0x00007fff9a1fc000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feca46e2000)
/lib64/ld-linux-x86-64.so.2 (0x00007feca4da4000)
dbanas@sammy:~/prj/ibisami/example$ ldd example_tx_x86.so
linux-gate.so.1 => (0xf7701000)
libc.so.6 => /lib32/libc.so.6 (0xf7465000)
/lib/ld-linux.so.2 (0xf7704000)
And some very preliminary testing seems to indicate that the model is and is doing what it should be:
dbanas@sammy:~/prj/ibisami/example$ file example_tx_x86.so
example_tx_x86.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (GNU/Linux), dynamically linked,
BuildID[sha1]=b9ad434844856b6f592b93eebfb15d61d019a719, stripped
dbanas@sammy:~/prj/ibisami/example$ file example_tx_x86_amd64.so
example_tx_x86_amd64.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked,
BuildID[sha1]=c301d122296821c93a75b73dd3819923cf794f0e, stripped
dbanas@sammy:~/prj/ibisami/example$ ./test.py
Model returned message: Hello, World!
Model returned parameters: (example_tx (tap_units 27) (taps[0] 0) (taps[1] 27) (taps[2] 0) (taps[3] 0)
(tap_weights_[0] -0) (tap_weights_[1] 1.269) (tap_weights_[2] -0) (tap_weights_[3] -0)
No additional steps, relative to Linux.
Note, however, that I couldn't get the symbol table of the final *.so completely stripped.
If anyone knows how to do this on MacOS X, please, contact me. Thanks!
Note: 32-bit builds don't seem to work under MacOS.
So, instead of make
, try: make tx64
and make rx64
.