Skip to content
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

Mac OS X 10.9.1 Compilation failure #1

Closed
ghost opened this issue Jan 9, 2014 · 54 comments
Closed

Mac OS X 10.9.1 Compilation failure #1

ghost opened this issue Jan 9, 2014 · 54 comments

Comments

@ghost
Copy link

ghost commented Jan 9, 2014

After changing some && to & in src/wildmidi_lib.c and doing "./bootstrap ; ./configure --disable-optimize ; make", I got this error related to WM_SampleRate being used in both src/gus_pat.c and src/wildmidi_lib.c:

Making all in src
/bin/sh ../libtool --tag=CC --mode=link gcc -std=c99 -U__STRICT_ANSI__ -Wall -Wextra -pedantic -Werror -version-info 2:0:1 -shared -lm -lc -no-undefined -export-symbols-regex '^WildMidi.' -lm -lc -o libWildMidi.la -rpath /usr/local/lib libWildMidi_la-wm_error.lo libWildMidi_la-file_io.lo libWildMidi_la-reverb.lo libWildMidi_la-lock.lo libWildMidi_la-gus_pat.lo libWildMidi_la-wildmidi_lib.lo -lm -lc
libtool: link: rm -fr .libs/libWildMidi.exp
libtool: link: /usr/bin/nm .libs/libWildMidi_la-wm_error.o .libs/libWildMidi_la-file_io.o .libs/libWildMidi_la-reverb.o .libs/libWildMidi_la-lock.o .libs/libWildMidi_la-gus_pat.o .libs/libWildMidi_la-wildmidi_lib.o | sed -n -e 's/^.
[ ][ ]__([_A-Za-z][A-Za-z0-9])$/\1 \2 \2/p' | sed '/ _gnu_lto/d' | /usr/bin/sed 's/. //' | sort | uniq > .libs/libWildMidi.exp
libtool: link: /usr/bin/grep -E -e "^WildMidi.*" ".libs/libWildMidi.exp" > ".libs/libWildMidi.expT"
libtool: link: mv -f ".libs/libWildMidi.expT" ".libs/libWildMidi.exp"
libtool: link: sed 's,^,
,' < .libs/libWildMidi.exp > .libs/libWildMidi-symbols.expsym
libtool: link: gcc -dynamiclib -o .libs/libWildMidi.1.dylib .libs/libWildMidi_la-wm_error.o .libs/libWildMidi_la-file_io.o .libs/libWildMidi_la-reverb.o .libs/libWildMidi_la-lock.o .libs/libWildMidi_la-gus_pat.o .libs/libWildMidi_la-wildmidi_lib.o -lm -lc -install_name /usr/local/lib/libWildMidi.1.dylib -compatibility_version 3 -current_version 3.0 -Wl,-single_module -Wl,-exported_symbols_list,.libs/libWildMidi-symbols.expsym
duplicate symbol _WM_SampleRate in:
.libs/libWildMidi_la-gus_pat.o
.libs/libWildMidi_la-wildmidi_lib.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [libWildMidi.la] Error 1
make: *** [all-recursive] Error 1

@psi29a
Copy link
Member

psi29a commented Jan 10, 2014

Now I understand which Maverick you were referring to. I have practically no OSX experience and keep mostly to Linux and for the sake cross-platform support, Windows as well.

I'm in the middle of moving the project away from autotools to cmake. Once I'm sure that things are sane and can compile on both debian/ubuntu/windows(32) I'll tag a release, likely 0.3.0.0 and then we can have a deeper look at the problem with WMSampleRate.

In the mean time, an you post what GCC version you are running?

Also, would you mind helping me in releasing OSX binaries for this and possibly getting it into mainstream packages for OSX?

@psi29a
Copy link
Member

psi29a commented Jan 10, 2014

You can see that it is building now: https://travis-ci.org/psi29a/wildmidi

Please try the latest from master to see if builds for you. If you are not familiar with cmake, just make a build directory next to wildmidi dir, cd into build, then cmake ../wildmidi and it should auto generate everything for you. "make -j4" and you are on your way. Bug reports welcome.

@ghost
Copy link
Author

ghost commented Jan 10, 2014

I'll be happy to help with Mac. I will have a look at cmake also. Ozkan Sezer published a patch regarding WMSampleRate here:
https://sourceforge.net/p/wildmidi/bugs/26/

@psi29a
Copy link
Member

psi29a commented Jan 14, 2014

Just a heads up, many of your fixes in your branch I've push into my own. Thanks! :)

https://travis-ci.org/psi29a/wildmidi
^-- Travis CI is now building the project with GCC and CLang and are now without warnings!

@ghost
Copy link
Author

ghost commented Jan 14, 2014

I have managed have it all compile now with a warning (C99 nanosleep) with cmake/make and a strange (missing libwildmidi.a) additional error linking with cmake/Xcode. Now I just have to make github receive the patch...

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Can you give me the complete output of a fresh cmake and a make so I can see what warnings you get?

You can stick the output in postbin or put it here as an attachment (I think?).

@ghost
Copy link
Author

ghost commented Jan 15, 2014

Only one warning, included below. Postbin? Seems I can only attach images... never mind! Good work! :)

src/wildmidi.c:1174:9: warning: implicit declaration of function 'nanosleep' is invalid in C99 [-Wimplicit-function-declaration]
while (nanosleep(&req, &req) == -1)
^
1 warning generated.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

I noticed yesterday that cmake; make; make install didn't copy the library file to /usr/local/lib just the .h file to /usr/local/include. So I had to do that part by hand before trying to compile thirdeye.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

Xcode (cmake -G Xcode) on the other hand also gives a link error:
Apple Mach-O Linker (ld) Error
No such file or directory: libwildmidi.a

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

I meant http://pastebin.com/

make install hasn't been setup yet... I'm planning on using cpack to help with building packages on Windows and I have a notion that I can also use it for making OSX .app packages.

If you would like to work on getting make install working, by all means. :)

Yes, in the cmake file I check for windows, then else for everything else... you'll need to add an (APPLE) section to make sure the linker knows which lib to use, either dynamic or static for your purposes.

I'll be adding later options to specify to build everything or only certain parts.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

Well... All this compiling (has been 10 years since I did something like this) has made me wondering if it's needed. Is wildmidi just used as a regular MIDI player in ThirdEYE? I wonder if it could then just be exchanged for Core MIDI on Mac OS X. Like if the work tweaking to get it to compile on Mac is bigger than writing some real code to call Core MIDI instead on Mac.

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Wildmidi just takes your midi, decodes it, plays a soundfont/patch and outputs to your audio subsystem.

Many projects already depend on it, most heavily is gstreamer so that you can use a browser to play back embedded midi. Another would be Rhythmbox, which also uses it to play midi.

If your media player already can decode and play back midi, then you don't need this lib. If your player can't, then it needs this lib or one similar.

Thirdeye needs to be cross-platform, so it can't rely on a system's implementation which would be non-portable.

I thought wildmidi worked already on OSX with auto tools? I just choose cmake because it is easier to deal with, but yeah... there is work to make sure every system is satisfied. :)

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

BTW... wildmidi is a player, just like any other out there. wildmidi_lib (libwildmidi.so or .a) is the lib. Thirdeye links against the lib and uses it to stream midi in and a buffer out. I take the buffer into thirdeye's internal mixer with sound effects and other bits and push to OpenAL to handle all the noise making.

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

BTW2: The problem you had with nanosleep, I think it is because I didn't add the time.h at the top... so no forward deceleration. GCC and Clang just worked around it...

Please test my master branch again.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

make: Clean... no warnings whatsoever! :)
Xcode: same linker error with missing libwildmidi.a (it's actually located in Debug/ like libwildmidi.dylib also)

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

  1. Great!
  2. Does it default to Debug/ for you? Is there a way to make it build in Release? Does libwildmidi.a even exist, if not, are the only things built libwildmidi.dynlib?

@ghost
Copy link
Author

ghost commented Jan 15, 2014

Both libwildmidi.a and .dylib are to be found in Debug/ after building. "Other linker flags" (in Xcode) for the wildmidi binary want to link against it as being found in ".".

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Current cmake code does this:
IF(WIN32)
SET(GETOPT getopt.c getopt_long.c)
SET(WINLIB "${CMAKE_BINARY_DIR}\Release\wildmidi_static.lib")
ELSE(WIN32)
SET(UNIXLIB "${CMAKE_BINARY_DIR}/libwildmidi.a")
ENDIF(WIN32)

As you can see... if it isn't windows... then we just try it in /libwildmidi.a

So... the point is, everything works fine with Clang/GCC as your compiler. If you try it with XCode, you get the linking error right?

I'll try to come up with something for you around lunch.

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

can you run your cmake command again but this time with this: -DCMAKE_BUILD_TYPE=Release

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

well... I tried with Release for both gcc and clang. gcc compiles with warnings, and clang fails to compile. I'll look into those. Debug, for whatever reason, seems to compile just fine for both.

This will take some time.

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Pushed some code fixes, there is still one more warning in the Release build from gcc but clang should be good for both. I also added some apple specific code to link to the right directory. I can't test this directly, but please try it on your end!

@ghost
Copy link
Author

ghost commented Jan 15, 2014

cmake -DCMAKE_BUILD_TYPE=Release and then make gives:
make[2]: *** No rule to make target Release/libwildmidi.a', needed bywildmidi'. Stop.
make[1]: *** [src/CMakeFiles/wildmidi.dir/all] Error 2
make: *** [all] Error 2

@ghost
Copy link
Author

ghost commented Jan 15, 2014

cmake -DCMAKE_BUILD_TYPE=Debug and then make gives:
make[2]: *** No rule to make target Debug/libwildmidi.a', needed bywildmidi'. Stop.
make[1]: *** [src/CMakeFiles/wildmidi.dir/all] Error 2
make: *** [all] Error 2

@ghost
Copy link
Author

ghost commented Jan 15, 2014

no -DCMAKE_BUILD_TYPE gives the same as Debug above.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

Xcode build now gives a lot of "Unknown symbol for architecture x86_64" pointing to libraries perhaps only being built 32-bit?

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Interesting... it doesn't matter what bit-ness. Win32 or Linux x86_64... but I've never seen the last error.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

cmake -G Xcode -DCMAKE_BUILD_TYPE=Release almost works, only complaining not finding "Release/libwildmidi.a" not complaining about x86_64 symbols at all.

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Can you give the full pathname of where your libwildmidi.a file is?

Can you also put this in cmake, just above TARGET_LINK_LIBRARIES(wildmidi
MESSAGE(STATUS "TELL psi29a: ${WILDMIDILIB}")

Clean your build directory then rerun: cmake -G Xcode -DCMAKE_BUILD_TYPE=Release

What does it print out?

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Did another push, might have fixed problem... please test.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

cmake -G Xcode and building now works perfect! :)

cmake -G Xcode with Release and bulding can't find "Release/libwildmidi.a"

cmake -G Xcode with Debug and bulding now works perfect! :)

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

When you do the Release build, can you give me the output of what I asked you above? Can you also give me the full path to the libwildmidi.a file... where ever it exists. I'm trying to track down if there is a difference. They should be the same.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

Release with make or Xcode? Have to eat now with enough time before choir practice...

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

cmake -G Xcode with Release and bulding can't find "Release/libwildmidi.a" please, but the other output would be nice as well.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

I now get 2 errors:

Check dependencies

error: (null)

Ld /Users/rrrrrrr/src/build/Debug/libwildmidi.dylib normal x86_64
cd /Users/rrrrrrr/src/GIT/wildmidi
setenv MACOSX_DEPLOYMENT_TARGET 10.9
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/rrrrrrr/src/build/Debug -F/Users/rrrrrrr/src/build/Debug -filelist /Users/rrrrrrr/src/build/src/wildmidi.build/Debug/wildmidi_dynamic.build/Objects-normal/x86_64/wildmidi.LinkFileList -install_name /Users/rrrrrrr/src/build/Debug/libwildmidi.dylib -mmacosx-version-min=10.9 -dynamiclib -Wl,-headerpad_max_install_names -framework CoreAudio -framework CoreFoundation -single_module -Xlinker -dependency_info -Xlinker /Users/rrrrrrr/src/build/src/wildmidi.build/Debug/wildmidi_dynamic.build/Objects-normal/x86_64/wildmidi_dependency_info.dat -o /Users/rrrrrrr/src/build/Debug/libwildmidi.dylib

ld: -filelist file '/Users/rrrrrrr/src/build/src/wildmidi.build/Debug/wildmidi_dynamic.build/Objects-normal/x86_64/wildmidi.LinkFileList' could not be opened, errno=2 (No such file or directory)

clang: error: linker command failed with exit code 1 (use -v to see invocation)

$ find . | grep lib
./Debug/libwildmidi.a
./src/wildmidi.build/Debug/wildmidi_dynamic.build/Objects-normal/x86_64/wildmidi_lib.d
./src/wildmidi.build/Debug/wildmidi_dynamic.build/Objects-normal/x86_64/wildmidi_lib.dia
./src/wildmidi.build/Debug/wildmidi_dynamic.build/Objects-normal/x86_64/wildmidi_lib.o
./src/wildmidi.build/Debug/wildmidi_static.build/Objects-normal/x86_64/wildmidi_lib.d
./src/wildmidi.build/Debug/wildmidi_static.build/Objects-normal/x86_64/wildmidi_lib.dia
./src/wildmidi.build/Debug/wildmidi_static.build/Objects-normal/x86_64/wildmidi_lib.o

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

I'm still not seeing the output from the thing I posted to you.

I just need the full path to your libwildmidi.a file used for "Release" and can you also put this in cmake, just above TARGET_LINK_LIBRARIES(wildmidi
MESSAGE(STATUS "TELL psi29a: ${WILDMIDILIB}")

Clean your build directory then rerun: cmake -G Xcode -DCMAKE_BUILD_TYPE=Release

Tell me what cmake outputs

@ghost
Copy link
Author

ghost commented Jan 15, 2014

-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler using: Xcode
-- Check for working C compiler using: Xcode -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Xcode
-- Check for working CXX compiler using: Xcode -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Build Type: Release
-- /Users/rrrrrrr/src/build
-- TELL psi29a:
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/rrrrrrr/src/build

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

It's blank.. telling me it isn't being set.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

If I put it below it gives:
CMake Error at src/CMakeLists.txt:24 (ADD_LIBRARY):
Target "wildmidi_static" links to item "TELL psi29a: " which has leading or
trailing whitespace. This is now an error according to policy CMP0004.

CMake Error at src/CMakeLists.txt:24 (ADD_LIBRARY):
Target "wildmidi_static" links to item "TELL psi29a: " which has leading or
trailing whitespace. This is now an error according to policy CMP0004.

CMake Error at src/CMakeLists.txt:24 (ADD_LIBRARY):
Target "wildmidi_static" links to item "TELL psi29a: " which has leading or
trailing whitespace. This is now an error according to policy CMP0004.

CMake Error at src/CMakeLists.txt:24 (ADD_LIBRARY):
Target "wildmidi_static" links to item "TELL psi29a: " which has leading or
trailing whitespace. This is now an error according to policy CMP0004.

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Yeah... wrong place.

MESSAGE(STATUS "TELL psi29a: ${WILDMIDILIB}")

needs to go after all the if cmake release/debug stuff, just before target_link_libraries(wildmidi line... at line 94.

Put it there between add_dependencies and target_link_libraries

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Just so you know, I'm trying to track down where your Release static lib is located on your filesystem, and where the cmake system is looking.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

It isn't being set then...

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

And if you set this:
SET(WILDMIDILIB "${CMAKE_BINARY_DIR}/Release/libwildmidi.a")
just before
MESSAGE(STATUS "TELL psi29a: ${WILDMIDILIB}")
which should be at line 93 ?

@ghost
Copy link
Author

ghost commented Jan 15, 2014

-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler using: Xcode
-- Check for working C compiler using: Xcode -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Xcode
-- Check for working CXX compiler using: Xcode -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Build Type: Release
-- /Users/rrrrrrr/src/build
-- TELL psi29a: /Users/rrrrrrr/src/build/Release/libwildmidi.a
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/rrrrrrr/src/build

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

and now building?

@ghost
Copy link
Author

ghost commented Jan 15, 2014

It can't find Release/libwildmidi.a

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

And if you try ls -al /Users/rrrrrrr/src/build/Release/libwildmidi.a ?

@ghost
Copy link
Author

ghost commented Jan 15, 2014

$ find . | grep lib
./Debug/libwildmidi.a
./Debug/libwildmidi.dylib
./src/wildmidi.build/Debug/wildmidi_dynamic.build/Objects-normal/x86_64/wildmidi_lib.d
./src/wildmidi.build/Debug/wildmidi_dynamic.build/Objects-normal/x86_64/wildmidi_lib.dia
./src/wildmidi.build/Debug/wildmidi_dynamic.build/Objects-normal/x86_64/wildmidi_lib.o
./src/wildmidi.build/Debug/wildmidi_static.build/Objects-normal/x86_64/wildmidi_lib.d
./src/wildmidi.build/Debug/wildmidi_static.build/Objects-normal/x86_64/wildmidi_lib.dia
./src/wildmidi.build/Debug/wildmidi_static.build/Objects-normal/x86_64/wildmidi_lib.o

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

Yes, you already posted that... so /Users/rrrrrrr/src/build/Release/libwildmidi.a doesn't exist for you.

This means that even after telling it to build "Release" build... xcode isn't making "Release" libs, only Debug.

Possible problem on cmake on mac? I don't know, can you bundle up your build directory and post it somewhere so I can have a look inside please? Did you make sure to remove everything in your build directory before you ran the cmake command again? I had this issue on windows where it didn't recognize the change and had to purge every file and re-run cmake. This was with the cmake-gui application.

@psi29a
Copy link
Member

psi29a commented Jan 15, 2014

At least it works with Debug builds.

No worries, we'll figure the cmake/release builds problem out eventually. :)

I plan on setting up a hackintosh in the future. I'm committed to getting this working on all three target platforms.

@ghost
Copy link
Author

ghost commented Jan 15, 2014

Sent build to what I think is your email...

@psi29a
Copy link
Member

psi29a commented Jan 17, 2014

I think I might have an idea of what is going on: http://www.cmake.org/pipermail/cmake/2009-March/027953.html

With Xcode, you can't tell it specifically with cmake what to build directly.... well you can, but it is hack-ish because it was never meant to do that. Now I understand why VS2010 does the same thing as Xcode in defaulting to debug.

After running cmake, you have to specifically tell Xcode what type to build. If nothing is specified, it defaults to Debug anyway.

@psi29a
Copy link
Member

psi29a commented Jan 17, 2014

Re-wrote some stuff in cmake, try it out please. If you set the build type with cmake, then it should now force it on VCS and Xcode.

@ghost
Copy link
Author

ghost commented Jan 17, 2014

Works perfectly with cmake/make, cmake/Xcode without option, Debug and Release! Great work!
👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant