Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile on Solaris #1

Open
mohag opened this issue Jan 12, 2012 · 10 comments · May be fixed by #39
Open

Unable to compile on Solaris #1

mohag opened this issue Jan 12, 2012 · 10 comments · May be fixed by #39

Comments

@mohag
Copy link
Contributor

mohag commented Jan 12, 2012

Hi,

Low priority.

dma version: 0.7

Unable to compile on Solaris 9 or 10.

The yacc does not support the -o option. Setting YACC to bison fixes that...

get-version.sh need to be edited to use bash. (The "$()" construct is not valid in real Bourne shell)

err.h needs some help to be found...

Output for Solaris 10 with GNU make is then:
$ C_INCLUDE_PATH=/usr/sfw/include/openssl gmake
get-version.sh: syntax error at line 3: gitver=$' unexpected gcc -O -pipe -Wall -DDMA_VERSION='""' -DLIBEXEC_PATH='"/usr/local/lib"' -DCONF_PATH='"/etc/dma"' -include dfcompat.h -o aliases_parse.o -c aliases_parse.c In file included from aliases_parse.y:5: **dma.h:111: error: redefinition ofstruct queue'**
aliases_parse.y: In function yyerror': aliases_parse.y:15: warning: implicit declaration of functionwarnx'
/usr/ccs/bin/yaccpar: At top level:
/usr/ccs/bin/yaccpar:5: warning: ignoring #pragma ident
/usr/ccs/bin/yaccpar: In function yyparse': /usr/ccs/bin/yaccpar:164: warning: labelyynewstate' defined but not used
/usr/ccs/bin/yaccpar:374: warning: label `yyerrlab' defined but not used
gmake: *** [aliases_parse.o] Error 1

It might be that it is mostly documentation problems... (Dependencies, etc is not clear from the README)

Thanks,
Gert van den Berg

@corecode
Copy link
Owner

Thanks for your report!

I'll look into changing the yacc command line.

$() is a valid command substitution according to SUS: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_03; I think this is a Solaris specialty.

I'll have to see what I can do about err.h.

Could you tell me what defines struct queue?

@mohag
Copy link
Contributor Author

mohag commented Jan 12, 2012

Hi, The Solaris sh man page is here: http://docs.oracle.com/cd/E19963-01/html/821-1461/sh-1.html

(There is a POSIX-compliant option in /usr/xpg4/bin, but it is not the default) (/bin is a symlink to /usr/bin on Solaris)

The Solaris sh seem to be an actual derivative of the Bourne shell... A version can be found here for testing: http://heirloom.sourceforge.net/sh.html

Solaris 11 uses ksh as its /bin/sh, which might work better. (It might make sense to mention in the documentation that a standard compliant /bin/sh is required)

bison works fine as yacc, it might make sense to mention in the readme (or a "INSTALL" file) which yacc is expected.

I'll try to find the gcc parameter that gives preprocessed code for the struct queue issue if I'm near the Solaris server again...

(Things like "make install" might also need work on Solaris - sendmail is installed and runs by default, but that is probably a matter for packagers / another issue)

An option to compile without OpenSSL might also have its uses (e.g. for embedded systems), but that should probably be a feature request.

For the documentation it might make sense to mention something like this: (I have not actually tested this list, specifying versions might also be necessary if some versions is known bad...) (Noting when POSIX-compliant versions is fine might also help)
Requirements:
cc - gcc is known to work
yacc - bison works
make - BSD make, GNU make works
A POSIX compliant shell - edit get-version.sh to paoint to it if it is not in /bin/sh (Bash is known to work)
lex - flex works
openssl - version xxxx or newer, ensure that the headers can be found or add their location to C_INCLUDE_PATH
install - BSD, GNU install works

Set the CC, YACC, INSTALL and LEX variable to relevant commands if you have problems.

Gert

@corecode
Copy link
Owner

Thanks for the useful feedback. I'll try to update the docs as soon as
I have time. If you send me a pull request, I can update them right away.

On 01/12/2012 06:48 PM, mohag wrote:

Hi, The Solaris sh man page is here: http://docs.oracle.com/cd/E19963-01/html/821-1461/sh-1.html

(There is a POSIX-compliant option in /usr/xpg4/bin, but it is not the default) (/bin is a symlink to /usr/bin on Solaris)

The Solaris sh seem to be an actual derivative of the Bourne shell... A version can be found here for testing: http://heirloom.sourceforge.net/sh.html

Solaris 11 uses ksh as its /bin/sh, which might work better. (It might make sense to mention in the documentation that a standard compliant /bin/sh is required)

bison works fine as yacc, it might make sense to mention in the readme (or a "INSTALL" file) which yacc is expected.

I'll try to find the gcc parameter that gives preprocessed code for the struct queue issue if I'm near the Solaris server again...

(Things like "make install" might also need work on Solaris - sendmail is installed and runs by default, but that is probably a matter for packagers / another issue)

An option to compile without OpenSSL might also have its uses (e.g. for embedded systems), but that should probably be a feature request.

For the documentation it might make sense to mention something like this: (I have not actually tested this list, specifying versions might also be necessary if some versions is known bad...) (Noting when POSIX-compliant versions is fine might also help)
Requirements:
cc - gcc is known to work
yacc - bison works
make - BSD make, GNU make works
A POSIX compliant shell - edit get-version.sh to paoint to it if it is not in /bin/sh (Bash is known to work)
lex - flex works
openssl - version xxxx or newer, ensure that the headers can be found or add their location to C_INCLUDE_PATH
install - BSD, GNU install works

Set the CC, YACC, INSTALL and LEX variable to relevant commands if you have problems.

Gert


Reply to this email directly or view it on GitHub:
#1 (comment)

@mohag
Copy link
Contributor Author

mohag commented Jan 12, 2012

Just some notes on shells:
bash / ksh93 / dash / zsh works for get-version.sh (That is what my Linux PC had installed to test with)

@mohag
Copy link
Contributor Author

mohag commented Jan 13, 2012

I pasted the preprocessor output here: https://gist.github.com/1604902

Looks like stream.h might be the culprit...

@mohag
Copy link
Contributor Author

mohag commented Jan 13, 2012

@mohag
Copy link
Contributor Author

mohag commented Jan 13, 2012

Defining _XPG_4_2 gets rid of the stream.h header (for STREAMS), but it results in some IPv6 related things breaking:

$ C_INCLUDE_PATH=/usr/sfw/include/openssl gcc -O -pipe -Wall -D_XPG4_2 -DDMA_VERSION='"v0.7"' -DLIBEXEC_PATH='"/usr/local/lib"' -DCONF_PATH='"/etc/dma"'  -include dfcompat.h -c aliases_parse.c
In file included from aliases_parse.y:5:
dma.h:147: error: `INET6_ADDRSTRLEN' undeclared here (not in a function)
dma.h:149: error: field `ai' has incomplete type
dma.h:150: error: field `sa' has incomplete type
aliases_parse.y: In function `yyerror':
aliases_parse.y:15: warning: implicit declaration of function `warnx'

@corecode
Copy link
Owner

Oh that is inconvenient... How can we get to the IPv6 stuff then?

@mohag
Copy link
Contributor Author

mohag commented Jan 13, 2012

This fixes the queue issue:
for file in *.y *.c *.h; do
mv "$file" "$file.bak"
sed "s/struct queue /struct dma_queue /g" "$file.bak" > "$file"
done

paths.h is also missing. It seem to be present on Solaris 11 though: http://docs.oracle.com/cd/E23824_01/html/821-1464/paths.h-3head.html

Commenting out the #include for it and adding this in a few place makes process, but it still fails on later files:
#ifndef _PATH_MAILDIR
#define _PATH_MAILDIR "/var/mail"
#endif

The later errors seem to be mainly related to LOCK_EX not being defined on Solaris.

(LOCK_EX is defined in the include files in /usr/ucbinclude, but adding them to C_INCLUDE_PATH causes other failures)

Hardcoding the path to the file.h in util.c and spool.c with LOCK_EX gets me further....

It then fails in dfcompat.c with:
dfcompat.c:119:2: #error "no getprogname implementation available"

Using this as a replacement makes it compile:
const char *
getprogname(void)
{
return getexecname();
}

It then returns some linker errors:

gcc  -o dma aliases_parse.o aliases_scan.o base64.o conf.o crypto.o dma.o dns.o local.o mail.o net.o spool.o util.o dfcompat.o -lssl -lcrypto -lresolv
Undefined                       first referenced
 symbol                             in file
err                                 dma.o
errx                                dma.o
flock                               spool.o
warnx                               aliases_parse.o
__ns_name_uncompress                dns.o
socket                              net.o  (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
strsep                              conf.o
getnameinfo                         dns.o  (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
roundup                             dns.o
connect                             net.o  (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
asprintf                            dma.o
getaddrinfo                         dns.o  (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
freeaddrinfo                        dns.o  (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
ld: fatal: Symbol referencing errors. No output written to dma
collect2: ld returned 1 exit status
gmake: **\* [dma] Error 1

Adding -lsocket to LDADD in the Makefile shorten the list...

Undefined                       first referenced
 symbol                             in file
err                                 dma.o
errx                                dma.o
flock                               spool.o
warnx                               aliases_parse.o
__ns_name_uncompress                dns.o
strsep                              conf.o
roundup                             dns.o
asprintf                            dma.o
ld: fatal: Symbol referencing errors. No output written to dma
collect2: ld returned 1 exit status
gmake: *** [dma] Error 1```

The roudup error can be solved by adding:
    #include <sys/sysmacros.h>
to dns.c

The strsep can be remove from the list by replacing it with strtok.

That is about the amount of progress that I was able to make today.

I'm quite sure that it might work somewhat easier to install some packages (Its GCC / libgcc version especially) from sunfreeware / blastwave to get some of the dependencies, but that would prevent it from compiling on a standard install without third-party packages.

@mohag
Copy link
Contributor Author

mohag commented Jan 13, 2012

Not defining _XPG_4_2 and renaming the "queue" type (my script above renames it to dma_queue) gets rid of the conflict and allows the IPv6 stuff.

@drscream drscream linked a pull request Feb 24, 2016 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants