在win上编译 subversion 源码实践

2024-04-17 21:32

本文主要是介绍在win上编译 subversion 源码实践,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

(参考 http://svn.apache.org/repos/asf/subversion/trunk/INSTALL 的 E. Building the Latest Source under Windows)

资源准备

1, 下载subversion源码,下载地址: http://subversion.apache.org/download/#recommended-release,,win平台下载zip包,你可以选择 release版本,也可以选择rc1测试版本。

2. VS6,VS2002,VS2003,VS2005,VS2008 中的一种

3. python2.5 或更高版本,下载地址:http://www.python.org/

4. perl 5.8.   下载地址:http://dl.pcgames.com.cn/download/50293.html

5. AWK.exe。 下载地址 http://www.cs.princeton.edu/~bwk/btl.mirror/awk95.exe

6. 三个库文件 Apache apr(版本 0.9.12 或更高),apr-util, apr-iconv (可选项), 下载地址:http://www.apache.org/dist/apr/,不想这样下载源码编译,可以下载二进制打包的库,下载地址:文件http://www.apache.org/dist/apr/binaries/win32/

7. 【可选项】Apache 2 源码,下载地址:http://httpd.apache.org/download.cgi

8. 【可选项】Berkerly DB4, 下载地址:http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=688,db-4.3.27-win32.zip 和 db-4.4.20-win32.zip,哪个都行。

9. 【可选项】openssl 0.9.7f 下载地址: http://www.openssl.org/source/openssl-0.9.7f.tar.gz. 

10. 【可选项】GNU libintl的修改版本,称作 svn-win32-libintl.zip,用来显示本地化信息,下载地址:http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=2627

11. 【可选项】GNUGettex,下载地址:http://www.gnu.org/software/gettext/

12.  【可选项】汇编语言编译器, MASM32下载地址:http://www.masm32.com/,或是 NASM, 下载地址:http://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=Dt

虽然很多标明可选项,但从subversion的编译批处理文件模板来看,还是都配置的比较方便。

安装过程:

1. 创建SVN 目录,如将源码解压到指定路径下。例如 E:\SVN,在命令行运行下载版本的指令

   svn co https://svn.apache.org/repos/asf/subversion/trunk src-trunk

 或者将下载的 zip文件解压到SVN中,将文件夹名称(例如:subversion-1.7.10)换成 src-trunk。

2 . 安装 VS6,VS2002,VS2003,VS2005,VS2008 中的一种。注册环境变量,VS6.0 执行 VCVARS32.BAT批处理文件,更高版本运行程序菜单中的 “Microsoft Visual Studio 200x" -> "Visual Studio Tools" -> “Visual Studio 200x Command Prompt ” (中文 : “Visual Studio 200x 命令提示”)

如果你使用 VS6.0,还要安装和注册当前Windows Core SDK。

"To register the SDK bin, include, and library directories with Microsoft Visual Studio® version 6.0 and Visual Studio .NET, click Start, point to All Programs, point to Microsoft Platform SDK February 2003, point to Visual Studio Registration, and then click Register PSDK Directories with Visual Studio. This registration process places the SDK bin, include, and library directories at the beginning of the search paths, which ensures that the latest headers and libraries are used when building applications in the IDE. Note that for Visual Studio 6.0 integration to succeed, Visual Studio 6.0 must run at least once before you select Register PSDK Directories with Visual Studio. Also note that when this option is run, the IDEs should not be running."

3. 安装 python2.5 或更高版本。

4. 安装 perl 5.8. 

5. 将 AWK95.exe。复制到 SVN\awk\awk.exe,将这个路径加入path环境变量

6. 三个库文件 Apache apr, apr-util, apr-iconv (可选项), 版本 0.9.12 或更高。 下载地址:http://www.apache.org/dist/apr/,不想这样下载源码编译,可以下载二进制打包的库,下载地址:文件 http://www.apache.org/dist/apr/binaries/win32/

7. 如果你要编译server模块,下载 httpd 2.x.x 源码,下载地址:http://mirror.bit.edu.cn/apache//httpd/binaries/win32/,目前windows平台下的httpd源码只有2.0.64版本,解压到SVN\httpd-2.x.x,用VS6.0或更高版本打开Apache.dsw,全编,报错

解决办法:

In case anyone else runs across this, the problem was with the ordering of the headers... windows.h can be commented out and wincrypt.h should be moved to after apr.h:

// #include <windows.h> <<---- commented
#include "apr.h"
#include <wincrypt.h>   // <<---- move to after apr.h
#include "apr_private.h"
#include "apr_general.h"
#include "apr_portable.h"
#include "apr_arch_misc.h"

参考:http://www.spinics.net/lists/apache-users/msg75121.html

然后遇到报错 AWK 不是有效命令,明明完成了步骤4,但还是报错,参考 http://blog.csdn.net/ftomorrow/article/details/3980143,在VC6.0 的 菜单Tools -> Options -> 选项 Directories -> Executable files 中加入 AWk 路径。编译成功


8. 如果你不用dependency中的zlib模块,也可以到 http://www.zlib.net/ 下载源码,解压到 SVN\zlib-x.x.x

9. 下载 Berkerly DB, 下载地址(需要注册,免费的):http://www.oracle.com/technetwork/products/berkeleydb/downloads/index-082944.html,

安装好后到安装目录下复制include 和 lib 文件夹到 路径 SVN\src-trunk\db4-win32

10. 在 http://www.openssl.org/ 下载 openssl源码,解压到 SVN\openssl-x.x.x

11. 解压svn-win32-libintl.zip 到 SVN\svn-win32-libintl目录,它依赖于 Gettext

12. 解压 Gettext 到 SVN\Gettext

13. 解压 NASM  到 SVN\NASM 目录或 MASM32 到 SVN\MASM32,nasm.exe 改名为nasmw.exe,否则编译时会报告找不到nasmw可执行文件。

编译SVN

打开 SVN\src-trunk\build\win32\vc6-build.bat.in,修改并另存为  批处理文件 vc6-build.bat

实际上,我在上述源码目录树中保留了版本号,如用 nasm-2.10.07 目录名代替了 nasm目录名,用gettext-0.18.2目录名代替了gettext,用openssl-0.9.7f代替了openssl。后来在编译openssl时发现,openssl的脚本都假设了工作目录名是openssl,不能是其他,所以openssl的目录名是固定不能变的。

@echo off
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements.  See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership.  The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License.  You may obtain a copy of the License at
@REM
@REM   http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied.  See the License for the
@REM specific language governing permissions and limitations
@REM under the License.rem ====== Environment change lives only for the duration of the script
setlocalrem ====== Set these shell variables before doing a build.
rem VER is used to name the output bin dir as svn-win32-%VER%
set VER=trunk
rem DIR is appended to src- to make the dir name, e.g., src-trunk
set DIR=trunk
set DRIVE=E
set SVNDIR=E:\workdir\SVN
set PYTHONDIR=C:\Program Files\python33
set AWKDIR=%SVNDIR%\AWK
set HTTPDDIR=httpd-2.0.64
set OPENSSLDIR=openssl-0.9.7f
set ZLIBDIR=zlib-1.2.8
set GETTEXTDIR=gettext-0.18.2
set NASMDIR=nasm-2.10.07
set SDKINC=C:\Program Files\Microsoft SDKs\Windows\v5.0\Include
set SDKLIB=C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib
set APACHEDIR=C:\Program Files\Apache Software Foundation\Apache2.2
set GETTEXTINC=%SVNDIR%\%GETTEXTDIR%\include
set GETTEXTLIB=%SVNDIR%\%GETTEXTDIR%\lib
set GETTEXTBIN=%SVNDIR%\%GETTEXTDIR%\bin
rem ====== End of shell variables which need to be set.rem Set up path to include Python and BDB.
PATH=%PATH%;%SVNDIR%\SVN\src-%DIR%\db4-win32;%SVNDIR%\%NASMDIR%;%PYTHONDIR%;%AWKDIR%;%GETTEXTBIN%rem Set INCLUDE and LIB for the msdev builds.
set INCLUDE=%SDKINC%;%INCLUDE%;%GETTEXTINC%
set LIB=%SDKLIB%;%LIB%;%GETTEXTLIB%echo %INCLUDE%rem Check that the subversion code exists here.
cd %SVNDIR%\src-%DIR%
if not exist subversion goto wrongstartdir
cd ..rem ====== Check the prerequisites are at least in the right place.
if not exist %HTTPDDIR% goto httpderr
if not exist %NASMDIR% goto nasmerr
if not exist %OPENSSLDIR% goto opensslerr
if not exist src-%DIR% goto svnerr
if not exist %ZLIBDIR% goto zliberr
if not exist %ZLIBDIR%\zlibstat.lib goto zlibstaterr
if not exist src-%DIR%\db4-win32 goto bdberr
rem if not exist src-%DIR%\neon goto neonerr
if not exist %GETTEXTDIR% goto gettexterr
goto allok:wrongstartdir
echo Unable to find %SVNDIR%\src-%DIR%\subversion
goto theveryend
:httpderr
echo Unable to find %HTTPDDIR%
goto end
:nasmerr
echo Unable to find %NASMDIR%
goto end
:opensslerr
echo Unable to find %OPENSSLDIR%
goto end
:svnerr
echo Unable to find Subversion source in src-%DIR%
goto end
:zliberr
echo Unable to find %ZLIBDIR%
goto end
:zlibstaterr
echo Please copy %ZLIBDIR%\static32\zlibstat.lib to %ZLIBDIR%\zlibstat.lib
goto end
:bdberr
echo Unable to find Berekely DB
goto end
:neonerr
echo Unable to find neon
goto end
:gettexterr
echo Unable to find %GETTEXTDIR%
goto end
:allokrem ====== Build openssl.
cd %OPENSSLDIR%
perl Configure VC-WIN32
call ms\do_nasm
nmake -f ms\ntdll.mak
cd out32dll
call ..\ms\test
cd ..\..rem ====== Build Apache 2
cd src-%DIR%
python gen-make.py -t dsp --with-httpd=..\%HTTPDDIR% --with-berkeley-db=db4-win32 --with-openssl=..\%OPENSSLDIR% --with-zlib=..\%ZLIBDIR% --enable-nls --enable-bdb-in-apr-util
cd ..
msdev %HTTPDDIR%\apache.dsw /MAKE "BuildBin - Win32 Release"rem ====== Subversion
cd src-%DIR%
msdev subversion_msvc.dsw /USEENV /MAKE "__ALL_TESTS__ - Win32 Release"
mkdir Release\subversion\tests\cmdline
xcopy /S /Y subversion\tests\cmdline Release\subversion\tests\cmdline
copy Release\subversion\mod_dav_svn\mod_dav_svn.so "%APACHEDIR%\modules"
copy Release\subversion\mod_authz_svn\mod_authz_svn.so "%APACHEDIR%\modules"
cd ..rem ====== Copy the binaries into a tree suitable for zipping.
mkdir svn-win32-%VER%
mkdir svn-win32-%VER%\bin
mkdir svn-win32-%VER%\httpd
mkdir svn-win32-%VER%\iconv
copy src-%DIR%\db4-win32\bin\libdb42.dll svn-win32-%VER%\bin
copy %OPENSSLDIR%\out32dll\libeay32.dll svn-win32-%VER%\bin
copy %OPENSSLDIR%\out32dll\ssleay32.dll svn-win32-%VER%\bin
copy %HTTPDDIR%\srclib\apr\Release\libapr.dll svn-win32-%VER%\bin
copy %HTTPDDIR%\srclib\apr-iconv\Release\libapriconv.dll svn-win32-%VER%\bin
copy %HTTPDDIR%\srclib\apr-iconv\Release\iconv\*.so svn-win32-%VER%\iconv
copy %HTTPDDIR%\srclib\apr-util\Release\libaprutil.dll svn-win32-%VER%\bin
copy gettext\bin\intl.dll svn-win32-%VER%\bin
copy gettext\bin\iconv.dll svn-win32-%VER%\bin
copy src-%DIR%\Release\subversion\svn\svn.exe svn-win32-%VER%\bin
copy src-%DIR%\Release\subversion\svnadmin\svnadmin.exe svn-win32-%VER%\bin
copy src-%DIR%\Release\subversion\svndumpfilter\svndumpfilter.exe svn-win32-%VER%\bin
copy src-%DIR%\Release\subversion\svnlook\svnlook.exe svn-win32-%VER%\bin
copy src-%DIR%\Release\subversion\svnserve\svnserve.exe svn-win32-%VER%\bin
copy src-%DIR%\Release\subversion\svnversion\svnversion.exe svn-win32-%VER%\bin
copy src-%DIR%\Release\subversion\svnrdump\svnrdump.exe svn-win32-%VER%\bin
copy src-%DIR%\Release\subversion\mod_authz_svn\mod_authz_svn.so svn-win32-%VER%\httpd
copy src-%DIR%\Release\subversion\mod_dav_svn\mod_dav_svn.so svn-win32-%VER%\httpd
copy svn-win32-%VER%\bin\intl.dll "%APACHEDIR%\bin"
copy svn-win32-%VER%\bin\iconv.dll "%APACHEDIR%\bin"
copy svn-win32-%VER%\bin\libdb42.dll "%APACHEDIR%\bin"rem ====== Configure Apache ready for doing tests.
@echo off
echo Configure Apache to use the mod_dav_svn and mod_authz_svn modules
echo by making sure these lines appear uncommented in httpd.conf:
echo LoadModule dav_module         modules/mod_dav.so
echo LoadModule dav_fs_module      modules/mod_dav_fs.so
echo LoadModule dav_svn_module     modules/mod_dav_svn.so
echo LoadModule authz_svn_module   modules/mod_authz_svn.so
echo And further down the file add:
echo ^<Location /svn-test-work/repositories^>
echo  DAV svn
echo  SVNParentPath %SVNDIR%/src-%DIR%/Release/subversion/tests/cmdline/svn-test-work/repositories
echo ^</Location^>
echo ^<Location /svn-test-work/local_tmp/repos^>
echo  DAV svn
echo  SVNPath %SVNDIR%/src-%DIR%/Release/subversion/tests/cmdline/svn-test-work/local_tmp/repos
echo ^</Location^>
echo Then restart Apache.echo Please configure Apache and press enter:
pause
@echo onrem ====== Run the tests.
PATH=%SVNDIR%\svn-win32-%VER%\bin;%PATH%
cd src-%DIR%
python win-tests.py -c -r -v
python win-tests.py -c -r -v -u http://localhost
cd ..:end
cd src-%DIR%
endlocal
:theveryend
call cmd.exe 

期间遇到各种报错的解决方式:

1. 路径找不到

确认 set HTTPDDIR=httpd-2.0.64,set OPENSSLDIR=openssl-0.9.7f,set ZLIBDIR=zlib-1.2.8,set GETTEXTDIR=gettext-0.18.2,set NASMDIR=%SVNDIR%\nasm-2.10.07 各路径是否存在,以及文件夹内文件是否完整。

还有就是在 VC6.0 中也要设定SDK 包含路径和 awk 执行路径,否则会遇到类似下面的报错

--------------------Configuration: mod_auth_dbm - Win32 Release--------------------

Creating Version Resource
'awk' 不是内部或外部命令,也不是可运行的程序或批处理文件。

Error executing c:\windows\system32\cmd.exe.

需要在Visual Studio 界面菜单Tools -> Options...设置


2. sal.h 文件不存在(specstring.h 中include "sal.h"语句)。

如果遇到这个问题,可以考虑将SDK include 路径设定为 C:\Program Files\Microsoft SDKs\Windows\v5.0\Include,而不要选择 C:\Program Files\Microsoft SDKs\Windows\v6.0a\Include。SDK lib文件夹也做相应修改。

  如果不这样修改,而是强制加入 9.0/VC/include路径(这个路径下有sal.h文件),可能发生报错:C:\Program Files\Microsoft Visual Studio 9.0\VC\Include\stdio.h(237) : error C2485: 'deprecated' : unrecognized extended attribute


3.except getopt.GetoptError, e:

SyntaxError: invalid syntax

如果不是使用python 2.7/2.8,而是像本文中用更高的python版本(3.3),except语句应该改为 except getopt.GetoptError as e: 而不是except getopt.GetoptError, e:,逗号语法在新的版本中废弃了。由于还存在其他语法报错,看来python3.3的语法改动还是有些多,后来我还是安装了python 2.7.5,而不是继续学习python脚本语言。

4. 找不到 WtsApi32.h

Compiling...
ApacheMonitor.c
E:\lhk-work\SVN\httpd-2.0.64\support\win32\ApacheMonitor.c(45) : fatal error C1083: Cannot open include file: 'WtsApi32.h': No such file or directory
Error executing cl.exe.

这是因为 VC6.0 或 VS2005 或VS2008 选项中没有配置 SDK头文件包含路径。选择菜单 Tools -> Options...,在列表中添加 SDK头文件包含目录“C:\PROGRAM FILES\MICROSOFT SDKS\WINDOWS\V5.0\INCLUDE”,

5. 缺少头文件

。。。\SVN\httpd-2.0.64\srclib\apr\include\apr_want.h(52): Could not find the file strings.h.
。。。k\SVN\httpd-2.0.64\srclib\apr\include\apr_want.h(85): Could not find the file sys/uio.h.
。。。\SVN\httpd-2.0.64\srclib\apr\include\apr_want.h(103): Could not find the file arpa/inet.h.

采用简单粗暴的方式,可以在apr_want.h 中注释掉出错的宏

#if APR_HAVE_STRINGS_H
//#include <strings.h>
#endif
。。。
#if APR_HAVE_SYS_UIO_H
//#include <sys/uio.h>
#endif
。。。
#if APR_HAVE_ARPA_INET_H
//#include <arpa/inet.h>
#endif
原则上应该是修改apr.h.hw文件模板,但似乎不起作用。 
6. 汇编出错

.\crypto\rc4\asm\r4_win32.asm:30: error: operation size not specified
.\crypto\rc4\asm\r4_win32.asm:265: error: operation size not specified
.\crypto\rc4\asm\r4_win32.asm:267: error: operation size not specified
.\crypto\rc4\asm\r4_win32.asm:271: error: operation size not specified

试过3个版本nasm-2.10.07,nasm-2.00,nasm-0.99.06,都出同样的错误,按照http://comments.gmane.org/gmane.comp.encryption.openssl.devel/8634 所说,原来openssl-0.9.7f的perl脚本有bug,于是去ftp://ftp.openssl.org/snapshot/ 换了稳定版本,由于本人钟爱最新版本,所以下载 openssl-1.0.2-stable-SNAP-20130614.tar.gz,然后发现在编译sha512模块的汇编文件时又报错,
. tmp32dll\sha512-586.asm:515: error: mismatch in operand sizes

没办法,老老实实下载 openssl-0.9.8-stable-SNAP-20130611.tar.gz,编译通过。

7.  neon 模块报错,因为我们没有添加 neon'模块

Traceback (most recent call last):
  File "gen-make.py", line 317, in <module>
    main(conf, gentype, skip_depends=skip, other_options=rest.list)
  File "gen-make.py", line 65, in main
    generator.write()
  File "build\generator\gen_msvc_dsp.py", line 133, in write
    self.write_neon_project_file('neon.dsp')
  File "build\generator\gen_win.py", line 1183, in write_neon_project_file
    ('project_guid', self.makeguid('neon')),
  File "build\generator\gen_win.py", line 1232, in move_proj_file
    self.write_with_template(dest_file, source_template, data)
  File "build\generator\gen_win.py", line 1144, in write_with_template
    self.write_file_if_changed(fname, fout.getvalue())
  File "build\generator\gen_win.py", line 1135, in write_file_if_changed
    open(fname, 'wb').write(new_contents)
IOError: [Errno 2] No such file or directory: 'neon\\neon.dsp'

在生成 neon.dsp时将报错,neon不是必须的,可以修改SVN\src-trunk\build\generator\gen_win.py 解决,当没找到neon模块时,设置 self.without_neon = True,因为这个标志初始化时值为False。

      except:msg = 'WARNING: Error while determining neon version\n'self.neon_lib = Noneself.without_neon = True

你也可以在 vc6-build.bat 中执行gen_win.py的命令中显式添加 --without-neon参数。

python gen-make.py -t dsp --with-httpd=..\%HTTPDDIR% --with-berkeley-db=db4-win32 --with-openssl=..\%OPENSSLDIR% --with-zlib=..\%ZLIBDIR% --enable-nls --enable-bdb-in --without-neon

8. SVN\src-trunk 目录下生成 subversion_msvc.dsw 成功后,用VC6.0编译,报错

8.1 cache-membuffer.c

E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache-membuffer.c(552) : warning C4013: 'UINT64_C' undefined; assuming extern returning int

E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache-membuffer.c(999) : error C2059: syntax error : 'bad suffix on number'

E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache-membuffer.c(999) : error C2146: syntax error : missing ')' before identifier 'l'

解决方法,把 MIN_SEGMENT_SIZE定义改为 #define MIN_SEGMENT_SIZE UINT64_C(0x2000000)

8.2 cache.c
Generating Code...
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache.c(216) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache.c(216) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache.c(218) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache.c(218) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache.c(220) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache.c(220) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache.c(222) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\cache.c(222) : error C2520: conversion from unsigned __int64 to double not implemented, use signed __int64

解决方法,类型全改为signed __int64,权宜之计。

8.3 E:\workdir\SVN\src-trunk\subversion\libsvn_subr\config_win.c(55) : error C2065: 'CSIDL_COMMON_APPDATA' : undeclared identifier
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\config_win.c(56) : error C2065: 'CSIDL_FLAG_CREATE' : undeclared identifier
E:\workdir\SVN\src-trunk\subversion\libsvn_subr\config_win.c(62) : warning C4013: 'SHGetFolderPathW' undefined; assuming extern returning int

E:\workdir\SVN\src-trunk\subversion\libsvn_subr\config_win.c(62) : error C2065: 'SHGFP_TYPE_CURRENT' : undeclared identifier

解决方法,Tools->Options... 将SDK include目录放最前面,同样lib文件夹也放最前面

8.4 E:\workdir\SVN\src-trunk\build\win32\svn.rc(28) : fatal error RC1015: cannot open include file 'apr_general.h'.

解决方法,


这篇关于在win上编译 subversion 源码实践的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/912901

相关文章

解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题

《解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题》文章详细描述了在使用lombok的@Data注解标注实体类时遇到编译无误但运行时报错的问题,分析... 目录问题分析问题解决方案步骤一步骤二步骤三总结问题使用lombok注解@Data标注实体类,编译时

Go中sync.Once源码的深度讲解

《Go中sync.Once源码的深度讲解》sync.Once是Go语言标准库中的一个同步原语,用于确保某个操作只执行一次,本文将从源码出发为大家详细介绍一下sync.Once的具体使用,x希望对大家有... 目录概念简单示例源码解读总结概念sync.Once是Go语言标准库中的一个同步原语,用于确保某个操

SpringBoot项目中Maven剔除无用Jar引用的最佳实践

《SpringBoot项目中Maven剔除无用Jar引用的最佳实践》在SpringBoot项目开发中,Maven是最常用的构建工具之一,通过Maven,我们可以轻松地管理项目所需的依赖,而,... 目录1、引言2、Maven 依赖管理的基础概念2.1 什么是 Maven 依赖2.2 Maven 的依赖传递机

Oracle查询优化之高效实现仅查询前10条记录的方法与实践

《Oracle查询优化之高效实现仅查询前10条记录的方法与实践》:本文主要介绍Oracle查询优化之高效实现仅查询前10条记录的相关资料,包括使用ROWNUM、ROW_NUMBER()函数、FET... 目录1. 使用 ROWNUM 查询2. 使用 ROW_NUMBER() 函数3. 使用 FETCH FI

在C#中获取端口号与系统信息的高效实践

《在C#中获取端口号与系统信息的高效实践》在现代软件开发中,尤其是系统管理、运维、监控和性能优化等场景中,了解计算机硬件和网络的状态至关重要,C#作为一种广泛应用的编程语言,提供了丰富的API来帮助开... 目录引言1. 获取端口号信息1.1 获取活动的 TCP 和 UDP 连接说明:应用场景:2. 获取硬

Java内存泄漏问题的排查、优化与最佳实践

《Java内存泄漏问题的排查、优化与最佳实践》在Java开发中,内存泄漏是一个常见且令人头疼的问题,内存泄漏指的是程序在运行过程中,已经不再使用的对象没有被及时释放,从而导致内存占用不断增加,最终... 目录引言1. 什么是内存泄漏?常见的内存泄漏情况2. 如何排查 Java 中的内存泄漏?2.1 使用 J

Linux中Curl参数详解实践应用

《Linux中Curl参数详解实践应用》在现代网络开发和运维工作中,curl命令是一个不可或缺的工具,它是一个利用URL语法在命令行下工作的文件传输工具,支持多种协议,如HTTP、HTTPS、FTP等... 目录引言一、基础请求参数1. -X 或 --request2. -d 或 --data3. -H 或

Java汇编源码如何查看环境搭建

《Java汇编源码如何查看环境搭建》:本文主要介绍如何在IntelliJIDEA开发环境中搭建字节码和汇编环境,以便更好地进行代码调优和JVM学习,首先,介绍了如何配置IntelliJIDEA以方... 目录一、简介二、在IDEA开发环境中搭建汇编环境2.1 在IDEA中搭建字节码查看环境2.1.1 搭建步

Docker集成CI/CD的项目实践

《Docker集成CI/CD的项目实践》本文主要介绍了Docker集成CI/CD的项目实践,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学... 目录一、引言1.1 什么是 CI/CD?1.2 docker 在 CI/CD 中的作用二、Docke

windows端python版本管理工具pyenv-win安装使用

《windows端python版本管理工具pyenv-win安装使用》:本文主要介绍如何通过git方式下载和配置pyenv-win,包括下载、克隆仓库、配置环境变量等步骤,同时还详细介绍了如何使用... 目录pyenv-win 下载配置环境变量使用 pyenv-win 管理 python 版本一、安装 和