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

Building on windows, command line, etc (PEBKAC) #1

Closed
Polaris34 opened this Issue Jan 10, 2019 · 42 comments

Comments

Projects
None yet
2 participants
@Polaris34
Copy link

Polaris34 commented Jan 10, 2019

When compiling, there is a popt.h error (Windows)

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

Well, it would help to know what the error is! I don't have windows...

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

6 | fatal error: popt.h: No such file or directory|

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

OK, well, that kinds of explains it - you don't have popt.h. You need popt for this. Install it and try again.

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

I can not find popt under windows.

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

Oh, OK.

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

I googled "popt for windows" and found this http://gnuwin32.sourceforge.net/packages/popt.htm
Does that help?

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

hmm.
puzzlebox.c: In function 'main':
puzzlebox.c:126:7: warning: implicit declaration of function 'errx' [-Wimplicit-function-declaration]
errx (1, "%s: %s\n", poptBadOption (optCon, POPT_BADOPTION_NOALIAS), poptStrerror (c));
^~~~
puzzlebox.c:139:14: warning: implicit declaration of function 'strdupa' [-Wimplicit-function-declaration]
path = strdupa (path);
^~~~~~~
puzzlebox.c:139:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
path = strdupa (path);
^
puzzlebox.c:149:8: warning: implicit declaration of function 'asprintf' [-Wimplicit-function-declaration]
asprintf (&error, "Path error [%s]\n", path);
^~~~~~~~
puzzlebox.c:379:13: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
char p = strdupa ((char * *) optionsTable[o].arg), *q;
^~~~~~~
puzzlebox.c:397:5: warning: implicit declaration of function 'gmtime_r' [-Wimplicit-function-declaration]
gmtime_r (&now, &t);
^~~~~~~~
puzzlebox.c: In function 'box':
puzzlebox.c:481:30: error: 'M_PIl' undeclared (first use in this function)
int W = ((int) (r1 * 2 * M_PIl / mazestep)) / nubs * nubs; // Default value
^~~~~
puzzlebox.c:481:30: note: each undeclared identifier is reported only once for each function it appears in
puzzlebox.c: In function 'makemaze':
puzzlebox.c:575:4: warning: implicit declaration of function 'err' [-Wimplicit-function-declaration]
err (1, "Open /dev/random");
^~~
puzzlebox.c: In function 'box':
puzzlebox.c:1116:12: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
char *p = strdupa (textend);
^~~~~~~
puzzlebox.c:1135:12: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
char *p = strdupa (textsides);
^~~~~~~

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

Well, if you don't have the gcc extensions, you could use strdup() not strdupa(). For the others, you'll need the appropriate libraries for errx(), gmtime_r(), maths, etc. I am sure it would not be too hard to make a version that will compile on windows. Good luck.

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

What does it need to compile it on Ubuntu?

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

Possible popt if you don't have it, but everything else should just work.

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

On Ubuntu 18.04.1 LTS
puzzlebox.c: In function ‘main’:
puzzlebox.c:139:14: warning: implicit declaration of function ‘strdupa’; did you mean ‘strdup’? [-Wimplicit-function-declaration]
path = strdupa (path);
^~~~~~~
strdup
puzzlebox.c:139:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
path = strdupa (path);
^
puzzlebox.c:149:8: warning: implicit declaration of function ‘asprintf’; did you mean ‘vsprintf’? [-Wimplicit-function-declaration]
asprintf (&error, "Path error [%s]\n", path);
^~~~~~~~
vsprintf
puzzlebox.c:286:14: warning: too many arguments for format [-Wformat-extra-args]
printf ("", optionsTable[o].argDescrip);
^~~~~~~
puzzlebox.c:379:13: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
char p = strdupa ((char * *) optionsTable[o].arg), *q;
^~~~~~~
puzzlebox.c: In function ‘box’:
puzzlebox.c:481:30: error: ‘M_PIl’ undeclared (first use in this function); did you mean ‘M_PI’?
int W = ((int) (r1 * 2 * M_PIl / mazestep)) / nubs * nubs; // Default value
^~~~~
M_PI
puzzlebox.c:481:30: note: each undeclared identifier is reported only once for each function it appears in
puzzlebox.c: In function ‘addpoint’:
puzzlebox.c:806:15: warning: too many arguments for format [-Wformat-extra-args]
errx (1, "WTF points 5d", S);
^~~~~~~~~~~~~~~
puzzlebox.c: In function ‘box’:
puzzlebox.c:1116:12: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
char *p = strdupa (textend);
^~~~~~~
puzzlebox.c:1135:12: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
char *p = strdupa (textsides);
^~~~~~~

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

That seems surprising as the Makefile does define _GNU_SOURCE which should enable GNU extensions for asprintf and strdupa.

I've changed M_PIl to M_PI anyway and fixed two of the typos you spotted.

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

/tmp/ccgJN2Sm.o: In function main': puzzlebox.c:(.text+0xee6): undefined reference to poptHelpOptions'
puzzlebox.c:(.text+0xf21): undefined reference to poptGetContext' puzzlebox.c:(.text+0xf37): undefined reference to poptGetNextOpt'
puzzlebox.c:(.text+0xf53): undefined reference to poptStrerror' puzzlebox.c:(.text+0xf6a): undefined reference to poptBadOption'
puzzlebox.c:(.text+0xf95): undefined reference to poptPeekArg' puzzlebox.c:(.text+0xfb8): undefined reference to poptPrintUsage'
puzzlebox.c:(.text+0xfd1): undefined reference to poptFreeContext' puzzlebox.c:(.text+0x1000): undefined reference to strdupa'
puzzlebox.c:(.text+0x254d): undefined reference to strdupa' /tmp/ccgJN2Sm.o: In function makemaze.5307':
puzzlebox.c:(.text+0x31d3): undefined reference to atan' puzzlebox.c:(.text+0x46db): undefined reference to sin'
puzzlebox.c:(.text+0x4702): undefined reference to cos' /tmp/ccgJN2Sm.o: In function box.5287':
puzzlebox.c:(.text+0x6726): undefined reference to cos' puzzlebox.c:(.text+0x6d63): undefined reference to cos'
puzzlebox.c:(.text+0x6e09): undefined reference to cos' puzzlebox.c:(.text+0x716c): undefined reference to strdupa'
puzzlebox.c:(.text+0x72e2): undefined reference to sin' puzzlebox.c:(.text+0x7309): undefined reference to strdupa'
/tmp/ccgJN2Sm.o: In function addnub.5555': puzzlebox.c:(.text+0x8590): undefined reference to cos'
puzzlebox.c:(.text+0x85e9): undefined reference to sin' puzzlebox.c:(.text+0x86f8): undefined reference to cos'
puzzlebox.c:(.text+0x871f): undefined reference to `sin'
collect2: error: ld returned 1 exit status

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

How are you doing that? The Makefile clearly links in the libraries! You are running "make" are you?

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

on terminal,
/PuzzleBox-master$ make puzzlebox

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

Well, the cc line includes -lm (for maths) and -lpopt (for popt) so those functions should all be linked in. Maybe google a bit more...

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

I restarted the laptop and now there is something like that:

indent puzzlebox.c
make: indent: Command not found
Makefile:2: recipe for target 'puzzlebox' failed
make: [puzzlebox] Error 127 (zignorowano)
cc -O -o puzzlebox puzzlebox.c -lpopt -lm -g -D_GNU_SOURCE
puzzlebox.c: In function ‘main’:
puzzlebox.c:152:8: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf (&error, "Path error [%s]\n", path);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
puzzlebox.c:160:8: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf (&error, "Unknown arg [%c]", arg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
puzzlebox.c:169:7: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf (&error, "Missing value [%c=]", arg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
puzzlebox.c:178:7: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf (&error, "Missing value [%c=]", arg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
puzzlebox.c:196:7: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
asprintf (&error, "Missing value [%c=]", arg);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

Ok those are warnings you can ignore. I may change later to remove those.

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

ok, a puzzlebox file has been created, what's next?

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

Err, run it, the output is an OpenSCAD file!
If you run with --help you see the various options available.

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

How should I run it in OpenSCAD? OpenSCAD can not see this file.

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

Your run puzzlebox, and the output is an OpenSCAD file, put it somewhere, e.g.
./puzzlebox > mypuzzle.scad

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

how run puzzlebox?

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

How do you normally run something?
You type the name/path of the thing.
Try something like

./puzzlebox > mypuzzle.scad

As I suggested above.

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

double click :p

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

but the file that you have created does not have the .scad format

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

The output from puzzlebox is an SCAD file. In what way is it not ".scad" format?

If you normally just "double click" I am rather surprised you are trying to build this from source rather than just using the web page https://www.me.uk/puzzlebox to make an SCAD. Are you planning to make changes to the code?

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

I have ;
MakeFile
makesamples
puzzlebox <- this created
puzzlebox.c
README.md
webform.cgi

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

Yes, and running it makes an SCAD file.
Did you try :-

./puzzlebox > mypuzzle.scad

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

/PuzzleBox-master/puzzlebox.scad", line 1: syntax error
ERROR: Compilation failed!

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

What on earth did you do to create that error?

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

What is in line 1 of puzzlebox.scad

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

What, what is puzzlebox.scad anyway, if you ran

./puzzlebox > mypuzzle.scad

You would have mypuzzle.scad

You did not rename puzzlebox to puzzlebox.scad did you?

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

I changed the name to puzzlebox.scad, I do not have this file mypuzzle.scad

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

OK, I have given you a command you can run that will make mypuzzle.scad several times now and you have not run it.

At this point you have gone from simple PEBKAC to trolling.

Have a nice day.

@revk revk closed this Jan 10, 2019

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

I'm sorry I did not want to piss you off, linux is not the system on which I work.

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

Now I understand that I have to enter it in the terminal.
./puzzlebox> mypuzzle.scad

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

Would you help just one more thing?

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

What?

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

where should I enter this --help?

@revk

This comment has been minimized.

Copy link
Owner

revk commented Jan 10, 2019

You need to go and read up on how to actually use command line!

I am surprised you have gone to the bother of building this from source and not just using https://www.me.uk/puzzlebox

However, try this (yes, it means typing it at the command line prompt!)

./puzzlebox --help

@revk revk changed the title popt.h error Building on windows, command line, etc (PEBKAC) Jan 10, 2019

@Polaris34

This comment has been minimized.

Copy link
Author

Polaris34 commented Jan 10, 2019

you're a Good Man, thx for all :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment