# Smartmontools won't compile from ports



## Weaseal (Feb 18, 2010)

```
Script started on Thu Feb 18 10:17:30 2010
[root@ports /usr/ports/sysutils/smartmontools]# make clean
===>  Cleaning for smartmontools-5.39_2
[root@ports /usr/ports/sysutils/smartmontools]# make
===>  Vulnerability check disabled, database not found
===>  Extracting for smartmontools-5.39_2
=> MD5 Checksum OK for smartmontools-5.39.tar.gz.
=> SHA256 Checksum OK for smartmontools-5.39.tar.gz.
===>  Patching for smartmontools-5.39_2
===>   smartmontools-5.39_2 depends on executable: gmake - found
===>  Configuring for smartmontools-5.39_2
checking for a BSD-compatible install... /usr/bin/install -c -o root -g wheel
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether c++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of c++... gcc3
checking for gcc... cc
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking dependency style of cc... gcc3
checking dependency style of cc... gcc3
checking build system type... amd64-portbld-freebsd8.0
checking host system type... amd64-portbld-freebsd8.0
checking whether this is a build from SVN... no
checking for library containing socket... none required
checking for library containing gethostbyname... none required
checking for library containing getaddrinfo... none required
checking for library containing getdomainname... none required
checking how to run the C++ preprocessor... c++ -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... no
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking dev/ata/atavar.h usability... no
checking dev/ata/atavar.h presence... no
checking for dev/ata/atavar.h... no
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking sys/inttypes.h usability... no
checking sys/inttypes.h presence... no
checking for sys/inttypes.h... no
checking sys/int_types.h usability... no
checking sys/int_types.h presence... no
checking for sys/int_types.h... no
checking sys/tweio.h usability... no
checking sys/tweio.h presence... no
checking for sys/tweio.h... no
checking sys/twereg.h usability... no
checking sys/twereg.h presence... no
checking for sys/twereg.h... no
checking sys/tw_osl_ioctl.h usability... no
checking sys/tw_osl_ioctl.h presence... no
checking for sys/tw_osl_ioctl.h... no
checking dev/ciss/cissio.h usability... yes
checking dev/ciss/cissio.h presence... yes
checking for dev/ciss/cissio.h... yes
checking linux/compiler.h usability... no
checking linux/compiler.h presence... no
checking for linux/compiler.h... no
checking for linux/cciss_ioctl.h... no
checking for int64_t... yes
checking for uint64_t... yes
checking for getopt_long... yes
checking for getdomainname... yes
checking for gethostname... yes
checking for getaddrinfo... yes
checking for gethostbyname... yes
checking for sigset... no
checking for strtoull... yes
checking for uname... yes
checking for working snprintf... yes
checking whether C++ compiler supports __attribute__((packed))... yes
checking for OS dependent modules and libraries... checking for libusb20_dev_get_device_desc in -lusb... yes
os_freebsd.o cciss.o -lcam
checking whether os_freebsd.cpp uses new interface... yes
checking whether g++ supports -fno-strict-aliasing... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating examplescripts/Makefile
config.status: creating config.h
config.status: executing depfiles commands
checking whether make sets $(MAKE)... (cached) yes
===>  Building for smartmontools-5.39_2
make  all-recursive
Making all in .
c++ -DHAVE_CONFIG_H -I.   -DBUILD_INFO='"(local build)"'  -DSMARTMONTOOLS_SYSCONFDIR='"/usr/local/etc"'     -I/usr/src/sys  -O -pipe 
-march=athlon64 -Wno-write-strings -Wall -W -fno-strict-aliasing -MT smartd.o -MD -MP -MF .deps/smartd.Tpo -c -o smartd.o smartd.cpp
In file included from smartd.cpp:36:
/usr/include/string.h:86: error: expected initializer before '__malloc_like'
/usr/include/string.h:104: error: expected initializer before '__malloc_like'
In file included from smartd.cpp:39:
/usr/include/stdlib.h:90: error: expected initializer before '__malloc_like'
/usr/include/stdlib.h:97: error: expected initializer before '__malloc_like'
In file included from /usr/include/c++/4.2/bits/stl_algobase.h:69,
                 from /usr/include/c++/4.2/bits/char_traits.h:47,
                 from /usr/include/c++/4.2/string:48,
                 from /usr/include/c++/4.2/stdexcept:45,
                 from smartd.cpp:45:
/usr/include/c++/4.2/cstdlib:116: error: '::calloc' has not been declared
/usr/include/c++/4.2/cstdlib:123: error: '::malloc' has not been declared
In file included from /usr/include/c++/4.2/cwchar:56,
                 from /usr/include/c++/4.2/bits/postypes.h:47,
                 from /usr/include/c++/4.2/iosfwd:50,
                 from /usr/include/c++/4.2/bits/stl_algobase.h:71,
                 from /usr/include/c++/4.2/bits/char_traits.h:47,
                 from /usr/include/c++/4.2/string:48,
                 from /usr/include/c++/4.2/stdexcept:45,
                 from smartd.cpp:45:
/usr/include/wchar.h:218: error: expected initializer before '__malloc_like'
smartd.cpp: In function 'void ParseOpts(int, char**)':
smartd.cpp:3826: error: 'strdup' was not declared in this scope
*** Error code 1

Stop in /usr/ports/sysutils/smartmontools/work/smartmontools-5.39.
*** Error code 1

Stop in /usr/ports/sysutils/smartmontools/work/smartmontools-5.39.
*** Error code 1

Stop in /usr/ports/sysutils/smartmontools/work/smartmontools-5.39.
*** Error code 1

Stop in /usr/ports/sysutils/smartmontools.

[root@ports /usr/ports/sysutils/smartmontools]# uname -a
FreeBSD <hostname> 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0 r201693: Wed Jan  6 19:51:46 EST 2010     root@<hostname>:/usr/obj/usr/src/sys
/RELNKERN  amd64
[root@ports /usr/ports/sysutils/smartmontools]# exit

Script done on Thu Feb 18 10:17:49 2010
```
Any thoughts?


----------



## DutchDaemon (Feb 18, 2010)

Works fine here. 

```
===>  Building for smartmontools-5.39_2
make  all-recursive
Making all in .
c++ -DHAVE_CONFIG_H -I.   -DBUILD_INFO='"(local build)"'  -DSMARTMONTOOLS_SYSCONFDIR='"/usr/local/etc"'     -I/usr/src/sys  -O -pipe -Wno-write-
strings -Wall -W -fno-strict-aliasing -MT smartd.o -MD -MP -MF .deps/smartd.Tpo -c -o smartd.o smartd.cpp
mv -f .deps/smartd.Tpo .deps/smartd.Po (etc. etc.)
```
The only difference I can see in the line after which your build failed is your additional *-march=athlon64*. Try without it?

And make sure the ports tree and all of your installed ports are up to date, especially: devel/gmake (build dep).


----------



## Weaseal (Feb 18, 2010)

Hi DutchDaemon,
The ports' tree is up-to-date and I've rebuilt gmake as well.  I tried without the -march setting and it still fails with the same error.


----------



## DutchDaemon (Feb 19, 2010)

Here's my entire 'pre-make'. Compare it to yours and see if something interesting turns up. I have nothing pertinent in /etc/make.conf, btw.


```
=> smartmontools-5.39.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch from http://softlayer.dl.sourceforge.net/project/smartmontools/smartmontools/5.39/.
fetch: http://softlayer.dl.sourceforge.net/project/smartmontools/smartmontools/5.39/smartmontools-5.39.tar.gz: Moved Temporarily
=> Attempting to fetch from http://switch.dl.sourceforge.net/project/smartmontools/smartmontools/5.39/.
smartmontools-5.39.tar.gz                     100% of  642 kB  766 kBps
===>  Extracting for smartmontools-5.39_2
=> MD5 Checksum OK for smartmontools-5.39.tar.gz.
=> SHA256 Checksum OK for smartmontools-5.39.tar.gz.
===>  Patching for smartmontools-5.39_2
===>   smartmontools-5.39_2 depends on executable: gmake - found
===>  Configuring for smartmontools-5.39_2
checking for a BSD-compatible install... /usr/bin/install -c -o root -g wheel
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether c++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of c++... gcc3
checking for gcc... cc
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking dependency style of cc... gcc3
checking dependency style of cc... gcc3
checking build system type... amd64-portbld-freebsd8.0
checking host system type... amd64-portbld-freebsd8.0
checking whether this is a build from SVN... no
checking for library containing socket... none required
checking for library containing gethostbyname... none required
checking for library containing getaddrinfo... none required
checking for library containing getdomainname... none required
checking how to run the C++ preprocessor... c++ -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking dev/ata/atavar.h usability... no
checking dev/ata/atavar.h presence... no
checking for dev/ata/atavar.h... no
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking sys/inttypes.h usability... no
checking sys/inttypes.h presence... no
checking for sys/inttypes.h... no
checking sys/int_types.h usability... no
checking sys/int_types.h presence... no
checking for sys/int_types.h... no
checking sys/tweio.h usability... no
checking sys/tweio.h presence... no
checking for sys/tweio.h... no
checking sys/twereg.h usability... no
checking sys/twereg.h presence... no
checking for sys/twereg.h... no
checking sys/tw_osl_ioctl.h usability... no
checking sys/tw_osl_ioctl.h presence... no
checking for sys/tw_osl_ioctl.h... no
checking dev/ciss/cissio.h usability... yes
checking dev/ciss/cissio.h presence... yes
checking for dev/ciss/cissio.h... yes
checking linux/compiler.h usability... no
checking linux/compiler.h presence... no
checking for linux/compiler.h... no
checking for linux/cciss_ioctl.h... no
checking for int64_t... yes
checking for uint64_t... yes
checking for getopt_long... yes
checking for getdomainname... yes
checking for gethostname... yes
checking for getaddrinfo... yes
checking for gethostbyname... yes
checking for sigset... no
checking for strtoull... yes
checking for uname... yes
checking for working snprintf... yes
checking whether C++ compiler supports __attribute__((packed))... yes
checking for OS dependent modules and libraries... checking for libusb20_dev_get_device_desc in -lusb... yes
os_freebsd.o cciss.o -lcam
checking whether os_freebsd.cpp uses new interface... yes
checking whether g++ supports -fno-strict-aliasing... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating examplescripts/Makefile
config.status: creating config.h
config.status: executing depfiles commands
checking whether make sets $(MAKE)... (cached) yes
===>  Building for smartmontools-5.39_2
make  all-recursive
Making all in .
c++ -DHAVE_CONFIG_H -I.   -DBUILD_INFO='"(local build)"'  -DSMARTMONTOOLS_SYSCONFDIR='"/usr/local/etc"'     -I/usr/src/sys  -O -pipe 
-Wno-write-strings -Wall -W -fno-strict-aliasing -MT smartd.o -MD -MP -MF .deps/smartd.Tpo -c -o smartd.o smartd.cpp
mv -f .deps/smartd.Tpo .deps/smartd.Po
[etc.]
```


----------

