Bitcoin Forum
June 28, 2024, 01:48:24 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: CGMiner & OSX  (Read 1978 times)
numismatics (OP)
Member
**
Offline Offline

Activity: 96
Merit: 10



View Profile
March 28, 2013, 03:06:04 AM
Last edit: April 16, 2013, 03:27:09 AM by numismatics
 #1

I would have posted this to the official cgminer thread, but I'm still a newb...

I can get vanilla cgminer to compile and mine on OSX with openCL support, but building with the ADL_SDK includes via « ./autogen.sh && make » results in the following compile error:

Code:
<snip>
  AR       libccan.a
  CC       cgminer-cgminer.o
In file included from miner.h:106,
                 from cgminer.c:44:
ADL_SDK/adl_sdk.h:26: error: expected ‘)’ before ‘*’ token
make[2]: *** [cgminer-cgminer.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Likewise, « ./autogen.sh && CFLAGS="-O2 -Wall -march=native" ./configure » fails with

Code:
<snip>
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/user/numismatics/cgminer':
configure: error: C compiler cannot create executables

I'd be happy to start maintaining an OSX fork if I can get some help sorting this out...

lumberjack
Newbie
*
Offline Offline

Activity: 42
Merit: 0



View Profile
April 04, 2013, 06:22:32 AM
 #2

for your second message, drop -march=native from your CFLAGS. Should compile then.

for the first, I've also had to pull the ADL_SDK to get it to compile. Not sure why just yet.
charliemaggot
Member
**
Offline Offline

Activity: 79
Merit: 10



View Profile
April 04, 2013, 06:33:05 AM
 #3

This was the page I used to help compile it.

http://dblamb.com/meh/compiling-cgminer-on-mac-os-x/

My problem was some missing ports, especially readlink - read the post comments.



lbr
Sr. Member
****
Offline Offline

Activity: 423
Merit: 254


View Profile
April 04, 2013, 07:04:29 AM
 #4

Successfully compiled latest cgminer on
Mac Mini, Mac OS X 10.6.x, xCode installed(whether xCode installed or not affects brew installation paths)

Install "home brew"
Install missing libraries via "brew install"
F.e. - "brew install autoconf automake libtool"
I've also installed latest gcc

Had to tamper with autotools-
"
eval `brew --config | grep HOMEBREW_PREFIX | sed 's/: /=/'`
sudo bash -c 'echo '$HOMEBREW_PREFIX/share/aclocal5' >> `aclocal --print-ac-dir`/dirlist'
"
Essentially you want to make sure that in "dirlist" every m4 paths are written.


I've used following flags-
export CC="gcc-4.8"
export CFLAGS="-O3 -pipe -march=core2 -mcx16 -msahf -mno-movbe -mno-aes -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c -mno-fsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=3072 -mtune=core2 -fPIC -mmacosx-version-min=10.6.8"
export CXXFLAGS="${CFLAGS}"
export ARCHFLAGS="-arch i386-apple-darwin11.2.0 -arch x86_64-apple-darwin11.2.0"

Flags were detected automatically by gcc -
$ echo "" | gcc -march=native -v -E - 2>&1 | grep cc1
http://en.gentoo-wiki.com/wiki/Hardware_CFLAGS though this page is offline atm

./autogen.sh --enable-cpumining --enable-scrypt --build=x86_64-apple-darwin11.2.0
Without specifying --build it all was going very wrong.

Also I had to force yasm to produce macho64 and not elf
/usr/local/bin/yasm -f macho64 x86_64/sha256_xmm_amd64.asm
Or you can manually change "Makefile"
change
    $(YASM) -f elf64 $<
to
    $(YASM) -f macho64 $<

BTC: 18ozhbkfHneX8tnPgHJuTizyBmspM5Vgpa  LTC: LgVc7KdedPGZyDXHXEH9G7z6AoTmTvDdWb
cgminer 2.11.13 x64 portable for Mac OS X 10.6.8
6+ GPUs driver mod for Windows
lbr
Sr. Member
****
Offline Offline

Activity: 423
Merit: 254


View Profile
April 04, 2013, 07:15:52 AM
 #5

checking for gcc... gcc
checking whether the C compiler works... no
^^
This makes me think that you are using llvm-gcc or some old gcc.

BTC: 18ozhbkfHneX8tnPgHJuTizyBmspM5Vgpa  LTC: LgVc7KdedPGZyDXHXEH9G7z6AoTmTvDdWb
cgminer 2.11.13 x64 portable for Mac OS X 10.6.8
6+ GPUs driver mod for Windows
toffoo
Sr. Member
****
Offline Offline

Activity: 408
Merit: 261



View Profile
April 04, 2013, 09:04:26 AM
 #6


See here:

https://bitcointalk.org/index.php?topic=166877.0

crazyquark
Newbie
*
Offline Offline

Activity: 13
Merit: 0



View Profile
April 04, 2013, 12:31:10 PM
 #7

I've actually compiled this yesterday hassle free.

I am a developer but it wasn't a challenge, no matter your level.

What you need:
1 .hombrew: http://brew.sh (ruby should be installed already)

Once brew is installed do a 'brew update' in the console
Now, I am not sure what packages are needed because I have lots of them already installed but the configure script will let you know what you are missing Smiley.

2. Install git if needed (on Mountain Lion I think it comes preinstalled, check if you already have it)

3. Do a 'git clone https://github.com/ckolivas/cgminer.git'

This creates a cgminer folder in your current folder (console)

Now, automake scripts use pkg-config which doesn't automatically pick up brew packages so you need to do this export:
export PKG_CONFIG_PATH=/usr/local/Library/ENV/pkgconfig/10.8/
(for OS X 10.Cool

I put mine in /etc/bashrc so it's always there.

4. After doing the export in the previous section run "./autogen.sh" from cgminer folder
If you're missing stuff install them via 'brew install'

5. Do a './configure CFLAGS="-O3"'

6. Do a sudo make install to build it and copy it in your bin folder

Umm... that's it.

Unlike other ppl I am not gonna beg for a penny for this very basic info Smiley
Would post anywhere else but I a "newbie"
crazyquark
Newbie
*
Offline Offline

Activity: 13
Merit: 0



View Profile
April 04, 2013, 12:34:59 PM
 #8

P.S. You need to have the latest Xcode installed.
Also, from Xcode go to Preferences/Downloads and install the command line tools in order to have gcc/make outside of Xcode.

You could run using "xcrun..." but that's a whole other story.
crazyquark
Newbie
*
Offline Offline

Activity: 13
Merit: 0



View Profile
April 04, 2013, 12:41:55 PM
 #9

I would have posted this to the official cgminer thread, but I'm still a newb...

I can get vanilla cgminer to compile and mine on OSX with openCL support, but building with the ADL_SDK includes via « ./autogen.sh && make » results in the following compile error:

Code:
<snip>
  AR       libccan.a
  CC       cgminer-cgminer.o
In file included from miner.h:106,
                 from cgminer.c:44:
ADL_SDK/adl_sdk.h:26: error: expected ‘)’ before ‘*’ token
make[2]: *** [cgminer-cgminer.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Likewise, « ./autogen.sh && CFLAGS="-O2 -Wall -march=native" ./configure » fails with

Code:
<snip>
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/kentdavis/numismatics/cgminer':
configure: error: C compiler cannot create executables

I'd be happy to start maintaining an OSX fork if I can get some help sorting this out...

I am guessing -mnative does not make sense to your compiler so the compiler check failed. Did you want -m32 or -m64?
numismatics (OP)
Member
**
Offline Offline

Activity: 96
Merit: 10



View Profile
April 04, 2013, 04:41:07 PM
 #10

compiling without ADL works just fine, my question was ADL specific Smiley

crazyquark
Newbie
*
Offline Offline

Activity: 13
Merit: 0



View Profile
April 04, 2013, 06:00:21 PM
 #11

Try the following:
Update your Xcode to the latest and install command line tools/update.
If that doesn't work, you might try an alternative toolchain via brew.
crazyquark
Newbie
*
Offline Offline

Activity: 13
Merit: 0



View Profile
April 10, 2013, 12:05:40 PM
 #12

OK, here's the issue with ADL_SDK and cgminer on os x:
- the adl_sdk.h uses __stdcall which isn't supported with clang on os x, removing that fixes compilation

HOWEVER, once it compiles you will get link errors because the AMD libs/driver for OS X simply don't have the required ADL layer compiled in... so no use trying.

Also "-mnative" is a bogus flag, don't use it.
Coinkle
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
April 12, 2013, 11:57:55 PM
 #13

Any news on this... I was working on this myself. But since my knowledge base is fairly limited to rooting my phone, most of this seems foreign. I appreciate everyone taking their time to share their findings and info.
numismatics (OP)
Member
**
Offline Offline

Activity: 96
Merit: 10



View Profile
April 16, 2013, 04:30:03 AM
 #14

OK, here's the issue with ADL_SDK and cgminer on os x:
- the adl_sdk.h uses __stdcall which isn't supported with clang on os x, removing that fixes compilation

Great catch! I installed a different buildchain (gcc47), and deleting the reference to « __stdcall » but compiling still didn't work:

Code:
In file included from miner.h:106:0,
                 from cgminer.c:44:
ADL_SDK/adl_sdk.h:22:27: error: expected ')' before '*' token
make[2]: *** [cgminer-cgminer.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

HOWEVER, once it compiles you will get link errors because the AMD libs/driver for OS X simply don't have the required ADL layer compiled in... so no use trying.

Is there anyway to install the necessary layers?

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!