coronalabs / corona

Solar2D Game Engine main repository (ex Corona SDK)
https://solar2d.com/
MIT License
2.54k stars 273 forks source link

[Linux] Fixed the network issues. #707

Closed zero-meta closed 5 months ago

zero-meta commented 5 months ago
  1. Fix the issue where responseHeaders are lost when returning from network.request().
  2. Fix the issue where files cannot be uploaded using network.upload().

Here is the test example, It contains a python3 local upload server app.py : test_network.zip

HBL001 commented 5 months ago

Hi, Just saw this update, and tried it out. Everything compiled a few days ago., but today I got "undefined reference to `luaload_network(lua_State*)'"

I saw your commit, and just wondered if....

rm -rf corona git clone --recursive git@github.com:coronalabs/corona.git cd corona cmake . make

... [ 36%] Linking CXX executable Solar2D /usr/bin/ld: CMakeFiles/Solar2D.dir/external/lua-5.1.3/src/loslib.c.o: in function os_tmpname': loslib.c:(.text+0x2c5): warning: the use oftmpnam' is dangerous, better use mkstemp' /usr/bin/ld: CMakeFiles/Solar2D.dir/platform/shared/Rtt_LinuxAppPackager.cpp.o: in functionRtt::LinuxAppPackager::Build(Rtt::AppPackagerParams, char const)': Rtt_LinuxAppPackager.cpp:(.text+0x1a9): warning: the use of mktemp' is dangerous, better usemkstemp' or `mkdtemp'

/usr/bin/ld: CMakeFiles/Solar2D.dir/platform/linux/src/NetworkLibrary.cpp.o: in function int Corona::Lua::Open<&(luaload_network(lua_State*))>(lua_State*)': NetworkLibrary.cpp:(.text._ZN6Corona3Lua4OpenIXadL_Z15luaload_networkP9lua_StateEEEEiS3_[_ZN6Corona3Lua4OpenIXadL_Z15luaload_networkP9lua_StateEEEEiS3_]+0x7): undefined reference toluaload_network(lua_State*)' collect2: error: ld returned 1 exit status make[2]: [CMakeFiles/Solar2D.dir/build.make:9505: Solar2D] Error 1 make[1]: [CMakeFiles/Makefile2:451: CMakeFiles/Solar2D.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

Just in case, I will clone the repo again from my fork, and will roll back

HBL001 commented 5 months ago

Hello, I just deleted my clone / synced my fork and cloned that fork.

git clone --recursive git@github.com:HBL001/corona.git git log (to the one before this last one) git revert 0d676ea87eb23035bf10571fc4bfc4652e3ba63c cd corona cmake . make

....

/usr/include/x86_64-linux-gnu/sys/timeb.h:29:12: note: declared here 29 | extern int ftime (struct timeb __timebuf) | ^~~~~ [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/CoronaBuilder/main.cpp.o [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/CoronaBuilder/Rtt_CoronaBuilder.cpp.o [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/CoronaBuilder/Rtt_AppPackagerFactory.cpp.o /home/torizon/corona/tools/CoronaBuilder/Rtt_AppPackagerFactory.cpp: In member function ‘const char Rtt::AppPackagerFactory::GetResourceDirectory() const’: /home/torizon/corona/tools/CoronaBuilder/Rtt_AppPackagerFactory.cpp:398:1: warning: no return statement in function returning non-void [-Wreturn-type] 398 | } | ^ [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/CoronaBuilder/Rtt_AppPackagerAndroidFactory.cpp.o [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/CoronaBuilder/Rtt_AppPackagerHTML5Factory.cpp.o [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/CoronaBuilder/Rtt_AppPackagerLinuxFactory.cpp.o [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/CoronaBuilder/Rtt_BuildParams.cpp.o [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/CoronaBuilder/Rtt_DownloadPluginsMain.cpp.o [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/CoronaBuilder/Rtt_LuaLibBuilder.cpp.o [100%] Building CXX object CMakeFiles/Solar2DBuilder.dir/tools/car/Rtt_Car.cpp.o [100%] Linking CXX executable Solar2DBuilder /usr/bin/ld: CMakeFiles/Solar2DBuilder.dir/external/lua-5.1.3/src/loslib.c.o: in function os_tmpname': loslib.c:(.text+0x2c5): warning: the use oftmpnam' is dangerous, better use mkstemp' /usr/bin/ld: CMakeFiles/Solar2DBuilder.dir/platform/shared/Rtt_LinuxAppPackager.cpp.o: in functionRtt::LinuxAppPackager::Build(Rtt::AppPackagerParams, char const)': Rtt_LinuxAppPackager.cpp:(.text+0x1a9): warning: the use of mktemp' is dangerous, better usemkstemp' or `mkdtemp' [100%] Built target Solar2DBuilder ./Solar2D [100%] Built target create_template

So I suspect, your "network issues fix" breaks something in NetworkLibrary.cpp, maybe only for the Linux build.

Apologies for being a nuisance !