LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
7.98k stars 995 forks source link

Fedora x86_64 - winebuild: ld failed with status 1 #3129

Closed djnotes closed 7 years ago

djnotes commented 7 years ago

A similar issue has already been discussed on https://github.com/LMMS/lmms/issues/15, but those instructions are mostly for Ubuntu and I could not solve this on Fedora x86_64. Also, if anyone can tell me where I should use the workaround given by user @tobydox on the same page linked above, I would appreciate it. Currently, the complete output for my make is as follows:

/home/mhd/src/lmms/build
[mhd@localhost build]$ make
[  0%] Built target manpage
[  0%] Built target bin2res
[  0%] Automatic moc for target lmmsobjs
[  0%] Built target lmmsobjs_automoc
[ 17%] Built target lmmsobjs
[ 17%] Automatic moc for target lmms
[ 17%] Built target lmms_automoc
[ 17%] Built target lmms
[ 17%] Built target audiofileprocessor
[ 18%] Built target kicker
[ 18%] Built target tripleoscillator
[ 19%] Built target amplifier
[ 20%] Built target bassbooster
[ 20%] Built target bitinvader
[ 21%] Built target bitcrush
[ 21%] Built target carlabase
[ 22%] Built target carlapatchbay
[ 22%] Built target carlarack
[ 23%] Built target crossovereq
[ 24%] Built target delay
[ 25%] Built target dualfilter
[ 26%] Built target dynamicsprocessor
[ 28%] Built target eq
[ 29%] Built target flanger
[ 29%] Built target hydrogenimport
[ 30%] Built target ladspabrowser
[ 31%] Built target ladspaeffect
[ 33%] Built target caps
[ 34%] Built target tap_eq
[ 34%] Built target tap_dynamics_m
[ 35%] Built target tap_vibrato
[ 35%] Built target tap_autopan
[ 35%] Built target tap_rotspeak
[ 35%] Built target tap_dynamics_st
[ 35%] Built target tap_tubewarmth
[ 35%] Built target tap_chorusflanger
[ 36%] Built target tap_deesser
[ 36%] Built target tap_tremolo
[ 36%] Built target tap_limiter
[ 36%] Built target tap_eqbw
[ 36%] Built target tap_echo
[ 37%] Built target tap_reverb
[ 37%] Built target tap_doubler
[ 37%] Built target tap_pinknoise
[ 37%] Built target tap_reflector
[ 37%] Built target tap_pitch
[ 37%] Built target tap_sigmoid
[ 37%] Built target pitchscale
[ 37%] Built target db
[ 38%] Built target rms
[ 38%] Built target gverb
[ 39%] Built target gsm
[ 39%] Built target iir
[ 40%] Built target blo
[ 40%] Built target zm1_1428
[ 40%] Built target imp_1199
[ 40%] Built target svf_1214
[ 41%] Built target giant_flange_1437
[ 41%] Built target bode_shifter_cv_1432
[ 41%] Built target sc4_1882
[ 41%] Built target diode_1185
[ 41%] Built target flanger_1191
[ 42%] Built target transient_1206
[ 42%] Built target chebstortion_1430
[ 42%] Built target plate_1423
[ 42%] Built target dyson_compress_1403
[ 42%] Built target matrix_spatialiser_1422
[ 42%] Built target dj_flanger_1438
[ 42%] Built target retro_flange_1208
[ 43%] Built target decay_1886
[ 43%] Built target gong_beater_1439
[ 43%] Built target divider_1186
[ 43%] Built target amp_1181
[ 43%] Built target multivoice_chorus_1201
[ 43%] Built target highpass_iir_1890
[ 44%] Built target pitch_scale_1194
[ 45%] Built target split_1406
[ 46%] Built target fast_lookahead_limiter_1913
[ 46%] Built target bode_shifter_1431
[ 46%] Built target comb_1190
[ 47%] Built target rate_shifter_1417
[ 47%] Built target bandpass_iir_1892
[ 47%] Built target const_1909
[ 48%] Built target am_pitchshift_1433
[ 49%] Built target bandpass_a_iir_1893
[ 49%] Built target hermes_filter_1200
[ 49%] Built target notch_iir_1894
[ 49%] Built target fm_osc_1415
[ 49%] Built target butterworth_1902
[ 49%] Built target gverb_1216
[ 49%] Built target comb_1887
[ 49%] Built target fad_delay_1192
[ 49%] Built target decimator_1202
[ 50%] Built target impulse_1885
[ 50%] Built target sc2_1426
[ 51%] Built target comb_splitter_1411
[ 51%] Built target foldover_1213
[ 52%] Built target dj_eq_1901
[ 53%] Built target gsm_1215
[ 53%] Built target analogue_osc_1416
[ 53%] Built target dc_remove_1207
[ 53%] Built target xfade_1915
[ 53%] Built target alias_1407
[ 54%] Built target hilbert_1440
[ 54%] Built target crossover_dist_1404
[ 54%] Built target declip_1195
[ 55%] Built target delay_1898
[ 55%] Built target delayorama_1402
[ 55%] Built target inv_1429
[ 55%] Built target karaoke_1409
[ 55%] Built target tape_delay_1211
[ 55%] Built target pitch_scale_1193
[ 55%] Built target ladspa-util
[ 55%] Built target ringmod_1188
[ 55%] Built target latency_1914
[ 55%] Built target lcr_delay_1436
[ 55%] Built target se4_1883
[ 56%] Built target ls_filter_1908
[ 57%] Built target matrix_ms_st_1421
[ 57%] Built target gate_1410
[ 57%] Built target gong_1424
[ 57%] Built target matrix_st_ms_1420
[ 57%] Built target mbeq_1197
[ 57%] Built target sinus_wavewrapper_1198
[ 57%] Built target freq_tracker_1418
[ 58%] Built target mod_delay_1419
[ 58%] Built target allpass_1895
[ 58%] Built target surround_encoder_1401
[ 58%] Built target vynil_1905
[ 58%] Built target phasers_1217
[ 58%] Built target pointer_cast_1910
[ 58%] Built target triple_para_1204
[ 58%] Built target revdelay_1605
[ 58%] Built target satan_maximiser_1408
[ 58%] Built target sc1_1425
[ 59%] Built target sc3_1427
[ 59%] Built target harmonic_gen_1220
[ 59%] Built target shaper_1187
[ 60%] Built target vocoder_1337
[ 60%] Built target sifter_1210
[ 61%] Built target foverdrive_1196
[ 62%] Built target sin_cos_1881
[ 62%] Built target lowpass_iir_1891
[ 62%] Built target single_para_1203
[ 62%] Built target sc4m_1916
[ 62%] Built target step_muxer_1212
[ 62%] Built target smooth_decimate_1414
[ 63%] Built target valve_1209
[ 64%] Built target hard_limiter_1413
[ 64%] Built target valve_rect_1405
[ 64%] Built target wave_terrain_1412
[ 68%] Built target cmt
[ 70%] Built target calf
[ 71%] Built target lb302
[ 72%] Built target midiimport
[ 73%] Built target multitapecho
[ 73%] Built target monstro
[ 74%] Built target nes
[ 74%] Built target OPL2
[ 74%] Built target organic
[ 75%] Built target papu
[ 76%] Built target patman
[ 77%] Built target peakcontrollereffect
[ 78%] Built target sfxr
[ 80%] Built target sid
[ 81%] Built target spectrumanalyzer
[ 82%] Built target stereoenhancer
[ 83%] Built target stereomatrix
[ 83%] Built target malletsstk
[ 83%] Generating ../RemoteVstPlugin
ld: Relocatable linking with relocations from format elf64-x86-64 (/usr/lib64/wine/libwinecrt0.a(exe_entry.o)) to format elf32-i386 (RemoteVstPlugin.sBWziW.o) is not supported
winebuild: ld failed with status 1
winegcc: winebuild failed
plugins/vst_base/CMakeFiles/vstbase.dir/build.make:61: recipe for target 'plugins/RemoteVstPlugin' failed
make[2]: *** [plugins/RemoteVstPlugin] Error 2
CMakeFiles/Makefile2:8768: recipe for target 'plugins/vst_base/CMakeFiles/vstbase.dir/all' failed
make[1]: *** [plugins/vst_base/CMakeFiles/vstbase.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
tresf commented 7 years ago

Per instructions in #5, can you also set VERBOSE=1 and post the relevant output?

djnotes commented 7 years ago

Yep, with VERBOSE=1, I get:

cd /home/mhd/src/lmms/build/plugins/vst_base && /usr/bin/wineg++ -I"/home/mhd/src/lmms/build" -I"/home/mhd/src/lmms/include" -I"/usr/local/include/wine/windows" -I"/usr/local/include" -I/usr/include/wine/windows "/home/mhd/src/lmms/plugins/vst_base/RemoteVstPlugin.cpp" -ansi -mwindows -lpthread -m32 -fno-omit-frame-pointer -fno-exceptions -Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow -Wno-array-bounds -fPIC -DPIC -o ../RemoteVstPlugin
ld: Relocatable linking with relocations from format elf64-x86-64 (/usr/lib64/wine/libwinecrt0.a(exe_entry.o)) to format elf32-i386 (RemoteVstPlugin.yePEra.o) is not supported
winebuild: ld failed with status 1
winegcc: winebuild failed
plugins/vst_base/CMakeFiles/vstbase.dir/build.make:61: recipe for target 'plugins/RemoteVstPlugin' failed
make[2]: *** [plugins/RemoteVstPlugin] Error 2
make[2]: Leaving directory '/home/mhd/src/lmms/build'
CMakeFiles/Makefile2:8768: recipe for target 'plugins/vst_base/CMakeFiles/vstbase.dir/all' failed
make[1]: *** [plugins/vst_base/CMakeFiles/vstbase.dir/all] Error 2
make[1]: Leaving directory '/home/mhd/src/lmms/build'
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
tresf commented 7 years ago

From what I'm reading with the other bug report (which doesn't really explain the workaround, leaving us to infer), this occurs if wineg++ is linked against the 64-bit libraries instead of the 32-bit libraries.

The workaround shims this with the following pseudo logic:

  1. CONDITIONAL: When passed the m32 flag, does the output of the command wineg++ -v -m32 /dev/zero contain the 64-bit version of the libwinecrt0.a library?
  2. IF TRUE: Then do not use the standard system libraries when linking and force linking against the 32-bit version of the libwinecrt0.a as well as user32, kernel32 and gdi32.

If your bug is the same cause, it may as simple as the above test is failing. Can you post the output of wineg++ -v -m32 /dev/zero ?

Disclaimer, I'm not an expert on this, just reading between the lines on the aforementioned bug.

djnotes commented 7 years ago

Sure, @tresf, here is the output of wineg++ -v -m32 /dev/zero:

[mhd@localhost build]$ wineg++ -v -m32 /dev/zero
g++ -m64 -m32 -fshort-wchar -DWINE_UNICODE_NATIVE -D_REENTRANT -fPIC -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -D__WINNT -D__WINNT__ -D__stdcall=__attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__)) -D__cdecl=__attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__)) -D_stdcall=__attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__)) -D_cdecl=__attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__)) -D__fastcall=__attribute__((__fastcall__)) -D_fastcall=__attribute__((__fastcall__)) -D__declspec(x)=__declspec_##x -D__declspec_align(x)=__attribute__((aligned(x))) -D__declspec_allocate(x)=__attribute__((section(x))) -D__declspec_deprecated=__attribute__((deprecated)) -D__declspec_dllimport=__attribute__((dllimport)) -D__declspec_dllexport=__attribute__((dllexport)) -D__declspec_naked=__attribute__((naked)) -D__declspec_noinline=__attribute__((noinline)) -D__declspec_noreturn=__attribute__((noreturn)) -D__declspec_nothrow=__attribute__((nothrow)) -D__declspec_novtable=__attribute__(()) -D__declspec_selectany=__attribute__((weak)) -D__declspec_thread=__thread -D__int8=char -D__int16=short -D__int32=int -D__int64=long long -D__WINE__ -c -o zero-4G8gPw.o -v -m32 /dev/zero -isystem/usr/include/wine/windows 
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 6.2.1 20160916 (Red Hat 6.2.1-2) (GCC) 
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/6.2.1/:/usr/libexec/gcc/x86_64-redhat-linux/6.2.1/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/6.2.1/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib64/../lib/:/usr/lib/gcc/x86_64-redhat-linux/6.2.1/32/:/usr/lib/gcc/x86_64-redhat-linux/6.2.1/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib64/:/usr/lib/gcc/x86_64-redhat-linux/6.2.1/:/usr/lib/gcc/x86_64-redhat-linux/6.2.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-fshort-wchar' '-D' 'WINE_UNICODE_NATIVE' '-D' '_REENTRANT' '-fPIC' '-D' 'WIN32' '-D' '_WIN32' '-D' '__WIN32' '-D' '__WIN32__' '-D' '__WINNT' '-D' '__WINNT__' '-D' '__stdcall=__attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))' '-D' '__cdecl=__attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))' '-D' '_stdcall=__attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))' '-D' '_cdecl=__attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))' '-D' '__fastcall=__attribute__((__fastcall__))' '-D' '_fastcall=__attribute__((__fastcall__))' '-D' '__declspec(x)=__declspec_##x' '-D' '__declspec_align(x)=__attribute__((aligned(x)))' '-D' '__declspec_allocate(x)=__attribute__((section(x)))' '-D' '__declspec_deprecated=__attribute__((deprecated))' '-D' '__declspec_dllimport=__attribute__((dllimport))' '-D' '__declspec_dllexport=__attribute__((dllexport))' '-D' '__declspec_naked=__attribute__((naked))' '-D' '__declspec_noinline=__attribute__((noinline))' '-D' '__declspec_noreturn=__attribute__((noreturn))' '-D' '__declspec_nothrow=__attribute__((nothrow))' '-D' '__declspec_novtable=__attribute__(())' '-D' '__declspec_selectany=__attribute__((weak))' '-D' '__declspec_thread=__thread' '-D' '__int8=char' '-D' '__int16=short' '-D' '__int32=int' '-D' '__int64=long long' '-D' '__WINE__' '-c' '-o' 'zero-4G8gPw.o' '-v' '-m32' '-isystem' '/usr/include/wine/windows' '-shared-libgcc' '-mtune=generic' '-march=i686'
g++: warning: /dev/zero: linker input file unused because linking not done
winebuild -v -fno-asynchronous-unwind-tables --cc-cmd=gcc -m64 --ld-cmd=ld -m32 -D_REENTRANT -fPIC --exe -o a.out-mYercU.spec.o -F a.out --subsystem console -L/usr/lib64/wine -L/usr/lib64 -- zero-4G8gPw.o /usr/lib64/wine/libadvapi32.def /usr/lib64/wine/libuser32.def /usr/lib64/wine/libwinecrt0.a /usr/lib64/wine/libkernel32.def /usr/lib64/wine/libntdll.def 
winebuild: zero-4G8gPw.o is an empty file
winegcc: winebuild failed
tresf commented 7 years ago

Thanks. Again, this is just a guess ,but can you change plugins/vst_base/CMakeLists.txt as follows?

    # workaround for broken wineg++ in WINE 1.4 (shipped e.g. with Ubuntu Precise)
    EXEC_PROGRAM( ${WINE_CXX} ARGS "-v -m32 /dev/zero" OUTPUT_VARIABLE WINEBUILD_OUTPUT)
-   if("${WINEBUILD_OUTPUT}" MATCHES ".*x86_64-linux-gnu/wine/libwinecrt0.a.*")
+   if("${WINEBUILD_OUTPUT}" MATCHES ".*lib64/wine/libwinecrt0.a.*")
        SET(EXTRA_FLAGS ${EXTRA_FLAGS} -nodefaultlibs /usr/lib/i386-linux-gnu/wine/libwinecrt0.a -luser32 -lkernel32 -lgdi32)
    ENDIF()
djnotes commented 7 years ago

Thanks, I changed it a bit and finally got it working :+1: The trick was to change /usr/lib/i386-linux-gnu/wine/libwinecrt0.a to /usr/lib/wine/libwinecrt0.a, but then you would have to install also 32 bit versions of wine development packages since there was only one libwinecrt0.a, which was under lib64/wine, so then you will want to install wine.i686 and wine-devel.i686.
Here is the resulting application fully built:

djnotes commented 7 years ago

Just one more thing, does anyone know why the application quite different from (and more fully featured than) the one provided by my Fedora repositories?

tresf commented 7 years ago

Does anyone know why the application quite different from (and more fully featured than) the one provided by my Fedora repositories?

Fedora offers 1.1.3. The version you've compiled is 1.2.0-RC1 with some additional changes before the 1.2.0-RC2 release.

Thanks, I changed it a bit and finally got it working 👍

Can you provide the exact Fedora steps you performed (yum or dnf commands)?

We can shim the CMakeLists.txt to accommodate Fedora, but we should also add the Fedora package names to our documentation.

djnotes commented 7 years ago

To solve this issue in Fedora, first look for libwinecrt0.a on your system with the following command:

(1) sudo find /usr -name libwinecrt0.a
You will most probably get /usr/lib64/wine/libwinecrt0.a only, which is 64 bit. you need to install 32 bit version too. To find those 32 bit packages look up the repositories, as follows:
(2)

dnf search wine| grep i686

You will get several package names including wine.i686 and wine-devel.i686, Install them as follows:
(3)

sudo dnf install wine.i686 wine-devel.i686

Be careful not to install every wine-related package you see as some conflict with each other and you might need to erase some to install some. If I knew how, I would list here all wine packages I have on my Fedora, before starting the build.
(4) If you issue the the find command of step 1, now you will also see /usr/lib/wine/libwinecrt0.a, which shows the location of 32 bit wine version. Change the patch in CMakeLists.txt as follows:

if("${WINEBUILD_OUTPUT}" MATCHES ".*lib64/wine/libwinecrt0.a.*")
                SET(EXTRA_FLAGS ${EXTRA_FLAGS} -nodefaultlibs /usr/lib/i386/wine/libwinecrt0.a -luser32 -lkernel32 -lgdi32)

Now, lmms should build fine.

djnotes commented 7 years ago

Can/should I or apply this patch to CMakeLists.txt? How can I do this?
I just made minor changes to the said file.

tresf commented 7 years ago

Can/should I or apply this patch to CMakeLists.txt? How can I do this?

Sure. You look like you're well on your way. I've added some comments to your pull request. Please free to commit additional changes to your branch and they will automatically be reflected in your pull request.

tresf commented 7 years ago

@jasonMisaq I've added your Fedora hint to our compilation tutorial here: https://github.com/LMMS/lmms/wiki/Compiling-lmms#building-on-linux

Once the Pull Request is completed, we'll merge and close out this issue.

djnotes commented 7 years ago

Thank you @tresf. It is great pleasure to be part of this great community :+1: