mmontag / chip-player-js

Web-based music player for a variety of video game and chiptune music formats.
https://chiptune.app
GNU General Public License v3.0
324 stars 17 forks source link

How to compile modules `psflib` and `lazyusf2`? #84

Closed gb-2312 closed 2 years ago

gb-2312 commented 2 years ago

At present, I have updated the git repository to the latest version locally.

The two modules psflib and lazyusf2 are compiled with the make command (because README.md has no relevant compilation instructions, I also tried to compile); Running yarn run build-chip-core in the terminal command line of centos7 will prompt the following error:

[root@angelslh chip-player-js]# yarn run build-chip-core ;
yarn run v1.22.5
$ source ~/src/emsdk/emsdk_env.sh; node scripts/build-chip-core.js
Setting environment variables:
PATH = /usr/local/emsdk:/usr/local/emsdk/fastcomp/emscripten:/usr/local/emsdk/node/14.15.5_64bit/bin:/tmp/yarn--1626087265331-0.11519604913313386:/opt/source/github_project/chip-player-js/node_modules/.bin:/usr/local/share/.config/yarn/link/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/cmake/bin:/usr/local/autoconf/bin:/usr/local/yasm/bin:/usr/local/yasm/lib:/usr/local/node/bin:/usr/local/node/lib:/usr/local/yarn/bin:/usr/local/yarn/lib
Compiling to src/chip-core.js...
Invocation:
em++ --no-heap-copy -s EXPORTED_FUNCTIONS=[_cqt_init,_cqt_calc,_cqt_render_line,_cqt_bin_to_freq,_tp_write_audio,_tp_open,_tp_init,_tp_unload_soundfont,_tp_load_soundfont,_tp_add_soundfont,_tp_stop,_tp_seek,_tp_set_speed,_tp_get_duration_ms,_tp_get_position_ms,_tp_set_reverb,_tp_get_channel_in_use,_tp_get_channel_program,_tp_set_channel_mute,_tp_set_bank,_tp_set_synth_engine,_tp_note_on,_tp_note_off,_tp_program_change,_tp_pitch_bend,_tp_control_change,_tp_channel_pressure,_tp_render,_tp_panic,_tp_panic_channel,_tp_reset,_gme_open_data,_gme_play,_gme_delete,_gme_mute_voices,_gme_track_count,_gme_track_ended,_gme_voice_count,_gme_track_info,_gme_start_track,_gme_open_data,_gme_ignore_silence,_gme_set_tempo,_gme_seek_scaled,_gme_tell_scaled,_gme_set_fade,_gme_voice_name,_xmp_create_context,_xmp_start_player,_xmp_play_buffer,_xmp_get_frame_info,_xmp_end_player,_xmp_inject_event,_xmp_get_module_info,_xmp_get_format_list,_xmp_stop_module,_xmp_restart_module,_xmp_seek_time,_xmp_channel_mute,_xmp_get_player,_xmp_load_module_from_memory,_new_fluid_settings,_new_fluid_synth,_fluid_settings_setint,_fluid_settings_setnum,_fluid_settings_setstr,_fluid_synth_sfload,_fluid_synth_noteon,_fluid_synth_noteoff,_fluid_synth_all_notes_off,_fluid_synth_all_sounds_off,_fluid_synth_write_float,_fluid_synth_set_reverb,_adl_init,_adl_panic,_adl_generate,_adl_getBankNames,_adl_getBanksCount,_adl_setBank,_adl_getNumChips,_adl_setNumChips,_adl_setSoftPanEnabled,_adl_rt_controllerChange,_adl_rt_channelAfterTouch,_adl_rt_noteOff,_adl_rt_noteOn,_adl_rt_patchChange,_adl_rt_pitchBend,_adl_rt_resetState,_v2m_open,_v2m_write_audio,_v2m_get_position_ms,_v2m_get_duration_ms,_v2m_seek_ms,_v2m_set_speed,_v2m_close,_n64_load_file,_n64_get_duration_ms,_n64_get_position_ms,_n64_seek_ms,_n64_render_audio,_n64_shutdown,_mdx_set_rate,_mdx_set_dir,_mdx_open,_mdx_close,_mdx_next_frame,_mdx_frame_length,_mdx_calc_sample,_mdx_calc_log,_mdx_get_title,_mdx_get_length,_mdx_set_max_loop,_mdx_get_tracks,_mdx_get_current_notes,_mdx_set_speed,_mdx_get_position_ms,_mdx_set_position_ms,_mdx_create_context,_mdx_get_pdx_filename,_mdx_get_track_name,_mdx_set_track_mask] -s EXPORTED_RUNTIME_METHODS=[ALLOC_NORMAL,FS,UTF8ToString,allocate,ccall,getValue,setValue] -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=0 -s MODULARIZE=1 -s EXPORT_NAME=CHIP_CORE -s ENVIRONMENT=web -s USE_ZLIB=1 -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -lidbfs.js -Os -o src/chip-core.js -Qunused-arguments -Wno-deprecated -Wno-logical-op-parentheses -Wno-c++11-extensions -Wno-inconsistent-missing-override -Wno-c++11-narrowing -std=c++11 -DVGM_YM2612_MAME=1 -DHAVE_ZLIB_H -DHAVE_STDINT_H -IlibADLMIDI/include -DBWMIDI_DISABLE_XMI_SUPPORT -DBWMIDI_DISABLE_MUS_SUPPORT -DADLMIDI_DISABLE_MIDI_SEQUENCER -DADLMIDI_DISABLE_NUKED_EMULATOR -DADLMIDI_DISABLE_JAVA_EMULATOR -DADLMIDI_DISABLE_OPAL_EMULATOR -flto -fno-asynchronous-unwind-tables -fno-stack-protector -ffunction-sections -fdata-sections -DRONAN -s SAFE_HEAP=0 -Ipsflib -Ilazyusf2 -DEMU_COMPILE -DEMU_LITTLE_ENDIAN -DNO_DEBUG_LOGS -Wno-pointer-sign -fno-strict-aliasing tinysoundfont/showcqtbar.c tinysoundfont/tinyplayer.c game-music-emu/gme/Ay_Apu.cpp game-music-emu/gme/Ay_Core.cpp game-music-emu/gme/Ay_Cpu.cpp game-music-emu/gme/Ay_Emu.cpp game-music-emu/gme/blargg_common.cpp game-music-emu/gme/blargg_errors.cpp game-music-emu/gme/Blip_Buffer.cpp game-music-emu/gme/Bml_Parser.cpp game-music-emu/gme/c140.c game-music-emu/gme/C140_Emu.cpp game-music-emu/gme/Classic_Emu.cpp game-music-emu/gme/dac_control.c game-music-emu/gme/Data_Reader.cpp game-music-emu/gme/Downsampler.cpp game-music-emu/gme/Dual_Resampler.cpp game-music-emu/gme/Effects_Buffer.cpp game-music-emu/gme/Fir_Resampler.cpp game-music-emu/gme/fm.c game-music-emu/gme/fm2612.c game-music-emu/gme/fmopl.cpp game-music-emu/gme/Gb_Apu.cpp game-music-emu/gme/Gb_Cpu.cpp game-music-emu/gme/Gb_Oscs.cpp game-music-emu/gme/Gbs_Core.cpp game-music-emu/gme/Gbs_Cpu.cpp game-music-emu/gme/Gbs_Emu.cpp game-music-emu/gme/gme.cpp game-music-emu/gme/Gme_File.cpp game-music-emu/gme/Gme_Loader.cpp game-music-emu/gme/Gym_Emu.cpp game-music-emu/gme/Hes_Apu.cpp game-music-emu/gme/Hes_Apu_Adpcm.cpp game-music-emu/gme/Hes_Core.cpp game-music-emu/gme/Hes_Cpu.cpp game-music-emu/gme/Hes_Emu.cpp game-music-emu/gme/higan/dsp/dsp.cpp game-music-emu/gme/higan/dsp/SPC_DSP.cpp game-music-emu/gme/higan/processor/spc700/spc700.cpp game-music-emu/gme/higan/smp/memory.cpp game-music-emu/gme/higan/smp/smp.cpp game-music-emu/gme/higan/smp/timing.cpp game-music-emu/gme/k051649.c game-music-emu/gme/K051649_Emu.cpp game-music-emu/gme/k053260.c game-music-emu/gme/K053260_Emu.cpp game-music-emu/gme/k054539.c game-music-emu/gme/K054539_Emu.cpp game-music-emu/gme/Kss_Core.cpp game-music-emu/gme/Kss_Cpu.cpp game-music-emu/gme/Kss_Emu.cpp game-music-emu/gme/Kss_Scc_Apu.cpp game-music-emu/gme/M3u_Playlist.cpp game-music-emu/gme/Multi_Buffer.cpp game-music-emu/gme/Music_Emu.cpp game-music-emu/gme/Nes_Apu.cpp game-music-emu/gme/Nes_Cpu.cpp game-music-emu/gme/Nes_Fds_Apu.cpp game-music-emu/gme/Nes_Fme7_Apu.cpp game-music-emu/gme/Nes_Namco_Apu.cpp game-music-emu/gme/Nes_Oscs.cpp game-music-emu/gme/Nes_Vrc6_Apu.cpp game-music-emu/gme/Nes_Vrc7_Apu.cpp game-music-emu/gme/Nsf_Core.cpp game-music-emu/gme/Nsf_Cpu.cpp game-music-emu/gme/Nsf_Emu.cpp game-music-emu/gme/Nsf_Impl.cpp game-music-emu/gme/Nsfe_Emu.cpp game-music-emu/gme/okim6258.c game-music-emu/gme/Okim6258_Emu.cpp game-music-emu/gme/okim6295.c game-music-emu/gme/Okim6295_Emu.cpp game-music-emu/gme/Opl_Apu.cpp game-music-emu/gme/pwm.c game-music-emu/gme/Pwm_Emu.cpp game-music-emu/gme/qmix.c game-music-emu/gme/Qsound_Apu.cpp game-music-emu/gme/Resampler.cpp game-music-emu/gme/Rf5C164_Emu.cpp game-music-emu/gme/rf5c68.c game-music-emu/gme/Rf5C68_Emu.cpp game-music-emu/gme/Rom_Data.cpp game-music-emu/gme/Sap_Apu.cpp game-music-emu/gme/Sap_Core.cpp game-music-emu/gme/Sap_Cpu.cpp game-music-emu/gme/Sap_Emu.cpp game-music-emu/gme/scd_pcm.c game-music-emu/gme/segapcm.c game-music-emu/gme/SegaPcm_Emu.cpp game-music-emu/gme/Sgc_Core.cpp game-music-emu/gme/Sgc_Cpu.cpp game-music-emu/gme/Sgc_Emu.cpp game-music-emu/gme/Sgc_Impl.cpp game-music-emu/gme/Sms_Apu.cpp game-music-emu/gme/Sms_Fm_Apu.cpp game-music-emu/gme/Spc_Emu.cpp game-music-emu/gme/Spc_Filter.cpp game-music-emu/gme/Spc_Sfm.cpp game-music-emu/gme/Track_Filter.cpp game-music-emu/gme/Upsampler.cpp game-music-emu/gme/Vgm_Core.cpp game-music-emu/gme/Vgm_Emu.cpp game-music-emu/gme/ym2151.c game-music-emu/gme/Ym2151_Emu.cpp game-music-emu/gme/Ym2203_Emu.cpp game-music-emu/gme/ym2413.c game-music-emu/gme/Ym2413_Emu.cpp game-music-emu/gme/Ym2608_Emu.cpp game-music-emu/gme/Ym2610b_Emu.cpp game-music-emu/gme/Ym2612_Emu.cpp game-music-emu/gme/Ym3812_Emu.cpp game-music-emu/gme/ymdeltat.cpp game-music-emu/gme/Ymf262_Emu.cpp game-music-emu/gme/ymz280b.c game-music-emu/gme/Ymz280b_Emu.cpp game-music-emu/gme/Z80_Cpu.cpp libxmp/libxmp-lite-stagedir/lib/libxmp-lite.a fluidlite/build/libfluidlite.a libADLMIDI/src/chips/dosbox_opl3.cpp libADLMIDI/src/chips/dosbox/dbopl.cpp libADLMIDI/src/wopl/wopl_file.c libADLMIDI/src/adldata.cpp libADLMIDI/src/adlmidi.cpp libADLMIDI/src/adlmidi_load.cpp libADLMIDI/src/adlmidi_midiplay.cpp libADLMIDI/src/adlmidi_opl3.cpp libADLMIDI/src/adlmidi_private.cpp farbrausch-v2m/ronan.cpp farbrausch-v2m/scope.cpp farbrausch-v2m/v2mplayer.cpp farbrausch-v2m/v2mconv.cpp farbrausch-v2m/synth_core.cpp farbrausch-v2m/sounddef.cpp farbrausch-v2m/v2mwrapper.cpp psflib/libpsflib.a lazyusf2/liblazyusf.a lazyusf2/_wothke/n64plug.cpp mdxmini/src/mdxmini.c mdxmini/src/mdx2151.c mdxmini/src/mdxmml_ym2151.c mdxmini/src/mdxfile.c mdxmini/src/nlg.c mdxmini/src/pcm8.c mdxmini/src/pdxfile.c mdxmini/src/ym2151.c

shared:WARNING: /opt/source/github_project/chip-player-js/lazyusf2/liblazyusf.a: archive file contains duplicate entries. This is not supported by emscripten. Only the last member with a given name will be linked in which can result in undefined symbols. You should either rename your source files, or use `emar` to create you archives which works around this issue.
shared:WARNING:    duplicate: memory.o
shared:WARNING: object /tmp/emscripten_temp_0FYRyF_archive_contents/psflib.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_0FYRyF_archive_contents/psf2fs.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/ai_controller.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/callbacks.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/dbg_decoder.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/main.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/rom.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/savestates.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/util.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/memory.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/cart_rom.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/pi_controller.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/cached_interp.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/cp0.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/cp1.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/exception.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/interupt.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/mi_controller.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/pure_interp.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/r4300.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/r4300_core.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/recomp.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/reset.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/tlb.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/rdp_core.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/rdram.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/rdram_detection_hack.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/ri_controller.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/rsp_core.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/alist.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/alist_audio.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/alist_naudio.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/alist_nead.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/audio.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/cicx105.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/hle.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/jpeg.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/memory.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/mp3.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/musyx.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/plugin.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/rsp.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/cic.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/game_controller.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/n64_cic_nus_6105.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/pif.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/si_controller.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/usf.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/barray.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/resampler.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/vi_controller.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/assemble.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gbc.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gcop0.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gcop1.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gcop1_d.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gcop1_l.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gcop1_s.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gcop1_w.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gr4300.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gregimm.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gspecial.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/gtlb.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/regcache.o is not a valid object file for emscripten, cannot link
shared:WARNING: object /tmp/emscripten_temp_TQCWRA_archive_contents/rjump.o is not a valid object file for emscripten, cannot link
error: undefined symbol: psf_load
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: usf_clear
error: undefined symbol: usf_get_state_size
error: undefined symbol: usf_render
error: undefined symbol: usf_render_resampled
error: undefined symbol: usf_restart
error: undefined symbol: usf_set_compare
error: undefined symbol: usf_set_fifo_full
error: undefined symbol: usf_set_hle_audio
error: undefined symbol: usf_shutdown
error: undefined symbol: usf_upload_section
Error: Aborting compilation due to previous errors
shared:ERROR: '/usr/local/emsdk/node/14.15.5_64bit/bin/node /usr/local/emsdk/fastcomp/emscripten/src/compiler.js /tmp/tmpmHvTzW.txt /usr/local/emsdk/fastcomp/emscripten/src/library_pthread_stub.js' failed (1)
Done in 64.18s.

Can you help me take a look at this problem? This problem has troubled me for a long time, sorry I'm not familiar with the way Emscripten is compiled.. It seems that after the N64 chip support is added, the compiler has such a problem, thank you!

System/Software Environment/Runtime:

[root@angelslh chip-player-js]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@angelslh chip-player-js]# gcc --version
gcc (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@angelslh chip-player-js]# npm -v
6.14.11
[root@angelslh chip-player-js]# yarn -v
1.22.5
[root@angelslh chip-player-js]# 
mmontag commented 2 years ago

Hi @gb-2312, sorry about that. I have just added psflib and lazyusf2 instructions to the README - can you check it out and let me know if you still have trouble?

mmontag commented 2 years ago

https://github.com/mmontag/chip-player-js#subproject-psflib-and-lazyusf2

gb-2312 commented 2 years ago

Hello mmontag, i tried to compile according to the latest document of README.md, it seems that this problem still exists, the core compilation error message is as follows:

[root@angelslh chip-player-js]# yarn run build-chip-core ;
yarn run v1.22.5
$ source ~/src/emsdk/emsdk_env.sh; node scripts/build-chip-core.js
Setting environment variables:
PATH = /usr/local/emsdk:/usr/local/emsdk/fastcomp/emscripten:/usr/local/emsdk/node/14.15.5_64bit/bin:/tmp/yarn--1626087265331-0.11519604913313386:/opt/source/github_project/chip-player-js/node_modules/.bin:/usr/local/share/.config/yarn/link/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/cmake/bin:/usr/local/autoconf/bin:/usr/local/yasm/bin:/usr/local/yasm/lib:/usr/local/node/bin:/usr/local/node/lib:/usr/local/yarn/bin:/usr/local/yarn/lib
Compiling to src/chip-core.js...
Invocation:
em++ --no-heap-copy -s EXPORTED_FUNCTIONS=[_cqt_init,_cqt_calc,_cqt_render_line,_cqt_bin_to_freq,_tp_write_audio,_tp_open,_tp_init,_tp_unload_soundfont,_tp_load_soundfont,_tp_add_soundfont,_tp_stop,_tp_seek,_tp_set_speed,_tp_get_duration_ms,_tp_get_position_ms,_tp_set_reverb,_tp_get_channel_in_use,_tp_get_channel_program,_tp_set_channel_mute,_tp_set_bank,_tp_set_synth_engine,_tp_note_on,_tp_note_off,_tp_program_change,_tp_pitch_bend,_tp_control_change,_tp_channel_pressure,_tp_render,_tp_panic,_tp_panic_channel,_tp_reset,_gme_open_data,_gme_play,_gme_delete,_gme_mute_voices,_gme_track_count,_gme_track_ended,_gme_voice_count,_gme_track_info,_gme_start_track,_gme_open_data,_gme_ignore_silence,_gme_set_tempo,_gme_seek_scaled,_gme_tell_scaled,_gme_set_fade,_gme_voice_name,_xmp_create_context,_xmp_start_player,_xmp_play_buffer,_xmp_get_frame_info,_xmp_end_player,_xmp_inject_event,_xmp_get_module_info,_xmp_get_format_list,_xmp_stop_module,_xmp_restart_module,_xmp_seek_time,_xmp_channel_mute,_xmp_get_player,_xmp_load_module_from_memory,_new_fluid_settings,_new_fluid_synth,_fluid_settings_setint,_fluid_settings_setnum,_fluid_settings_setstr,_fluid_synth_sfload,_fluid_synth_noteon,_fluid_synth_noteoff,_fluid_synth_all_notes_off,_fluid_synth_all_sounds_off,_fluid_synth_write_float,_fluid_synth_set_reverb,_adl_init,_adl_panic,_adl_generate,_adl_getBankNames,_adl_getBanksCount,_adl_setBank,_adl_getNumChips,_adl_setNumChips,_adl_setSoftPanEnabled,_adl_rt_controllerChange,_adl_rt_channelAfterTouch,_adl_rt_noteOff,_adl_rt_noteOn,_adl_rt_patchChange,_adl_rt_pitchBend,_adl_rt_resetState,_v2m_open,_v2m_write_audio,_v2m_get_position_ms,_v2m_get_duration_ms,_v2m_seek_ms,_v2m_set_speed,_v2m_close,_n64_load_file,_n64_get_duration_ms,_n64_get_position_ms,_n64_seek_ms,_n64_render_audio,_n64_shutdown,_mdx_set_rate,_mdx_set_dir,_mdx_open,_mdx_close,_mdx_next_frame,_mdx_frame_length,_mdx_calc_sample,_mdx_calc_log,_mdx_get_title,_mdx_get_length,_mdx_set_max_loop,_mdx_get_tracks,_mdx_get_current_notes,_mdx_set_speed,_mdx_get_position_ms,_mdx_set_position_ms,_mdx_create_context,_mdx_get_pdx_filename,_mdx_get_track_name,_mdx_set_track_mask] -s EXPORTED_RUNTIME_METHODS=[ALLOC_NORMAL,FS,UTF8ToString,allocate,ccall,getValue,setValue] -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=0 -s MODULARIZE=1 -s EXPORT_NAME=CHIP_CORE -s ENVIRONMENT=web -s USE_ZLIB=1 -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -lidbfs.js -Os -o src/chip-core.js -Qunused-arguments -Wno-deprecated -Wno-logical-op-parentheses -Wno-c++11-extensions -Wno-inconsistent-missing-override -Wno-c++11-narrowing -std=c++11 -DVGM_YM2612_MAME=1 -DHAVE_ZLIB_H -DHAVE_STDINT_H -IlibADLMIDI/include -DBWMIDI_DISABLE_XMI_SUPPORT -DBWMIDI_DISABLE_MUS_SUPPORT -DADLMIDI_DISABLE_MIDI_SEQUENCER -DADLMIDI_DISABLE_NUKED_EMULATOR -DADLMIDI_DISABLE_JAVA_EMULATOR -DADLMIDI_DISABLE_OPAL_EMULATOR -flto -fno-asynchronous-unwind-tables -fno-stack-protector -ffunction-sections -fdata-sections -DRONAN -s SAFE_HEAP=0 -Ipsflib -Ilazyusf2 -DEMU_COMPILE -DEMU_LITTLE_ENDIAN -DNO_DEBUG_LOGS -Wno-pointer-sign -fno-strict-aliasing tinysoundfont/showcqtbar.c tinysoundfont/tinyplayer.c game-music-emu/gme/Ay_Apu.cpp game-music-emu/gme/Ay_Core.cpp game-music-emu/gme/Ay_Cpu.cpp game-music-emu/gme/Ay_Emu.cpp game-music-emu/gme/blargg_common.cpp game-music-emu/gme/blargg_errors.cpp game-music-emu/gme/Blip_Buffer.cpp game-music-emu/gme/Bml_Parser.cpp game-music-emu/gme/c140.c game-music-emu/gme/C140_Emu.cpp game-music-emu/gme/Classic_Emu.cpp game-music-emu/gme/dac_control.c game-music-emu/gme/Data_Reader.cpp game-music-emu/gme/Downsampler.cpp game-music-emu/gme/Dual_Resampler.cpp game-music-emu/gme/Effects_Buffer.cpp game-music-emu/gme/Fir_Resampler.cpp game-music-emu/gme/fm.c game-music-emu/gme/fm2612.c game-music-emu/gme/fmopl.cpp game-music-emu/gme/Gb_Apu.cpp game-music-emu/gme/Gb_Cpu.cpp game-music-emu/gme/Gb_Oscs.cpp game-music-emu/gme/Gbs_Core.cpp game-music-emu/gme/Gbs_Cpu.cpp game-music-emu/gme/Gbs_Emu.cpp game-music-emu/gme/gme.cpp game-music-emu/gme/Gme_File.cpp game-music-emu/gme/Gme_Loader.cpp game-music-emu/gme/Gym_Emu.cpp game-music-emu/gme/Hes_Apu.cpp game-music-emu/gme/Hes_Apu_Adpcm.cpp game-music-emu/gme/Hes_Core.cpp game-music-emu/gme/Hes_Cpu.cpp game-music-emu/gme/Hes_Emu.cpp game-music-emu/gme/higan/dsp/dsp.cpp game-music-emu/gme/higan/dsp/SPC_DSP.cpp game-music-emu/gme/higan/processor/spc700/spc700.cpp game-music-emu/gme/higan/smp/memory.cpp game-music-emu/gme/higan/smp/smp.cpp game-music-emu/gme/higan/smp/timing.cpp game-music-emu/gme/k051649.c game-music-emu/gme/K051649_Emu.cpp game-music-emu/gme/k053260.c game-music-emu/gme/K053260_Emu.cpp game-music-emu/gme/k054539.c game-music-emu/gme/K054539_Emu.cpp game-music-emu/gme/Kss_Core.cpp game-music-emu/gme/Kss_Cpu.cpp game-music-emu/gme/Kss_Emu.cpp game-music-emu/gme/Kss_Scc_Apu.cpp game-music-emu/gme/M3u_Playlist.cpp game-music-emu/gme/Multi_Buffer.cpp game-music-emu/gme/Music_Emu.cpp game-music-emu/gme/Nes_Apu.cpp game-music-emu/gme/Nes_Cpu.cpp game-music-emu/gme/Nes_Fds_Apu.cpp game-music-emu/gme/Nes_Fme7_Apu.cpp game-music-emu/gme/Nes_Namco_Apu.cpp game-music-emu/gme/Nes_Oscs.cpp game-music-emu/gme/Nes_Vrc6_Apu.cpp game-music-emu/gme/Nes_Vrc7_Apu.cpp game-music-emu/gme/Nsf_Core.cpp game-music-emu/gme/Nsf_Cpu.cpp game-music-emu/gme/Nsf_Emu.cpp game-music-emu/gme/Nsf_Impl.cpp game-music-emu/gme/Nsfe_Emu.cpp game-music-emu/gme/okim6258.c game-music-emu/gme/Okim6258_Emu.cpp game-music-emu/gme/okim6295.c game-music-emu/gme/Okim6295_Emu.cpp game-music-emu/gme/Opl_Apu.cpp game-music-emu/gme/pwm.c game-music-emu/gme/Pwm_Emu.cpp game-music-emu/gme/qmix.c game-music-emu/gme/Qsound_Apu.cpp game-music-emu/gme/Resampler.cpp game-music-emu/gme/Rf5C164_Emu.cpp game-music-emu/gme/rf5c68.c game-music-emu/gme/Rf5C68_Emu.cpp game-music-emu/gme/Rom_Data.cpp game-music-emu/gme/Sap_Apu.cpp game-music-emu/gme/Sap_Core.cpp game-music-emu/gme/Sap_Cpu.cpp game-music-emu/gme/Sap_Emu.cpp game-music-emu/gme/scd_pcm.c game-music-emu/gme/segapcm.c game-music-emu/gme/SegaPcm_Emu.cpp game-music-emu/gme/Sgc_Core.cpp game-music-emu/gme/Sgc_Cpu.cpp game-music-emu/gme/Sgc_Emu.cpp game-music-emu/gme/Sgc_Impl.cpp game-music-emu/gme/Sms_Apu.cpp game-music-emu/gme/Sms_Fm_Apu.cpp game-music-emu/gme/Spc_Emu.cpp game-music-emu/gme/Spc_Filter.cpp game-music-emu/gme/Spc_Sfm.cpp game-music-emu/gme/Track_Filter.cpp game-music-emu/gme/Upsampler.cpp game-music-emu/gme/Vgm_Core.cpp game-music-emu/gme/Vgm_Emu.cpp game-music-emu/gme/ym2151.c game-music-emu/gme/Ym2151_Emu.cpp game-music-emu/gme/Ym2203_Emu.cpp game-music-emu/gme/ym2413.c game-music-emu/gme/Ym2413_Emu.cpp game-music-emu/gme/Ym2608_Emu.cpp game-music-emu/gme/Ym2610b_Emu.cpp game-music-emu/gme/Ym2612_Emu.cpp game-music-emu/gme/Ym3812_Emu.cpp game-music-emu/gme/ymdeltat.cpp game-music-emu/gme/Ymf262_Emu.cpp game-music-emu/gme/ymz280b.c game-music-emu/gme/Ymz280b_Emu.cpp game-music-emu/gme/Z80_Cpu.cpp libxmp/libxmp-lite-stagedir/lib/libxmp-lite.a fluidlite/build/libfluidlite.a libADLMIDI/src/chips/dosbox_opl3.cpp libADLMIDI/src/chips/dosbox/dbopl.cpp libADLMIDI/src/wopl/wopl_file.c libADLMIDI/src/adldata.cpp libADLMIDI/src/adlmidi.cpp libADLMIDI/src/adlmidi_load.cpp libADLMIDI/src/adlmidi_midiplay.cpp libADLMIDI/src/adlmidi_opl3.cpp libADLMIDI/src/adlmidi_private.cpp farbrausch-v2m/ronan.cpp farbrausch-v2m/scope.cpp farbrausch-v2m/v2mplayer.cpp farbrausch-v2m/v2mconv.cpp farbrausch-v2m/synth_core.cpp farbrausch-v2m/sounddef.cpp farbrausch-v2m/v2mwrapper.cpp psflib/libpsflib.a lazyusf2/liblazyusf.a lazyusf2/_wothke/n64plug.cpp mdxmini/src/mdxmini.c mdxmini/src/mdx2151.c mdxmini/src/mdxmml_ym2151.c mdxmini/src/mdxfile.c mdxmini/src/nlg.c mdxmini/src/pcm8.c mdxmini/src/pdxfile.c mdxmini/src/ym2151.c

shared:WARNING: object /tmp/emscripten_temp_78bkDx_archive_contents/usf_internal.h is not valid according to llvm-nm, cannot link
error: undefined symbol: psf_load
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: usf_clear
error: undefined symbol: usf_get_state_size
error: undefined symbol: usf_render
error: undefined symbol: usf_render_resampled
error: undefined symbol: usf_restart
error: undefined symbol: usf_set_compare
error: undefined symbol: usf_set_fifo_full
error: undefined symbol: usf_set_hle_audio
error: undefined symbol: usf_shutdown
error: undefined symbol: usf_upload_section
Error: Aborting compilation due to previous errors
shared:ERROR: '/usr/local/emsdk/node/14.15.5_64bit/bin/node /usr/local/emsdk/fastcomp/emscripten/src/compiler.js /tmp/tmpz68_zo.txt /usr/local/emsdk/fastcomp/emscripten/src/library_pthread_stub.js' failed (1)
Done in 64.23s.
mmontag commented 2 years ago

Hm, I don't recognize that, but can you try clearing the Emscripten cache with --clear-cache? See https://github.com/mmontag/chip-player-js/blob/master/scripts/build-chip-core.js#L427.

gb-2312 commented 2 years ago

Hm, I don't recognize that, but can you try clearing the Emscripten cache with --clear-cache? See https://github.com/mmontag/chip-player-js/blob/master/scripts/build-chip-core.js#L427.

Still the problem...


cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/is_vanilla.txt" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating port: libz.a... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/asmjs/libz.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libc.bc... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/asmjs/libc.bc" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libcompiler_rt.bc... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/asmjs/libcompiler_rt.bc" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libc-wasm.bc... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/asmjs/libc-wasm.bc" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libc++-noexcept.a... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/asmjs/libc++-noexcept.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libc++abi.bc... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/asmjs/libc++abi.bc" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libdlmalloc.a... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/asmjs/libdlmalloc.a" for subsequent builds)
cache:INFO:  - ok
cache:INFO: generating system library: libpthreads_stub.bc... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/asmjs/libpthreads_stub.bc" for subsequent builds)
cache:INFO:  - ok
shared:WARNING: object /tmp/emscripten_temp_c084pY_archive_contents/usf_internal.h is not valid according to llvm-nm, cannot link
cache:INFO: generating system asset: generated_struct_info.json... (this will be cached in "/usr/local/emsdk/fastcomp/emscripten/cache/asmjs/generated_struct_info.json" for subsequent builds)
cache:INFO:  - ok
error: undefined symbol: psf_load
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: usf_clear
error: undefined symbol: usf_get_state_size
error: undefined symbol: usf_render
error: undefined symbol: usf_render_resampled
error: undefined symbol: usf_restart
error: undefined symbol: usf_set_compare
error: undefined symbol: usf_set_fifo_full
error: undefined symbol: usf_set_hle_audio
error: undefined symbol: usf_shutdown
error: undefined symbol: usf_upload_section
Error: Aborting compilation due to previous errors
shared:ERROR: '/usr/local/emsdk/node/14.15.5_64bit/bin/node /usr/local/emsdk/fastcomp/emscripten/src/compiler.js /tmp/tmpRrxzoZ.txt /usr/local/emsdk/fastcomp/emscripten/src/library_pthread_stub.js' failed (1)
Done in 394.94s.
[root@angelslh chip-player-js]# 

I will try to compile it on macos a little later today.

gb-2312 commented 2 years ago

Hello, i tried to compile on macos is the same problem, prompting shared:ERROR😂

error: undefined symbol: psf_load
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: usf_clear
error: undefined symbol: usf_get_state_size
error: undefined symbol: usf_render
error: undefined symbol: usf_render_resampled
error: undefined symbol: usf_restart
error: undefined symbol: usf_set_compare
error: undefined symbol: usf_set_fifo_full
error: undefined symbol: usf_set_hle_audio
error: undefined symbol: usf_shutdown
error: undefined symbol: usf_upload_section
Error: Aborting compilation due to previous errors
shared:ERROR: '/Users/angel/Documents/github_project/3rd/emsdk/node/14.15.5_64bit/bin/node /Users/angel/Documents/github_project/3rd/emsdk/fastcomp/emscripten/src/compiler.js /var/folders/n_/m4kdb5bs02g9sfmqgv87vs2r0000gn/T/tmpuHDWNc.txt /Users/angel/Documents/github_project/3rd/emsdk/fastcomp/emscripten/src/library_pthread_stub.js' failed (1)
✨  Done in 189.71s.
gb-2312 commented 2 years ago

build-emsdk.sh:

#!/bin/bash

cd /usr/local/ ;

git clone 'https://github.com/emscripten-core/emsdk' ;

# Switch to the folder `emsdk`
cd emsdk/ ;

# Install the specified version of emsdk
./emsdk install 1.39.11 ;
./emsdk activate 1.39.11 ;

# According to the following prompts, append environment variables to /etc/profile
source "/usr/local/emsdk/emsdk_env.sh" ;

# Create an associated directory about `emsdk_env.sh` (avoid modifying `package.json`)
mkdir -p ~/src/ ;
cd ~/src/ ;

# Create soft connection
ln -s /usr/local/emsdk/ emsdk ;
gb-2312 commented 2 years ago

build-chip.sh:

#!/bin/bash

cd /opt/source/github_project/ ;

git clone 'https://github.com/mmontag/chip-player-js' ;

cd chip-player-js/ ;

# saving position of `current folder`
current_pwd=`pwd`

git pull --rebase ;

node -v ;

# yarn-initial
yarn install ;

# libxmp
cd ${current_pwd}/libxmp ;

source ~/src/emsdk/emsdk_env.sh ;

autoconf ;

emconfigure ./configure ;

emmake make -f Makefile.lite ;

cd libxmp-lite-stagedir/ ;

autoconf ;

emconfigure ./configure --enable-static --disable-shared ;

emmake make ;

# fluidlite
cd ${current_pwd}/fluidlite/ ;

source ~/src/emsdk/emsdk_env.sh ;

rm -rf build ;

mkdir build ;

cd build ;

emcmake cmake -DDISABLE_SF3=1 .. ;

emmake make fluidlite-static ;

# psflib
cd ${current_pwd}/psflib/ ;

source ~/src/emsdk/emsdk_env.sh ;

emmake make -f Emscripten.Makefile libpsflib.a ;

# lazyusf2
cd ${current_pwd}/lazyusf2/ ;

source ~/src/emsdk/emsdk_env.sh ;

# find /usr -name 'zlib.h'
# find /usr -name 'zconf.h'

# linux:
    # cp /usr/include/zlib.h .
    # cp /usr/include/zconf.h .

# macos:
    # cp /usr/local/node-v11.15.0-darwin-x64/include/node/zlib.h .
    # cp /usr/local/node-v11.15.0-darwin-x64/include/node/zconf.h .

emmake make -f Emscripten.Makefile liblazyusf.a ;

# build-chip-core
cd ${current_pwd} ;

cp src/config/firebaseConfig.example.js src/config/firebaseConfig.js ;
# cp -f /root/chip_player_js/public/index.js ./public/ ;
# cp -f /root/chip_player_js/src/config/index.js ./src/config/ ;

# Need to manually configure
# chip-player-js/src/config/index.js
# The location where the music is actually stored (nginx also needs to pay attention), and the soft connection of the project also needs attention
# /var/www/gifx.co/public_html/music

# macos:
    # sudo chown -R angel:staff /var/www/gifx.co/ ;

# ln -s /var/www/gifx.co/public_html/music/ catalog ;

yarn run build-chip-core ;

# Local 3000 test
yarn start ;

# groupadd nodejs ;
# useradd nodejs -g nodejs ;

# Compile into a static file
yarn build ;

# cd /var/www/gifx.co/public_html ;

# macos
# macos, `/var/www/gifx.co/` is only responsible for the soft link, which can be scanned by the soft link of the catalog, and has no other purpose
# cd /var/www/gifx.co/ ;
# ln -s /Users/Shared/Docker/nginx/html/wwwphp public_html ;
# macos cannot use soft connection under docker, it must be copied in full!
# cp -r ~/Documents/github_project/3rd/chip-player-js/build/ /Users/Shared/Docker/nginx/html/wwwphp/website ;

# linux (use soft connection)
# ln -s /opt/source/github_project/chip-player-js/build/ website ;

# cd /var/www/gifx.co/public_html/website ;
# ln -s . chip-player-js ;

# main-folder
cd ${current_pwd} ;

# Build the `catalog` index:
node scripts/build-catalog.js ;

# Open API service
node public/index.js;
mmontag commented 2 years ago

Did the bash scripts you shared solve the problem? Usually I run these only as needed since they take a long time (build-chip-core and build-catalog).

You could try disabling the N64 support to just get past it. Just say enabled: false on https://github.com/mmontag/chip-player-js/blob/master/scripts/build-chip-core.js#L339.

Maybe something is still interfering from your previous build of libpsf/lazyusf2. Maybe try emmake make clean and rebuild.

gb-2312 commented 2 years ago

Did the bash scripts you shared solve the problem? Usually I run these only as needed since they take a long time (build-chip-core and build-catalog).

You could try disabling the N64 support to just get past it. Just say enabled: false on https://github.com/mmontag/chip-player-js/blob/master/scripts/build-chip-core.js#L339.

Maybe something is still interfering from your previous build of libpsf/lazyusf2. Maybe try emmake make clean and rebuild.

Hello mmontag, thank you very much for helping me check this issue, the compilation issue has been solved(caused by the emsdk version), and N64 chiptune works fine!

Compilable version:

yarn: 1.22.10
node: 11.15.0
emsdk: 1.39.11