Trying to compile with PureBasic Ver. 5.21 32bit

Mac OSX specific forum
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Trying to compile with PureBasic Ver. 5.21 32bit

Post by dman10001 »

I'm having a Linker problem, I was using windows to compile the same code using bass libraries, but on mac the file is different its libbass.dylib and
I do not know how to use it or if I need it.

do any one have an idea what is going on? please help.

here are the linker errors below.

ld: warning: ignoring file /Volumes/UNTITLED/PureBasic Projects/DJ Mixing/bass.lib, file was built for archive which is not the architecture being linked (i386): /Volumes/UNTITLED/PureBasic Projects/DJ Mixing/bass.lib
Undefined symbols for architecture i386:
"_BASS_ChannelPlay", referenced from:
PStub_BASS_ChannelPlay in purebasic.o
"_BASS_Init", referenced from:
PStub_BASS_Init in purebasic.o
"_BASS_StreamCreateFile", referenced from:
PStub_BASS_StreamCreateFile in purebasic.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


OK, I have read the document and found out that, the file libbass.dylib have to be put in the same directory with the executable.

how obvious, but still I'm unable to compile. What is missing?
Poshu
Enthusiast
Enthusiast
Posts: 459
Joined: Tue Jan 25, 2005 7:01 pm
Location: Canada

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by Poshu »

From what I understand it's either that the functions are named differently in the dylib or that the dylib is x64 only.
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by dman10001 »

from what you have said, I have also thought it might be 64bit.
as for the names of the functions, I'm not sure.

I will try the 64bits.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by Danilo »

Of course you need to use:

Code: Select all

;- BASS Functions
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
    
    CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
        Import "bass.lib"
    CompilerElse
        Import "bass_x64.lib"
    CompilerEndIf
    
CompilerElseIf #PB_Compiler_OS = #PB_OS_MacOS
    
    ImportC "libbass.dylib"
        
CompilerElseIf #PB_Compiler_OS = #PB_OS_Linux
    
    CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
        ImportC "libbass.so"
    CompilerElse
        ImportC "libbass_x64.so"
    CompilerEndIf
    
CompilerEndIf
- bass.zip

Console test is included. If you create an .app on Mac OS X, read topic "Import : EndImport - path?" for changing
.dylib import directory/path by using install_name_tool, and verify it by using otool.
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by dman10001 »

I thank you, I can see what the logic.
I will try it and let you know.

thanks for your help.
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by dman10001 »

I'm still getting a link error, below is the error.

PureBasic.0 cannot be opened because of a problem.

Check with the developer to make sure PureBasic.0 works with this version of OS X. You may need to reinstall the application. Be sure to install any available updates for the application and OS X.

Click Report to see more detailed information and send a report to Apple

I'm trying the 32bit version using libbass.dylib

I used the correct paths and checked everything.

I know, it could be right in my face and don't see it.
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by Danilo »

dman10001 wrote:I'm still getting a link error, below is the error.
What's your version of Mac OS X?

Did you test bass.zip? Tested here on Mac OS X 10.9.1 Mavericks with PB 5.21 LTS x86 + x64.
I just open basstest.pb and hit F5 to start it. Works out-of-the-box here, x86 and x64.
Did you install latest Xcode 5.0.2 and its command line tools?
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by dman10001 »

yes I ran the program and it worked, but when I try to run the other file it gives me errors.

I have Mavericks OS and the latest Xcode.

I do not understand the tools you referring to.

maybe its the libraries I'm using .
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by dman10001 »

Hi, I notice when I put the dylib extensions in the compiler directory it compiles and runs, Is there reason why it works.

maybe I need to put them in the right directory and/or change the settings.

Anyone familiar with this problem ?
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by Danilo »

@dman10001:
Did you enable compiler option "[X] Create temporary executable in the source directory"
for your console program?

If you create a MacOSX .app, there is a link in my first posting that shows how to embed
the dylib into your .app. Just run:

Code: Select all

otool -L ./YourAppName.App/Contents/MacOS/YourAppName
...to see where the OS expects the .dylib
dman10001
User
User
Posts: 55
Joined: Mon Feb 25, 2013 3:04 pm

Re: Trying to compile with PureBasic Ver. 5.21 32bit

Post by dman10001 »

Hi, I have found out where to put the libbass.dylib and libbass_fx.dylib files.

I do not know where I can get the bass_fx.pbi file that imports the libbass_fx.dylib libraries.

can I create it or find it on the forum.


Please help.
Post Reply