hreinecke / sg3_utils

Deprecated git-svn mirror for sg3_utils
http://sg.danny.cz/sg/sg3_utils.html
Other
150 stars 91 forks source link

Building in MSYS #89

Closed Zibri closed 1 year ago

Zibri commented 1 year ago

What I did:

git clone https://github.com/hreinecke/sg3_utils
cd sg3_utils
./configure --enable-win32-spt-direct
make

what I got:

Making all in src
make[2]: Entering directory '/home/Zibri/sg3_utils/src'
gcc -DHAVE_CONFIG_H -I. -I..  -iquote ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -Wall -W  -g -O2 -MT sg_bg_ctl.o -MD -MP -MF .deps/sg_bg_ctl.Tpo -c -o sg_bg_ctl.o sg_bg_ctl.c
mv -f .deps/sg_bg_ctl.Tpo .deps/sg_bg_ctl.Po
/bin/sh ../libtool  --tag=CC   --mode=link gcc -Wall -W  -g -O2   -o sg_bg_ctl.exe sg_bg_ctl.o ../lib/libsgutils2.la
libtool: link: gcc -Wall -W -g -O2 -o sg_bg_ctl.exe sg_bg_ctl.o  ../lib/.libs/libsgutils2.a
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: sg_bg_ctl.o: in function `sg_ll_background_control':
/home/Zibri/sg3_utils/src/sg_bg_ctl.c:111: undefined reference to `construct_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/src/sg_bg_ctl.c:116: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/src/sg_bg_ctl.c:117: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/src/sg_bg_ctl.c:118: undefined reference to `do_scsi_pt'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/src/sg_bg_ctl.c:135: undefined reference to `destruct_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/src/sg_bg_ctl.c:135: undefined reference to `destruct_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/src/sg_bg_ctl.c:122: undefined reference to `get_scsi_pt_os_err'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_cmds_process_resp':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:240: undefined reference to `get_pt_req_lengths'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:241: undefined reference to `get_pt_actual_lengths'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:242: undefined reference to `get_scsi_pt_sense_len'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:243: undefined reference to `get_scsi_pt_sense_buf'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:244: undefined reference to `get_scsi_pt_result_category'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:229: undefined reference to `get_pt_duration_ns'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:285: undefined reference to `get_scsi_pt_status_response'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:321: undefined reference to `get_scsi_pt_transport_err_str'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:234: undefined reference to `get_scsi_pt_duration_ms'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:339: undefined reference to `get_scsi_pt_os_err_str'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_ll_inquiry_com':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:412: undefined reference to `partial_clear_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:413: undefined reference to `get_scsi_pt_cdb_buf'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:417: undefined reference to `get_scsi_pt_sense_buf'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:428: undefined reference to `set_scsi_pt_data_in'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:429: undefined reference to `do_scsi_pt'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:432: undefined reference to `get_scsi_pt_resid'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:422: undefined reference to `construct_scsi_pt_obj_with_fd'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:425: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:426: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:473: undefined reference to `destruct_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:470: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:468: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:436: undefined reference to `get_scsi_pt_os_err'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:420: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:416: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_ll_test_unit_ready_com':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:635: undefined reference to `partial_clear_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:636: undefined reference to `get_scsi_pt_cdb_buf'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:640: undefined reference to `get_scsi_pt_sense_buf'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:651: undefined reference to `set_scsi_pt_packet_id'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:652: undefined reference to `do_scsi_pt'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:658: undefined reference to `get_scsi_pt_sense_len'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:681: undefined reference to `destruct_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:678: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:676: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:645: undefined reference to `construct_scsi_pt_obj_with_fd'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:648: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:649: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:655: undefined reference to `get_scsi_pt_os_err'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:643: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:639: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_ll_request_sense_com':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:751: undefined reference to `get_scsi_pt_sense_buf'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:755: undefined reference to `get_scsi_pt_sense_buf'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:766: undefined reference to `set_scsi_pt_data_in'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:767: undefined reference to `do_scsi_pt'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:760: undefined reference to `construct_scsi_pt_obj_with_fd'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:763: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:764: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:796: undefined reference to `destruct_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:792: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:794: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:770: undefined reference to `get_scsi_pt_os_err'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:754: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:758: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_ll_report_luns_com':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:842: undefined reference to `partial_clear_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:843: undefined reference to `get_scsi_pt_cdb_buf'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:847: undefined reference to `get_scsi_pt_sense_buf'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:857: undefined reference to `set_scsi_pt_data_in'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:858: undefined reference to `do_scsi_pt'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:882: undefined reference to `destruct_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:879: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:877: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `create_pt_obj':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:359: undefined reference to `construct_scsi_pt_obj'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_ll_report_luns_com':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:854: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:855: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:862: undefined reference to `get_scsi_pt_os_err'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:850: undefined reference to `set_scsi_pt_sense'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: /home/Zibri/sg3_utils/lib/sg_cmds_basic.c:846: undefined reference to `set_scsi_pt_cdb'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_cmds_open_device':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:78: undefined reference to `scsi_pt_open_device'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_cmds_open_flags':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:86: undefined reference to `scsi_pt_open_flags'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_cmds_close_device':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:93: undefined reference to `scsi_pt_close_device'
/usr/lib/gcc/x86_64-pc-msys/11.2.0/../../../../x86_64-pc-msys/bin/ld: ../lib/.libs/libsgutils2.a(sg_cmds_basic.o): in function `sg_cmds_is_nvme':
/home/Zibri/sg3_utils/lib/sg_cmds_basic.c:353: undefined reference to `pt_device_is_nvme'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:795: sg_bg_ctl.exe] Error 1
make[2]: Leaving directory '/home/Zibri/sg3_utils/src'
make[1]: *** [Makefile:401: all-recursive] Error 1
make[1]: Leaving directory '/home/Zibri/sg3_utils'
make: *** [Makefile:333: all] Error 2
doug-gilbert commented 1 year ago

I have just built my latest (see: https://github.com/doug-gilbert/sg3_utils ) using MinGW64 and Msys with './autogen.sh ; ./configure --enable-win32-spt-direct ; make ' and gcc version 9.3.0 and don't see any errors. Note the version here is "sg3_utils-1.47 [20210407] [svn: r894]" and my current version/revision is "sg3_utils-1.48 [20230111] [svn: r997]". Hopefully Hans will find time to update this repository. One difficulty with building my latest version is that ./configure has been removed and you need to run ./autogen.sh to generate it . And ./autogen.sh requires autoconf so you may need to install that. Removing ./configure and friends saves around 49000 lines in the sg3_utils packages but requires a bit more work to build.

Zibri commented 1 year ago

Yep.. I forgot to run autogen.sh

./autogen.sh
./configure --enable-win32-spt-direct 
make

This worked.

Zibri commented 1 year ago

How to make the examples?

 MINGW64 ~/sg3_utils/examples
$ make
gcc -g -O2 -W -Wall -iquote ../include -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -c -o sg_simple1.o sg_simple1.c
sg_simple1.c:36:10: fatal error: sys/ioctl.h: No such file or directory
   36 | #include <sys/ioctl.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: sg_simple1.o] Error 1