Giter Club home page Giter Club logo

Comments (14)

yvoinov avatar yvoinov commented on August 15, 2024

Well, when I add -D_XPG6, error gone, but still has timeval issue:

cc -ggdb3 -std=c99 -Wall -Wextra -Wno-missing-field-initializers -Os -D_XPG6 -o endlessh endlessh.c
cc: Warning: Option -db3 passed to ld, if ld is invoked, ignored otherwise
cc: Warning: Option -Os passed to ld, if ld is invoked, ignored otherwise
"/usr/include/sys/resource.h", line 146: incomplete struct/union/enum timeval: ru_utime
"endlessh.c", line 152: (struct) tag redeclared: queue
"endlessh.c", line 419: warning: implicit function declaration: getline
"endlessh.c", line 566: warning: implicit function declaration: getopt
"endlessh.c", line 569: undefined symbol: optarg
"endlessh.c", line 569: warning: improper pointer/integer combination: arg #2
"endlessh.c", line 572: warning: improper pointer/integer combination: op "="
"endlessh.c", line 573: warning: improper pointer/integer combination: arg #2
"endlessh.c", line 580: warning: improper pointer/integer combination: arg #2
"endlessh.c", line 583: warning: improper pointer/integer combination: arg #2
"endlessh.c", line 586: warning: improper pointer/integer combination: arg #2
"endlessh.c", line 602: undefined symbol: optind
cc: acomp failed for endlessh.c
make: *** [Makefile:8: endlessh] Error 2

from endlessh.

skeeto avatar skeeto commented on August 15, 2024

from endlessh.

yvoinov avatar yvoinov commented on August 15, 2024

Oh, yeah. Thanks for remember me EXTENSIONS. ;) Forgot about it.

Now, any progress:

cc -std=c99 -Wall -Wextra -Wno-missing-field-initializers -xO4 -D_XPG6 -D__EXTENSIONS__=1 -o endlessh endlessh.c
"endlessh.c", line 152: (struct) tag redeclared: queue
"endlessh.c", line 419: warning: implicit function declaration: getline
cc: acomp failed for endlessh.c
make: *** [Makefile:8: endlessh] Error 2

It seems queue is declared externally.

Yes, -Os is only opt flag in gcc/clang. In Solaris cc opt prefixes is -xOn, and they has different. -xO4 will correct.

from endlessh.

yvoinov avatar yvoinov commented on August 15, 2024

After some experimens and corrections with code (PR #17) working combinations found:

CC = cc
CFLAGS = -std=c99 -Wall -Wextra -Wno-missing-field-initializers -xO4 -D_XPG6 -D__EXTENSIONS__=1
LDFLAGS =
LDLIBS = -lsocket -lnsl -lrt

Just remains some warnings:

cc -std=c99 -Wall -Wextra -Wno-missing-field-initializers -xO4 -D_XPG6 -D__EXTENSIONS__=1 -o endlessh endlessh.c -lsocket -lnsl -lrt
"endlessh.c", line 420: warning: argument #1 is incompatible with prototype:
prototype: restrict pointer to char : "/usr/include/iso/stdio_iso.h", line 220
argument : pointer to pointer to char
"endlessh.c", line 420: warning: improper pointer/integer combination: arg #2
"endlessh.c", line 420: warning: improper pointer/integer combination: op "!="

seems require cast with Oracle Developer Studio (early it shown strict requirements to pointer types and casts). :) Will dig.

from endlessh.

yvoinov avatar yvoinov commented on August 15, 2024

Warnings remains related fgets(), which is in stdio_iso.h as follows:

extern char *fgets(char *_RESTRICT_KYWD, int, FILE *_RESTRICT_KYWD);

from endlessh.

yvoinov avatar yvoinov commented on August 15, 2024

At least block

#ifdef __sun__	
    while (fgets(&line, len, f) != -1) {
#else

in PR#17 should be len as value, not as pointer. This reduces warnings to one:

cc -std=c99 -Wall -Wextra -Wno-missing-field-initializers -xO4 -D_XPG6 -D__EXTENSIONS__=1 -o endlessh endlessh.c -lsocket -lnsl -lrt
"endlessh.c", line 420: warning: argument #1 is incompatible with prototype:
prototype: restrict pointer to char : "/usr/include/iso/stdio_iso.h", line 220
argument : pointer to pointer to char
"endlessh.c", line 420: warning: improper pointer/integer combination: op "!="

:)

from endlessh.

yvoinov avatar yvoinov commented on August 15, 2024

Fixed. Updated PR #17

from endlessh.

skeeto avatar skeeto commented on August 15, 2024

from endlessh.

yvoinov avatar yvoinov commented on August 15, 2024

I took a different approach with b1c1599. No need to worry about EXTENSIONS on the command line, it just sets it in the source. I also went with "fifo" instead of "v_queue". Lastly, note the special instructions in the README. Let me know if there's anything I missed. I only tested on OpenIndiana and OmniOS, and neither of those use the Sun's cc. Thanks!

Yes, this will much better. Will test again updated. Thank you!

from endlessh.

skeeto avatar skeeto commented on August 15, 2024

from endlessh.

yvoinov avatar yvoinov commented on August 15, 2024

SunOS khorne 5.10 Generic_150401-64
Release 1/13, latest patch.

Will check 9f4bdc1

from endlessh.

yvoinov avatar yvoinov commented on August 15, 2024

Note: -D__EXTENSIONS__=1 still requires, without get build error:

cc -std=c99 -Wall -Wextra -Wno-missing-field-initializers -xO4 -o endlessh endlessh.c -lsocket -lnsl -lrt
"endlessh.c", line 70: undefined symbol: INET6_ADDRSTRLEN
"endlessh.c", line 70: can not declare variably modified type at file scope
"endlessh.c", line 460: undefined symbol: in6addr_any
cc: acomp failed for endlessh.c
make: *** [Makefile:10: endlessh] Error 2

Successfully built new code with CFLAGS = -std=c99 -Wall -Wextra -Wno-missing-field-initializers -xO4 -D__EXTENSIONS__=1 and LDLIBS = -lsocket -lnsl -lrt

from endlessh.

skeeto avatar skeeto commented on August 15, 2024

from endlessh.

yvoinov avatar yvoinov commented on August 15, 2024

Ah, so you're essentially running an operating system from 2005! That explains why you're completely missing some things. What happens if you change the feature test macro on the first line to: #define _XOPEN_SOURCE 600 Some research suggests this is required to get IPv6 definitions, and that _POSIX_C_SOURCE 200112L isn't quite enough.

Generally speaking, from 2013 :) 1/13 is latest point release and it's updated up to 2019 patch level. Imagine, it's still supported :)

NB: IPv6 supported by Sol 10, ever from release 5/05 :)

With macro #define XOPEN_SOURCE 600 is same like previous (all ok), if -D__EXTENSIONS_=1 specified.

from endlessh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.