#linker (?) error during compilation of someone else's program

107 messages · Page 1 of 1 (latest)

trim elkBOT
#

@rough laurel

File Attachments Not Allowed

For safety reasons we do not allow files with certain file extensions.

not_kronyx Said

so i'm trying to compile a program from source on linux (kociemba cube explorer, a command line rubik's cube solver; source appended)
readme.txt says to just invoke "make" but when i do so this happens (image related)
i believe it happens due to the same header file being included on multiple occasions

i'm a massive newb for not knowing how headers objects and linkers work and interact, i know

Code Formatting

You can share your code using triple backticks like this:
```
YOUR CODE
```

Large Portions of Code

For longer scripts use a code hosting platform like GitHub Gists and share the link here

Ignored these files due to them having disallowed file extensions
  • optiqtmSrc.zip
rough laurel
#

ok, it seems i can't attach files

#

what follows is an exert from the site with arrows indicating where the link to the source code is located
"If you are interested in an Optimal Cube Solver in the Quarter Turn Metric which runs on the command line under LINUX and WINDOWS, you can download the documented C source code --->>here<<--(this one)."

#

the "this" that happens when running make will be pasted now in plain text

trim elkBOT
#

-# :warning: Files from unknown sources can be dangerous. Download with care. :warning:

rough laurel
#

post's kind of a mess but i hope it's comprehensible enough

tulip crypt
#

probably some include issues

#

will check when I'm back in the office

tulip crypt
#

That code is so ugly jesus christ

#

ok managed to make it compile by fxiing up some stuff

#

I'll share the patch here (and then try to make it fast and multithreaded in Rust because fun)

#

seems to work?

#

nvm it didn't take half an hour it was like 30 seconds

#
diff cubedefs.h.bak cubedefs.h
124,139c124,139
< extern CubieCube symCube[NSYM_Oh];
< extern CubieCube moveCube[NMOVE];
< extern int invSymIdx[NSYM_Oh];
< extern int symIdxMultiply[NSYM_Oh][NSYM_Oh];
< extern int moveConjugate[NMOVE][NSYM_Oh];
< extern int twistConjugate[NTWIST][NSYM_D4h];
< extern int rawFlipSliceRep[NFLIPSLICE];
< extern char nextMove[NMBITS][NMOVE+1];
< extern unsigned short int twistMove[NTWIST][NMOVE];
< extern unsigned short int corn6PosMove[NCORN6POS][NMOVE];
< extern unsigned short int edge4PosMove[NEDGE4POS][NMOVE];
< extern int edge6PosMove[NEDGE6POS][NMOVE];
< extern int symFlipSliceClassMove[NFLIPSLICE][NMOVE];
< extern short *movesCloserToTarget[NTWIST];
< extern short moveBitsConjugate[4096][NSYM_Oh];
< extern unsigned long long ESymmetries[NMOVE],GESymmetries[NMOVE];
---
> CubieCube symCube[NSYM_Oh];
> CubieCube moveCube[NMOVE];
> int invSymIdx[NSYM_Oh];
> int symIdxMultiply[NSYM_Oh][NSYM_Oh];
> int moveConjugate[NMOVE][NSYM_Oh];
> int twistConjugate[NTWIST][NSYM_D4h];
> int rawFlipSliceRep[NFLIPSLICE];
> char nextMove[NMBITS][NMOVE+1];
> unsigned short int twistMove[NTWIST][NMOVE];
> unsigned short int corn6PosMove[NCORN6POS][NMOVE];
> unsigned short int edge4PosMove[NEDGE4POS][NMOVE];
> int edge6PosMove[NEDGE6POS][NMOVE];
> int symFlipSliceClassMove[NFLIPSLICE][NMOVE];
> short *movesCloserToTarget[NTWIST];
> short moveBitsConjugate[4096][NSYM_Oh];
> unsigned long long ESymmetries[NMOVE],GESymmetries[NMOVE];
142c142
< extern char *coset;
---
> char *coset;
144,145c144,145
< extern char *visitedA;
< extern char *visitedB;
---
> char *visitedA;
> char *visitedB;
#
diff optiqtm.c.bak optiqtm.c                                                                                                                 
< #pragma once
23,46d21
< 
< CubieCube symCube[NSYM_Oh];
< CubieCube moveCube[NMOVE];
< int invSymIdx[NSYM_Oh];
< int symIdxMultiply[NSYM_Oh][NSYM_Oh];
< int moveConjugate[NMOVE][NSYM_Oh];
< int twistConjugate[NTWIST][NSYM_D4h];
< int rawFlipSliceRep[NFLIPSLICE];
< char nextMove[NMBITS][NMOVE+1];
< unsigned short int twistMove[NTWIST][NMOVE];
< unsigned short int corn6PosMove[NCORN6POS][NMOVE];
< unsigned short int edge4PosMove[NEDGE4POS][NMOVE];
< int edge6PosMove[NEDGE6POS][NMOVE];
< int symFlipSliceClassMove[NFLIPSLICE][NMOVE];
< short *movesCloserToTarget[NTWIST];
< short moveBitsConjugate[4096][NSYM_Oh];
< unsigned long long ESymmetries[NMOVE],GESymmetries[NMOVE];
< 
< 
< char *coset;
< 
< char *visitedA;
< char *visitedB;
< ```
rough laurel
#

do i replace the contents of cubedefs.h with this?

tulip crypt
#

No those are the patches for cubedefs.h and optiqtm.c

tulip crypt
rough laurel
#

i'm self taught and really really green, i'm sorry

tulip crypt
#

No worries lol

#

I can share the modified files here as well if that's easier

rough laurel
#

i'll try replacing by hand

tulip crypt
#

mostly just copying the stuff from cubedefs to optiqtm

#

and then adding extern on each line of those global vars in the cubedefs

rough laurel
#

i see

#

also just noticing what you did with the "<>"s

#

that's clever

tulip crypt
#

oh that thing was generated by the diff tool on Linux

#

spits out the difference between two files with the "this goes in" and "this went out"

rough laurel
#

no idea that existed

#

still just as neat lol

rough laurel
tulip crypt
#

I love working with big brain people 🔥

rough laurel
#

i wish i could do it but with my skill i can barely print the result of 1 plus 1

tulip crypt
rough laurel
#

there's an initial loading time that goes away when you run it again
but that's not the only loading time

#

it's still quite slow to find solutions

#

you can try it with this test scramble (just paste it in when it asks for a cube)
F B D' U L' B' R' F' D U' L2 R' D B' R B' L2 U' B D'

#

running it as

./optiqtm +

finds all optimal solutions, too

#

which takes a while

#

but anyway, thanks a lot my guy @tulip crypt

tulip crypt
#

Ah thanks, will run

#

Haven't done the Rubik's cube in ages

tulip crypt
#

looks reasonable I guess

trim elkBOT
#

@tulip crypt

File Attachments Not Allowed

For safety reasons we do not allow files with certain file extensions.

Code Formatting

You can share your code using triple backticks like this:
```
YOUR CODE
```

Large Portions of Code

For longer scripts use a code hosting platform like GitHub Gists and share the link here

Ignored these files due to them having disallowed file extensions
  • cubedefs.h.bak
  • optiqtm.c.bak
tulip crypt
#

shit bot

rough laurel
#

20 is the maximum amount of moves to solve any scramble

tulip crypt
trim elkBOT
#

-# :warning: Files from unknown sources can be dangerous. Download with care. :warning:

rough laurel
#

or 21? something like that

#

this is depth right?

tulip crypt
#

Where?

rough laurel
tulip crypt
#

I guess the depth is the move count yeah

tulip crypt
# tulip crypt

if you just throw these two in the directory (replace the old files) it'll compile and work

rough laurel
#

nice, gotta help the next ones to see this

tulip crypt
#

might try to rebuild that thing later tonight

#

sounds like a fun project (even tho my Rubik's cube is still lost)

#

still have the suspicion I lost it in a plane or some hotel

rough laurel
#

just fly to brazil and you can borrow mine

tulip crypt
#

Any recommendations if I were to buy a new one?

#

Had the GAN 356 X stickerless I believe

#

shit was hella cool with the magnets and the adjustable tension but I was never super fast anyway 💀

rough laurel
#

i got mine yesterday, so can't say i know my stuff

#

it's a moyu mei long

tulip crypt
#

🗿 cube fr

#

idk if there's any difference tbh

#

ye they look exactly the same 🤣

rough laurel
#

i think the moyu is worse

#

if not skill issues

tulip crypt
#

if it cubes it cubes

rough laurel
#

the magnets don't seem that good

#

very easy to under/over shot

tulip crypt
#

might need different strength (or you are just too strong fr)

#

Question is do I read about how the program works or do I just port it 1:1 🤔

rough laurel
#

no, the magnets just suck

rough laurel
#

goes over how it works

tulip crypt
#

Do I look like I can read 💀

rough laurel
#

yes

tulip crypt
#
The solver finds the shortes solution(s) for a scrambled Rubik's in the quarter turn metric, where a 90 degree faceturn counts as one move and a 180 degree move counts as two moves. The program uses about 600 MB of RAM, mainly for a big pruning table. This pruning table holds information about the moves which transform a given cube closer to a certain subgroup H of the cube (see sourcecode for details).```
#

Wonder if I can make it use more RAM

#

and all of the cores 🗣️

rough laurel
#

oh, reading about the inner workings, not just how to use it

#

i'm slow

tulip crypt
#

Guess I'll have to read the website and some code

rough laurel
#

mathematical cubing feels incomprehensible to me but i'm sure it could be entertaining for someone with knowledge of algorithms

tulip crypt
#

idk I never got below like 35 seconds cuz I'm kinda stupid

rough laurel
#

i never got below 35 minutes

tulip crypt
#

just solve cubes for like an hour a day for a couple of weeks and you'll get to a minute probably

rough laurel
#

i'm the ocean to your droplet of stupid

tulip crypt
#

then you just spam more training + some cooler algorithms

#

and idk

rough laurel
#

i meant algorithms as like
the college subject

tulip crypt
#

like actual big brain coding algorithms

rough laurel
#

ayup

#

"the rubiks cube is an ordered list" and so on

tulip crypt
#

gives me literal brain damage

rough laurel
#

i like brain damage

#

i'm going to college to be a psychologist

tulip crypt
#

We'd make a good team, I get brain damage from coding and you heal it?

rough laurel
#

eh, less healing and more like put you in a maze to see what happens
but i agree